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

Reply via email to