Undefined reference errors when linking libzip with GnuTLS/Nettle on Linux #515
Unanswered
Vicky8472
asked this question in
Using libzip
Replies: 1 comment
-
|
hi, when using static libraries, the dependencies of those libraries are not automatically pulled in by the linker (that's not specific to libzip). So you will have to link them explicitly. As described in yours, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I’m integrating libzip into my project on Linux and I’m encountering several undefined reference linker errors related to GnuTLS and Nettle, even though libzip builds successfully.
Here is a sample of the errors:
/usr/bin/ld: libzip.a(zip_crypto_gnutls.c.o): in function
_zip_crypto_aes_new': undefined reference tonettle_aes128_set_encrypt_key'undefined reference to
nettle_aes192_set_encrypt_key' undefined reference tonettle_aes256_set_encrypt_key'/usr/bin/ld: libzip.a(zip_crypto_gnutls.c.o): in function
_zip_crypto_hmac_new': undefined reference tognutls_hmac_init'...
undefined reference to `nettle_pbkdf2_hmac_sha1'
I built libzip using CMake inside my project:
libzip build folder: thirdparty/libzip/build
Linking against static libzip.a
It looks like libzip’s crypto backend is automatically using GnuTLS + Nettle, but during final linking these dependencies are not automatically added.
Questions:
What is the recommended way to correctly link the required GnuTLS/Nettle libraries when using a static libzip.a?
Is there a CMake option to disable GnuTLS and crypto support entirely (I only need basic ZIP read/write)?
Or, should I explicitly link these libraries?
gnutls
nettle
hogweed
System:
Linux (Ubuntu-based)
GCC
Building a static binary
Any guidance on the correct link flags or configuration would be very helpful.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions