static build: multiple definition of 'nettle_ecc_scalar_random'
When building a static library of GnuTLS 3.6.14 for Android (with Nettle 3.5.1), nettle_ecc_scalar_random
is included in the resulting static library:
nm -C x86_64-linux-android/lib/libgnutls.a | grep nettle_ecc_scalar_random
00000000000001f0 T nettle_ecc_scalar_random
However this symbol is really part of libhogweed
(Nettle):
nm -C x86_64-linux-android/lib/libhogweed.a | grep nettle_ecc_scalar_random
00000000000001f0 T nettle_ecc_scalar_random
So when building a library with -lgnutls -lhogweed -lnettle
:
ld: error: x86_64-linux-android/lib/libhogweed.a(ecc-random.o): multiple definition of 'nettle_ecc_scalar_random'
ld: x86_64-linux-android/lib/libgnutls.a(ecc-random.o): previous definition here
clang90++: error: linker command failed with exit code 1 (use -v to see invocation)
Or if trying to build without libhogweed (just -lgnutls -lnettle
), the linker fails at runtime:
dlopen failed: cannot locate symbol "nettle_rsa_pss_sha256_sign_digest_tr" referenced by "/data/app/blah.so"...
Expected behavior:
No definition from libhogweed or nettle should be included in the static library
Edited by Adrien Béraud