From: Hazen B. <hba...@ma...> - 2006-08-22 23:57:37
|
On Aug 21, 2006, at 4:07 AM, Alan W. Irwin wrote: > > I think you can just specify these flags in bindings/python/ > CMakeLists.txt. > One method which might work is the following: > > if(APPLE) > swig_link_libraries(plplotcmodule plplot${LIB_TAG} $ > {PYTHON_LIBRARIES} > "-flat_namespace" "-undefined suppress" > ) > else (APPLE) > swig_link_libraries(plplotcmodule plplot${LIB_TAG}) > endif(APPLE) This didn't work. I still get: /usr/bin/gcc -bundle -headerpad_max_install_names -o _plplotcmodule.so "CMakeFiles/_plplotcmodule.dir/ plplotcmodulePYTHON_wrap.o" -L/Users/hbabcock/Documents/OpenSource/ PLplot/plplot-CBS-1/src -L/Users/hbabcock/Documents/OpenSource/PLplot/ plplot-CBS-1/lib/csa -L/Users/hbabcock/Documents/OpenSource/PLplot/ plplot-CBS-1/lib/nn -L/usr/local/lib -lplplotd -lltdl -ldl -lm - lcsirocsa -lcsironn -lqhull > Alternatively, CMAKE_MODULE_LINKER_FLAGS is in the cache so I think > to avoid > the shotgun approach you could in bindings/python/CMakeLists.txt > save the > value in a temporary variable, set the CMAKE_MODULE_LINKER_FLAGS cache > value, link all the python related stuff, and then restore the > cache value > from the temporary variable. if(APPLE) set(CMAKE_MODULE_LINKER_FLAGS "-flat_namespace -undefined suppress") endif(APPLE) In bindings/python/CMakeLists.txt works. I'm not sure where I should restore the default values of CMAKE_MODULE_LINKER_FLAGS however. I tried restoring them at the end of bindings/python/CMakeLists.txt but that did not work as these flags were no longer passed. > > Note, for the APPLE case above I tentatively used $ > {PYTHON_LIBRARIES}. This > is not needed in the Linux case, but it might be defined AND needed > in the > Mac OS X case (depending on how python itself is linked) and it > might let > you drop one or both of the -flat_namespace -undefined suppress > parameters. > Let me know if ${PYTHON_LIBRARIES} allows you to drop both special > linking > options. If that is the case then we could replace the above > complicated > logic by > > swig_link_libraries(plplotcmodule plplot${LIB_TAG} $ > {PYTHON_LIBRARIES}) This sounds promising. PYTHON_LIBRARIES is set to "-framework Python", so if it showed up on the link line it would probably work, but unfortunately it does not. >> >> Seems to be linking against stale libraries in /usr/local/lib. > > That's not clear from the above since > Documents/OpenSource/PLplot/plplot-CBS-2/src presumably refers to the > correct location of libplplotd and -L/usr/local/lib could be > referring to > any of the other libraries mentioned such as libltdl or libqhull > rather than > the stale libplplotd. I suggest > using otool on _plplotcmodule.so in both the build tree and install > tree to > make sure the correct versions of all the libraries are being found > in the > two cases with no stale libraries being used (even though stale > libraries > are available). However, to make doubly sure you can always remove > the True, otool reveals that _plplotcmodule.so has the correct versions of the libraries so we seem to be okay here. Btw, would it be possible to also search for swig in /usr/local/bin? -Hazen |