I tried shifting the order around, to no avail.<br><br>I updated the gist to try to make the output a little more readable.<br><br><a href="https://gist.github.com/3776497">https://gist.github.com/3776497</a><br><br>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<br>
<br>The relevant sections:<br><br>Linux => why is it adding -rdynamic here? <br><br><pre><div class="line" id="LC13">/usr/bin/c++ -static CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime \</div><div class="line" id="LC14">
-rdynamic /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a -lpthread -lrt ../lib/libComm.a ../lib/libConfig.a </div><div class="line" id="LC15">../lib/libComm.a(Comm.c.o): In function `Comm_Create':</div><div class="line" id="LC16">
Comm.c:(.text+0x42): undefined reference to `zctx_new'<br><br>Mac =><br><br><pre><div class="line" id="LC38">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</div>
<div class="line" id="LC39">/usr/bin/c++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/Runtime.dir/Runtime.cpp.o -o ../bin/Runtime \</div><div class="line" id="LC40"> -L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 \</div>
<div class="line" id="LC41"> -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 \</div><div class="line" id="LC42"> -L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1 \</div>
<div class="line" id="LC43"> -L/usr/llvm-gcc-4.2/lib/gcc \</div><div class="line" id="LC44"> -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1 \</div><div class="line" id="LC45">
-L/usr/llvm-gcc-4.2/lib -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib \</div><div class="line" id="LC46"> ../lib/libComm.a ../lib/libConfig.a /usr/local/lib/libzmq.a /usr/local/lib/libczmq.a </div></pre>
<br></div></pre><br><br><div class="gmail_quote">On Mon, Sep 24, 2012 at 8:31 AM, Bogdan Cristea <span dir="ltr"><<a href="mailto:cristeab@gmail.com" target="_blank">cristeab@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Monday 24 September 2012 08:28:26 Davis Ford wrote:<br>
> Hi, I have a project that I'm able to build fine on Mac OS with CMake, but<br>
> when I check same project out on Ubuntu 12.04, I'm getting undefined<br>
> reference errors at link time.<br>
><br>
> Here's the relevant section of the CMakeLists.txt file, and make VERBOSE=1<br>
> output for both Mac OS X (success) and Ubuntu 12.04 (failure)<br>
><br>
> <a href="https://gist.github.com/3776497" target="_blank">https://gist.github.com/3776497</a><br>
><br>
> The specific failure is<br>
><br>
> In function `Comm_Create':<br>
> Comm.c:(.text+0x42): undefined reference to `zctx_new'<br>
><br>
> This function is defined in libczmq.a (which is being linked in the Make<br>
> output)<br>
><br>
> $ nm /usr/local/lib/libczmq.a | grep zctx_new<br>
> 00000010 T zctx_new<br>
> U zctx_new<br>
> U zctx_new<br>
> U zctx_new<br>
> U zctx_new<br>
> U zctx_new<br>
> U zctx_new<br>
> U zctx_new<br>
><br>
><br>
> The other failure is<br>
><br>
> Comm.c:(.text+0x5c): undefined reference to `zsocket_new'<br>
><br>
> This function is also defined in libczmq.a<br>
><br>
> $ nm /usr/local/lib/libczmq.a | grep zsocket_new<br>
> U zsocket_new<br>
> U zsocket_new<br>
> U zsocket_new<br>
> 00000000 T zsocket_new<br>
> U zsocket_new<br>
> U zsocket_new<br>
> U zsocket_new<br>
><br>
> What am I missing here?<br>
<br>
</div></div>When linking with static libraries the order is comportant for gcc compiler.<br>
Not sure if this is also valid for MAC OS X, but you should check this.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Bogdan<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div><a href="http://daisyworks.com" target="_blank">http://daisyworks.com</a></div><br>