I tried shifting the order around, to no avail. I updated the gist to try to make the output a little more readable.
https://gist.github.com/3776497 I'm not sure why different flags are set here on the MacOS build vs. the Linux build. On Mac OS I'm using clang compiler. On Linux, Gnu The relevant sections: Linux => why is it adding -rdynamic here? /usr/bin/c++ -static CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime \ -rdynamic /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a -lpthread -lrt ../lib/libComm.a ../lib/libConfig.a ../lib/libComm.a(Comm.c.o): In function `Comm_Create': Comm.c:(.text+0x42): undefined reference to `zctx_new' Mac => cd /Users/davis/git/firmware/build/src && /usr/local/Cellar/cmake/2.8.9/bin/cmake -E cmake_link_script CMakeFiles/Runtime.dir/link.txt --verbose=1 /usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime \ -L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 \ -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 \ -L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1 \ -L/usr/llvm-gcc-4.2/lib/gcc \ -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1 \ -L/usr/llvm-gcc-4.2/lib -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib \ ../lib/libComm.a ../lib/libConfig.a /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a On Mon, Sep 24, 2012 at 8:31 AM, Bogdan Cristea <[email protected]> wrote: > On Monday 24 September 2012 08:28:26 Davis Ford wrote: > > Hi, I have a project that I'm able to build fine on Mac OS with CMake, > but > > when I check same project out on Ubuntu 12.04, I'm getting undefined > > reference errors at link time. > > > > Here's the relevant section of the CMakeLists.txt file, and make > VERBOSE=1 > > output for both Mac OS X (success) and Ubuntu 12.04 (failure) > > > > https://gist.github.com/3776497 > > > > The specific failure is > > > > In function `Comm_Create': > > Comm.c:(.text+0x42): undefined reference to `zctx_new' > > > > This function is defined in libczmq.a (which is being linked in the Make > > output) > > > > $ nm /usr/local/lib/libczmq.a | grep zctx_new > > 00000010 T zctx_new > > U zctx_new > > U zctx_new > > U zctx_new > > U zctx_new > > U zctx_new > > U zctx_new > > U zctx_new > > > > > > The other failure is > > > > Comm.c:(.text+0x5c): undefined reference to `zsocket_new' > > > > This function is also defined in libczmq.a > > > > $ nm /usr/local/lib/libczmq.a | grep zsocket_new > > U zsocket_new > > U zsocket_new > > U zsocket_new > > 00000000 T zsocket_new > > U zsocket_new > > U zsocket_new > > U zsocket_new > > > > What am I missing here? > > When linking with static libraries the order is comportant for gcc > compiler. > Not sure if this is also valid for MAC OS X, but you should check this. > > -- > Bogdan > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake > -- http://daisyworks.com
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
