[CMake] Cmake MacOSX Question

Brad King brad.king at kitware.com
Fri Jun 23 13:49:10 EDT 2006


Hans J. Johnson wrote:
> Here is the output.  I am still perplexed as to why the tcl and tk libraries
> from the framework (or /usr/lib) are being included.
[snip]
>  /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/collect2 -dynamic -arch ppc
> -bind_at_load -headerpad_max_install_names -macosx_version_min 10.3
> -multiply_defined suppress -weak_reference_mismatches non-weak -o
> ../bin/brains2 -lcrt1.o /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/crt2.o
> /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/crt3.o
> -L/scratch/hjohnson/src/brains2/MacOSX/FAST/src/lib/InsightToolkit
 > -L.
> -L/scratch/hjohnson/src/brains2/MacOSX/FAST/src/lib
 > -L/usr/X11R6/lib
> -L/sw/lib
 > -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1
> -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1
> -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../..
[snip]
> -ltcl8.4 -ltk8.4

The libtcl8.4.so in /usr/lib is probably a symlink to the framework one. 
  I wonder if the current working directory of the collect2 process as 
started by gcc is /usr/lib, so that the -L. is picking up the files from 
there.  Try taking off the -L. from the command line of /usr/bin/c++.

Also note that the path 
-L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../.. is actually 
/usr/lib.  Perhaps the linker is searching backwards somehow?

Alternatively the linker could be searching the entire path for a shared 
library and then searching the entire path for a static library.  Since 
it finds libtcl8.4.so in /usr/lib it doesn't ever look for libtcl8.4.a. 
  Try changing TCL_LIBRARY to "-Wl,-Bstatic -ltcl8.4 -Wl,-Bdynamic".

-Brad


More information about the CMake mailing list