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&#39;m not sure why different flags are set here on the MacOS build vs. the Linux build.  On Mac OS I&#39;m using clang compiler.  On Linux, Gnu<br>
<br>The relevant sections:<br><br>Linux =&gt;  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&#39;:</div><div class="line" id="LC16">
Comm.c:(.text+0x42): undefined reference to `zctx_new&#39;<br><br>Mac =&gt;<br><br><pre><div class="line" id="LC38">cd /Users/davis/git/firmware/build/src &amp;&amp; /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">&lt;<a href="mailto:cristeab@gmail.com" target="_blank">cristeab@gmail.com</a>&gt;</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>
&gt; Hi, I have a project that I&#39;m able to build fine on Mac OS with CMake, but<br>
&gt; when I check same project out on Ubuntu 12.04, I&#39;m getting undefined<br>
&gt; reference errors at link time.<br>
&gt;<br>
&gt; Here&#39;s the relevant section of the CMakeLists.txt file, and make VERBOSE=1<br>
&gt; output for both Mac OS X (success) and Ubuntu 12.04 (failure)<br>
&gt;<br>
&gt; <a href="https://gist.github.com/3776497" target="_blank">https://gist.github.com/3776497</a><br>
&gt;<br>
&gt; The specific failure is<br>
&gt;<br>
&gt; In function `Comm_Create&#39;:<br>
&gt; Comm.c:(.text+0x42): undefined reference to `zctx_new&#39;<br>
&gt;<br>
&gt; This function is defined in libczmq.a (which is being linked in the Make<br>
&gt; output)<br>
&gt;<br>
&gt; $ nm /usr/local/lib/libczmq.a  | grep zctx_new<br>
&gt; 00000010 T zctx_new<br>
&gt;          U zctx_new<br>
&gt;          U zctx_new<br>
&gt;          U zctx_new<br>
&gt;          U zctx_new<br>
&gt;          U zctx_new<br>
&gt;          U zctx_new<br>
&gt;          U zctx_new<br>
&gt;<br>
&gt;<br>
&gt; The other failure is<br>
&gt;<br>
&gt; Comm.c:(.text+0x5c): undefined reference to `zsocket_new&#39;<br>
&gt;<br>
&gt; This function is also defined in libczmq.a<br>
&gt;<br>
&gt; $ nm /usr/local/lib/libczmq.a  | grep zsocket_new<br>
&gt;          U zsocket_new<br>
&gt;          U zsocket_new<br>
&gt;          U zsocket_new<br>
&gt; 00000000 T zsocket_new<br>
&gt;          U zsocket_new<br>
&gt;          U zsocket_new<br>
&gt;          U zsocket_new<br>
&gt;<br>
&gt; 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>