Closed joerg-krause closed 7 years ago
Thanks for reporting us this issue. I fixed it slightly differently than your proposal. Cheers
I've tested this commit. The Libs.private
is now:
Libs.private: /mnt/data/git/buildroot/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib32/libmbedtls.a /mnt/data/git/buildroot/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib32/libmbedx509.a /mnt/data/git/buildroot/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib32/libmbedcrypto.a
Which is not how the link flags for the libraries should be, but it should be this way:
Libs.private: -L/mnt/data/git/buildroot/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib32 -lmbedtls -lmbedx509 -lmbedcrypto
@jehandelalune Friendly ping...
Hi Joerg,
In the case you mentioned, private libraries are exported from mbedtls which is compiled statically. I'm not a pkg-config expert, but what is wrong in putting paths to static libs in a .pc file ?
You do not pass the paths to the needed libraries, but the needed libraries as linker flags to Libs.private
. Please have look at an example .pc file from the pkg-config package.
Furthermore, having a look at how pkg-config parses the Libs.private
field, shows that it looks for -L
and -l
chunks (without any suffix on Unix systems).
Static linking with bctoolbox fails when using pkg-config as the generated bctoolbox.pc file only consists of an '-L' string without any search path or libraries flags.
That's because of an typo in
mbedtls_library_path
. However,mbedtls_library_path
contains a string of the mbedtls libraries concatenated by an ';' which cannot be parsed by pkg-config.Therefore, use
MBEDTLS_LIBRARY
instead ofMBEDTLS_LIBRARIES
to get the library path.Furthermore, add the three mbedtls libraries mbedtls, mbedcrypto, and mbedx509 to
LIBS_PRIVATE
so these libraries are added to theLibs.private
field of bctoolbox.pc.