title: Can't link static library on Mac OS X
body: <p>I can't link static libraries to executable file on Mac OS X.
  I have in my repo directory <code>lib</code> witch contains all of libraries such as <code>libstdc++.a</code>, <code>libssl.a</code>, <code>libz.a</code>.<br><br>
  CMakeList.txt contains:</p>
  
  <pre><code>(...)
  set(PROJECT_LINK_LIBS libcurl.a libz.a libssl.a libcrypto.a libstdc++.a libjson-c.a)
  link_directories(lib/)
  add_executable(myapp ${SOURCES})
  target_link_libraries(myapp ${PROJECT_LINK_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
  </code></pre>
  
  <p>While compiling I got a messages (for each <code>.a</code> file):</p>
  
  <pre><code>ld: warning: ignoring file /Users/kuba/CLionProjects/RigService/lib/macos/libz.a, file was built for archive which is not the architecture being linked (x86_64)
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
      "_curl_easy_cleanup", referenced from:
          HTTPConnection::request(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, char const*) in HTTPConnection.cpp.o
      "_curl_easy_init", referenced from:
          HTTPConnection::request(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, char const*) in HTTPConnection.cpp.o
      "_curl_easy_perform", referenced from:
          HTTPConnection::request(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt;, char const*) in HTTPConnection.cpp.o
  (...)
  </code></pre>
  
  <p>I have compilate this on a linux before, and there I didn't have any problem.<bR>
  I was tring to extract all <code>.o</code> files from <code>.a</code> and again build a archive file using</p>
  
  <pre><code>ar rcs libcurl.a *.o
  </code></pre>
  
  <p>but after it I got the same problem.<br>
  I was also trying to build a archive via</p>
  
  <pre><code>libtool -static -o libcurl.a *.o
  </code></pre>
  
  <p>but then I got a message:</p>
  
  <pre><code>sal:libcrypto kuba$ libtool -static -o libcrypto.a *.o
  error: /Library/Developer/CommandLineTools/usr/bin/libtool: file: a_bitstr.o is not an object file (not allowed in a library)
  error: /Library/Developer/CommandLineTools/usr/bin/libtool: file: a_bool.o is not an object file (not allowed in a library)
  error: /Library/Developer/CommandLineTools/usr/bin/libtool: file: a_bytes.o is not an object file (not allowed in a library)
  (...) // error for each .o file
  </code></pre>
  
  <p>And here is my question, maybe should I start from it, <strong>can I link the same <code>.a</code> files while compilating on linux and mac os?</strong></p>