[Paraview-developers] Linking error with external NetCDF library when building plugins on OS X

Schlottke-Lakemper, Michael m.schlottke-lakemper at aia.rwth-aachen.de
Fri Apr 15 00:59:29 EDT 2016


Hi everyone,

Inspired from the CDIReader sources and feeling a bit hackish, I managed a workaround by adding the following lines to CMakeLists.txt:

…
# Only load VTK NetCDF on OS X
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  vtk_module_load(vtknetcdf)
endif()
…
# Only load VTK NetCDF on OS X
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  include_directories(${VTK_INCLUDE_DIRS})
endif()
…
# Only link VTK NetCDF on OS X
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  target_link_libraries(AiaReaderUnified LINK_PRIVATE ${vtknetcdf_LIBRARIES})
endif()

I don’t know why it works and I’m still interested in an actual solution, but I thought I’d post this anyway for others with similar issues.

Michael

On 14 Apr 2016, at 14:54 , Michael Schlottke-Lakemper <m.schlottke-lakemper at aia.rwth-aachen.de<mailto:m.schlottke-lakemper at aia.rwth-aachen.de>> wrote:

Hi folks,

I’m trying to build our custom plugins on OS X for PV 5.0.1. To avoid the fact that the “PARAVIEW_INSTALL_DEVELOPMENT_FILES” flag is not available on OS X, I try to build the plugins against the ParaView build directory, which I remember to have worked at least once (2-3 years ago…).

Usually, in our plugins we link against external versions of Parallel netCDF and NetCDF (i.e. not against vtkNetCDF etc.), which works fine on Linux. However, on OS X we always get the following error at link time:

########################################
…
[100%] Linking CXX shared library libAiaReaderUnified.dylib
Undefined symbols for architecture x86_64:
  "_vtk_netcdf_nc_close", referenced from:
      vtkAiaReaderUnified::CanReadFile(char const*) in vtkAiaReaderUnified.cxx.o
  "_vtk_netcdf_nc_open", referenced from:
      vtkAiaReaderUnified::CanReadFile(char const*) in vtkAiaReaderUnified.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
########################################

These are, I believe, the relevant lines from the plugin CMakeLists.txt:

########################################
...
find_package(NetCDF REQUIRED)
find_package(PNetCDF REQUIRED)
…
include_directories(
  SYSTEM
  ${NETCDF_INCLUDES}
  ${PNETCDF_INCLUDES}
)
…
target_link_libraries(AiaReaderUnified
  PUBLIC ${NETCDF_LIBRARIES} ${PNETCDF_LIBRARIES})
########################################

Any idea what I’m doing wrong? To me it seems like the wrong version of the NetCDF library is picked up somehow, but I can’t figure out what is causing this and how it is even possible that it proceeds to this point… It’s been ages since I tried to compile the plugins on OS X, and while I know I always had some troubles, I do not recall this particular error..

Regards,

Michael

--
Michael Schlottke-Lakemper

Chair of Fluid Mechanics and Institute of Aerodynamics
RWTH Aachen University
Wüllnerstraße 5a
52062 Aachen
Germany

Phone: +49 (241) 80 95188
Fax: +49 (241) 80 92257
Mail: m.schlottke-lakemper at aia.rwth-aachen.de<mailto:m.schlottke-lakemper at aia.rwth-aachen.de>
Web: http://www.aia.rwth-aachen.de<http://www.aia.rwth-aachen.de/>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20160415/0d2fd80f/attachment.html>


More information about the Paraview-developers mailing list