libtor-sys icon indicating copy to clipboard operation
libtor-sys copied to clipboard

macos Undefined symbols for architecture x86_64 after bump to 46.9.1

Open delta1 opened this issue 3 years ago • 7 comments

Hi @afilini - experiencing this compilation issue on macos after libtor-sys was bumped - any ideas?

note: Undefined symbols for architecture x86_64:
            "_EVP_PKEY_get_base_id", referenced from:
                _tor_tls_cert_is_valid in libtor_sys-4d079d3be7ca8339.rlib(libtor_tls_a-x509_openssl.o)
            "_EVP_PKEY_get_bits", referenced from:
                _tor_tls_cert_is_valid in libtor_sys-4d079d3be7ca8339.rlib(libtor_tls_a-x509_openssl.o)
            "_EVP_PKEY_CTX_set1_hkdf_key", referenced from:
                _crypto_expand_key_material_rfc5869_sha256_openssl in libtor_sys-4d079d3be7ca8339.rlib(libtor_crypt_ops_a-crypto_hkdf.o)
            "_EVP_PKEY_CTX_set1_hkdf_salt", referenced from:
                _crypto_expand_key_material_rfc5869_sha256_openssl in libtor_sys-4d079d3be7ca8339.rlib(libtor_crypt_ops_a-crypto_hkdf.o)
            "_EVP_PKEY_CTX_add1_hkdf_info", referenced from:
                _crypto_expand_key_material_rfc5869_sha256_openssl in libtor_sys-4d079d3be7ca8339.rlib(libtor_crypt_ops_a-crypto_hkdf.o)
            "_EVP_PKEY_CTX_set_hkdf_md", referenced from:
                _crypto_expand_key_material_rfc5869_sha256_openssl in libtor_sys-4d079d3be7ca8339.rlib(libtor_crypt_ops_a-crypto_hkdf.o)
            "_SSL_get1_peer_certificate", referenced from:
                _tor_tls_get_peer_cert in libtor_sys-4d079d3be7ca8339.rlib(libtor_tls_a-tortls_openssl.o)
                _tor_tls_peer_has_cert in libtor_sys-4d079d3be7ca8339.rlib(libtor_tls_a-tortls_openssl.o)
                _try_to_extract_certs_from_tls in libtor_sys-4d079d3be7ca8339.rlib(libtor_tls_a-tortls_openssl.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

delta1 avatar Jan 19 '22 12:01 delta1

actually seems to happen on 46.9.0 now too 🤷

delta1 avatar Jan 19 '22 13:01 delta1

Try enabling the vendored-openssl feature which will compile and link to a static version of openssl

afilini avatar Jan 20 '22 09:01 afilini

Thanks I will try that, but don't want to have to include openssl if it's not strictly necessary.

delta1 avatar Jan 20 '22 10:01 delta1

I've always had issues linking with openssl on macos because there are many different "packages" (one from Apple and then my others from Homebrew, Mac Ports, etc) providing it and if you ship a dinamically linked binary your users might have different versions.

If you can provide more tails on your environment I'll try to reproduce the issue, but for the time being I would recomment to just use the vendored one

afilini avatar Jan 20 '22 14:01 afilini

I appreciate that and hear where you’re coming from! What environment info do you need? I tried with both [email protected] and openssl@3 from brew - a colleague also had the same issue.

delta1 avatar Jan 20 '22 15:01 delta1

Openssl version and where it's coming from are a good start. What version of macos are you using?

Thanks

afilini avatar Jan 21 '22 08:01 afilini

Sure, thanks @afilini. I think it only started on 46.9.1 I will have to try again with 46.9.0 and will let you know

Tried with both of these OpenSSL versions installed with brew:

[email protected]

❯ brew info openssl
openssl@3: stable 3.0.1 (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@3/3.0.1 (6,420 files, 28.1MB)
  Poured from bottle on 2022-01-19 at 09:59:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]

and

[email protected]

❯ brew info [email protected]
[email protected]: stable 1.1.1m (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/[email protected]/1.1.1m (8,081 files, 18.5MB)
  Poured from bottle on 2022-01-15 at 13:35:11
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]

macOS Monterey 12.1

image

delta1 avatar Jan 24 '22 07:01 delta1