[Cmake] Specifying static or dynamic linking of external libraries?
Thomas Deschamps
tdeschamps at lbl.gov
Tue Oct 22 13:32:44 EDT 2002
Ok,
I've specified the complete name (and I had to remove all the *.so files).
I'm trying to link against VTK static libraries.
But the thing is I had a lot of errors of this kind:
g++ -rdynamic -g test.o -L/usr/local/lib -lvtkCommon -lvtkRendering
-lvtkHybrid -lvtkImaging -lvtkGraphics -lvtkFiltering -lvtkIO
-Wl,-rpath,/usr/local/lib -o testImagePlaneWidget
/usr/local/lib/libvtkCommon.a(vtkDynamicLoader.o): In function
`vtkDynamicLoader::OpenLibrary(char const *)':
/home/users/deschamp/Tools/VTK/Common/vtkDynamicLoader.cxx:226:
undefined reference to `dlopen'
/usr/local/lib/libvtkCommon.a(vtkDynamicLoader.o): In function
`vtkDynamicLoader::CloseLibrary(void *)':
/home/users/deschamp/Tools/VTK/Common/vtkDynamicLoader.cxx:231:
undefined reference to `dlclose'
which means that the flag CMAKE_DL_LIBS (='ldl') is not used by
cmake.... but why?
Therefore I included it in the CMAKE_CXX_MODULE_LINK_FLAGS
But it was not included again. I decided to include it in
CMAKE_CXX_SHLIB_LINK_FLAGS, just to see what's happening.
The result was it included "-ldl" in the command line, which means it is
still using shared libraries linking while I am giving him only static
libraries, strange isn't it?
Sincerely, I do not understand what is going on, and why cmake is doing
all those things.
The final problem I have is that even with including the "-ldl"
somewhere it is still not working, giving errors like
/usr/local/lib/libvtkRendering.a(vtkActor.o): In function
`vtkActor::SetMapper(vtkMapper *)':
/home/users/deschamp/Tools/VTK/Rendering/vtkActor.cxx:529: undefined
reference to `vtkAbstractMapper::RemoveConsumer(vtkObject *)'
/home/users/deschamp/Tools/VTK/Rendering/vtkActor.cxx:536: undefined
reference to `vtkAbstractMapper::AddConsumer(vtkObject *)'
/usr/local/lib/libvtkRendering.a(vtkDataSetMapper.o): In function
`vtkDataSetMapper::SetInput(vtkDataSet *)':
/home/users/deschamp/Tools/VTK/Rendering/vtkDataSetMapper.cxx:47:
undefined reference to `vtkProcessObject::SetNthInput(int, vtkDataObject *)'
Apparently it does not find any of the vtk stuff.
Does anyone has been able to compile and use the static libraries?
Thomas
SP: I'm going to send this post to vtkusers mailing list also
More information about the CMake
mailing list