<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>This is a known deficiency of how Apple rushed adding support for
      their M1 ARM Desktop CPU to the XCode build suite.</p>
    <p>When building a desktop macOs program file with XCode, it will
      implicitly try to build both an x86_64 and an arm64 variant, and
      will get very surprised your compiled open source library files
      contain only code for one of those architectures.</p>
    <p>A potential workaround is to build OpenSSL for all 3 macOs
      desktop architectures and combine them with the "lipo" tool to
      create a "fat library".  The major shortcoming of this is that
      they use the same architecture "key" value for macOs and iOs, but
      require the libraries to be compiled differently (because the ABI
      for some system functions differ).  Before the M1 merge, this
      would work thanks to arm64 always being iOS hardware and x86_64
      always being macOs hardware.  A workaround for that is to create a
      separate set of library files for iOS (including iOS emulator on
      x86-family desktops) and macOs (including x86-family and arm64
      architectures), then being careful to reference the right set for
      each project.  Unfortunately, there is no workaround to use the
      same set of library files for iOS on arm64 mobile hardware and iOS
      emulator on arm64 desktop hardware.<br>
    </p>
    On 2021-08-18 07:40, Stephen Dominic Liang wrote:<br>
    <blockquote type="cite"
cite="mid:CALV0fOdWuQE=+Dqz=AbQtLWDkp-5r3ddUbpav-n9OLA+KPinRA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">Hi. <span
style="color:rgb(36,39,41);font-family:-apple-system,system-ui,"Segoe
          UI","Liberation
          Sans",sans-serif;font-size:15px">I installed OpenSSL 1.1
          (MacOS 11.3.1) using Homebrew. I added the following to my
          .bash_profile:</span>
        <p
style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:-apple-system,system-ui,"Segoe
          UI","Liberation
Sans",sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">export
          PKG_CONFIG_PATH=<a class="moz-txt-link-rfc2396E" href="mailto:/opt/homebrew/opt/openssl@1.1/lib/pkgconfig">"/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"</a></p>
        <p
style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:-apple-system,system-ui,"Segoe
          UI","Liberation
Sans",sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">I
          added this to the global path file at /etc/paths:</p>
        <p
style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:-apple-system,system-ui,"Segoe
          UI","Liberation
Sans",sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">/opt/homebrew/opt/openssl@1.1/bin</p>
        <p
style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:-apple-system,system-ui,"Segoe
          UI","Liberation
Sans",sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">I've
          tried a number of other steps. What are some other
          fixes/suggestions for debugging this issue? </p>
        <p
style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:-apple-system,system-ui,"Segoe
          UI","Liberation
Sans",sans-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both;color:rgb(36,39,41)">Errors:</p>
        <pre class="gmail-lang-c gmail-s-code-block" style="margin-top:0px;margin-bottom:0px;padding:12px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:1.30769;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:5px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit">/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/stephenjje/Documents/Je/test/cmake-build-debug --target test -- -j 6
[  2%] Linking C executable test
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1k/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1k/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_ERR_print_errors_fp", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
      _http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_OPENSSL_init_crypto", referenced from:
      _http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
  "_OPENSSL_init_ssl", referenced from:
      _http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
  "_SSL_CIPHER_get_name", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
  "_SSL_CTX_free", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
  "_SSL_CTX_new", referenced from:
      _http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_SSL_CTX_use_PrivateKey_file", referenced from:
      _http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
  "_SSL_CTX_use_certificate_file", referenced from:
      _http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
  "_SSL_accept", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
  "_SSL_connect", referenced from:
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_SSL_ctrl", referenced from:
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_SSL_free", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
  "_SSL_get_current_cipher", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
  "_SSL_get_peer_certificate", referenced from:
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_SSL_new", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_SSL_read", referenced from:
      _http_tcpip_inbound_parse_request in http_tcpip_inbound.c.o
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_SSL_set_fd", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_SSL_shutdown", referenced from:
      _http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
  "_SSL_write", referenced from:
      _http_tcpip_inbound_send_response in http_tcpip_inbound.c.o
      _http_tcpip_outbound_request_send_type_tls in http_tcpip_outbound.c.o
  "_TLS_client_method", referenced from:
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
  "_TLS_server_method", referenced from:
      _http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
  "_X509_free", referenced from:
      _http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [CMakeFiles/test.dir/build.make:680: test] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:83: CMakeFiles/test.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/test.dir/rule] Error 2</code></pre>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  <a class="moz-txt-link-freetext" href="https://www.wisemo.com">https://www.wisemo.com</a>
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded</pre>
  </body>
</html>