Conversation
I'm trying to create a recipe for building the tarsnap client with
Yocto, in both native and target variants.
One problem I've hit for the native variant is that Yocto tries very
hard to rely on host tools as little as possible, and builds as many
native tools and libraries as possible, in order to have a
reproducible build environment.
So Yocto does rely on the build host providing a working C compiler,
but something like openssl is built using that, and then any other
native tools that need openssl will be linked against that specific
version. To that end, Yocto ensures that all recipes have a value of
LDFLAGS set appropriately, e.g.
export LDFLAGS="-L[...]/x86_64-linux/tarsnap-native/1.0.41/recipe-sysroot-native/usr/lib [...]"
However, this is not taken into account in the api support detection
logic. So the first attempt to build
apisupport-LIBCRYPTO-LOW_LEVEL_AES.c fails as expected due to the
deprecation
error: ‘AES_set_encrypt_key’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
11 | AES_set_encrypt_key(key_unexpanded, 128, &kexp_actual);
| ^~~~~~~~~~~~~~~~~~~
In file included from ../sources/tarsnap-autoconf-1.0.41/libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c:3:
[...]/x86_64-linux/tarsnap-native/1.0.41/recipe-sysroot-native/usr/include/openssl/aes.h:50:5: note: declared here
50 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
But the second attempt including the -Wno... compiler flag also fails:
[...]/hosttools/ld: cannot find -lcrypto: No such file or directory
collect2: error: ld returned 1 exit status
Fix that by taking the user provided LDFLAGS into account.
|
Interesting! In libcperciva and kivaloo (which uses pure POSIX But scrypt and tarsnap (which use autotools) try to set I'm trying to work out what's happening. But at first glance I agree that it makes sense to add |
|
Yes, I did notice that LDADD_EXTRA, but I'd prefer to not have to define some non-standard variable if possible. FWIW my current recipe is The extra SRC_URI .patch is this PR, and the extra line in do_compile is explained by the comment and was mostly because I had occasion to even look at the do_compile log file. Other than that it should be fairly standard and minimal. |
I'm trying to create a recipe for building the tarsnap client with Yocto, in both native and target variants.
One problem I've hit for the native variant is that Yocto tries very hard to rely on host tools as little as possible, and builds as many native tools and libraries as possible, in order to have a reproducible build environment.
So Yocto does rely on the build host providing a working C compiler, but something like openssl is built using that, and then any other native tools that need openssl will be linked against that specific version. To that end, Yocto ensures that all recipes have a value of LDFLAGS set appropriately, e.g.
export LDFLAGS="-L[...]/x86_64-linux/tarsnap-native/1.0.41/recipe-sysroot-native/usr/lib [...]"
However, this is not taken into account in the api support detection logic. So the first attempt to build
apisupport-LIBCRYPTO-LOW_LEVEL_AES.c fails as expected due to the deprecation
error: ‘AES_set_encrypt_key’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
11 | AES_set_encrypt_key(key_unexpanded, 128, &kexp_actual);
| ^~~~~~~~~~~~~~~~~~~
In file included from ../sources/tarsnap-autoconf-1.0.41/libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c:3:
[...]/x86_64-linux/tarsnap-native/1.0.41/recipe-sysroot-native/usr/include/openssl/aes.h:50:5: note: declared here
50 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
But the second attempt including the -Wno... compiler flag also fails:
[...]/hosttools/ld: cannot find -lcrypto: No such file or directory
collect2: error: ld returned 1 exit status
Fix that by taking the user provided LDFLAGS into account.