title: Why are loads of symbols missing from OpenSSL libs, such as BIO_ctrl?
body: <p>I'm mystified by why a large subset of symbols is apparently missing from OpenSSL libs I built on Mac.</p>
  <p>In a CMake-based project, I'm compiling a lib (Restbed) that links statically with OpenSSL (both libssl and libcrypto). The Restbed lib appears to build fine, but if I try to link an application with it, it fails with lots of errors like:</p>
  <pre><code>Undefined symbols for architecture arm64:
  &quot;_BIO_ctrl&quot;, referenced from:
         asio::ssl::detail::engine::map_error_code(std::__1::error_code&amp;) const
  in librestbed.a(service_impl.cpp.o)
         asio::ssl::detail::engine::map_error_code(std::__1::error_code&amp;) const
  in librestbed.a(socket_impl.cpp.o)
  &quot;_BIO_ctrl_pending&quot;, referenced from:
         asio::ssl::detail::engine::perform(int (asio::ssl::detail::engine::*)(void*, unsigned long), void*, unsigned long, std::__1::error_code&amp;, unsigned long*) in
  librestbed.a(service_impl.cpp.o)
  </code></pre>
  <p>The architecture isn't the problem; everything is built on M1 Mac.</p>
  <p>To sum up, step 1 was build the static Restbed lib:</p>
  <pre><code>  librestbed.a
      libssl.a
      libcrypto.a
  </code></pre>
  <p>All the output from that is <a href="https://pastebin.com/kZW6ALFu" rel="nofollow noreferrer">here</a>.</p>
  <p>Then I tried to compile an app, linking statically with Restbed:</p>
  <pre><code>app
    librestbed.a
  </code></pre>
  <p>Here's the build command for the app, which triggers the errors:</p>
  <pre><code>/usr/bin/clang++ -g -arch arm64 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/Series2Server.dir/main.cpp.o -o Series2Server -L/Users/me/data/series2server/restbed/library  -Wl,-rpath,/Users/me/data/series2server/restbed/library -lrestbed -pthread
  </code></pre>
  <p>libssl and libcrypto are built from source using the configure tool provided in the OpenSSL source tree.</p>
  <p>So I examined both libssl and libcrypto with <strong>nm -u</strong>, to see if the complained-about symbols were in there. Well, they aren't. Such symbols as BIO_ctrl are listed as undefined in both libssl and libcrypto.</p>
  <p>I don't know what this means. How are symbols known about by <strong>nm</strong>, and yet &quot;undefined&quot; in the file under inspection? More importantly, how do I fix this problem so the application will build?</p>