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

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Fri Apr 15 08:38:46 EDT 2016


Michael,

To confirm, you didn't build ParaView to with VTK_USE_SYSTEM_NETCDF,
but you're making the plugin use a system one -- is that correct?

In theory that should have been fine since netcdf is mangled in VTK.
I suspect the include path setup when you include the ParaView package
erroneously adds includes for the mangled headers or something like
that and your plugin ends up seeing them and wanting to link against
them.

Can you try reverting your fix and then doing  a "make VERBOSE=1" and
share the output?

Thanks
Utkarsh

On Fri, Apr 15, 2016 at 12:59 AM, Schlottke-Lakemper, Michael
<m.schlottke-lakemper at aia.rwth-aachen.de> wrote:
> 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> 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
> Web: http://www.aia.rwth-aachen.de
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at:
> http://markmail.org/search/?q=Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>


More information about the Paraview-developers mailing list