Conversation
e2e43cc to
22b6270
Compare
cf4c5fe to
5e28bb4
Compare
| --buildtype="${BUILDTYPE}" \ | ||
| -Dc_args="${c_args}" \ | ||
| --wrap-mode=forcefallback \ | ||
| "${BUILDDIR}" |
There was a problem hiding this comment.
The indention in this function is a bit off.
But the bigger problem is that the forcefallback is pulling in the OpenSSL library and this one seems not to build:
[02](https://github.com/linux-nvme/nvme-cli/actions/runs/22464133376/job/65109623794?pr=3114#step:5:1403)
c++ -o libnvme/test/test-cpp libnvme/test/test-cpp.p/cpp.cc.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 '-Wl,-rpath,$ORIGIN/../src:$ORIGIN/../../subprojects/json-c-0.18:$ORIGIN/../../subprojects/openssl-3.0.8' -Wl,-rpath-link,/__w/nvme-cli/nvme-cli/.build-ci/libnvme/src -Wl,-rpath-link,/__w/nvme-cli/nvme-cli/.build-ci/subprojects/json-c-0.18 -Wl,-rpath-link,/__w/nvme-cli/nvme-cli/.build-ci/subprojects/openssl-3.0.8 -Wl,--start-group ccan/libccan.a libnvme/src/libnvme.so.3.0.0 -Wl,--end-group
/usr/bin/ld: warning: libc.so, needed by libnvme/src/libnvme.so.3.0.0, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /__w/nvme-cli/nvme-cli/.build-ci/subprojects/openssl-3.0.8/libcrypto.so: undefined reference to `atexit'Maybe it would be better to setup a minimal build?
There was a problem hiding this comment.
So the reason why I included that --wrap-mode=forcefallback is that the binary produced with musl-gcc was unusable due to allegedly missing dynamic libraries:
Error loading shared library libjson-c.so.5: No such file or directory (needed by /nvme-cli/.build-ci/libnvme/src/libnvme-test.so)
Error loading shared library libkeyutils.so.1: No such file or directory (needed by /nvme-cli/.build-ci/libnvme/src/libnvme-test.so)
Error loading shared library libcrypto.so.3: No such file or directory (needed by /nvme-cli/.build-ci/libnvme/src/libnvme-test.so)
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_array_get_idx: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_get_boolean: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: OSSL_LIB_CTX_new: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_get_int: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: keyctl_describe_alloc: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_PKEY_derive_init: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_object_add: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_new_boolean: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: keyctl_revoke: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_sha256: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_new_object: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_tokener_parse_ex: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_put: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_tokener_free: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_MAC_init: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_is_type: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_get_string: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_new_string: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: keyctl_search: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_MAC_fetch: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_util_get_last_err: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_new_array: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: json_object_to_fd: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: OSSL_PARAM_construct_end: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_MAC_CTX_free: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: OSSL_LIB_CTX_free: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_MAC_CTX_new: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: keyctl_link: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: recursive_key_scan: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_PKEY_CTX_add1_hkdf_info: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: find_key_by_type_and_desc: symbol not found
Error relocating /nvme-cli/.build-ci/libnvme/src/libnvme-test.so: EVP_PKEY_CTX_new_id: symbol not found
Note that I compiled this in the linux-nvme/debian:latest container.
Running ldd /nvme-cli/.build-ci/nvme gave this output:
/nvme-cli/.build-ci/nvme: error while loading shared libraries: /lib/x86_64-linux-gnu/libc.so: invalid ELF header
When compiling on Alpine Linux, some tests fail as well, but for a different reason.
ldd .build-ci/nvme
/lib/ld-musl-x86_64.so.1 (0x7f82458bc000)
libnvme.so.3 => .build-ci/libnvme/src/libnvme.so.3 (0x7f8245725000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f82458bc000)
Any idea what the issue could be?
There was a problem hiding this comment.
libnvme only has optional dependencies on json-c, openssl and libkey (or what ever the name is).
Ah, I think I understand the problem here. meson will detect those library in the build system but the linker can't use them. The configure step should explicitly disable them:
-Djson-c=disabled \
-Dopenssl=disabled \
-Dkeyutils=disabled \ /nvme-cli/.build-ci/nvme: error while loading shared libraries: /lib/x86_64-linux-gnu/libc.so looks like the wrong linker was used.
| char *nvme_basename(const char *path) | ||
| { | ||
| char *p = strrchr (path, '/'); | ||
| return p ? p + 1 : (char *) path; |
There was a problem hiding this comment.
compiler complains with
clang -Ilibnvme/src/libnvme.so.3.0.0.p -Ilibnvme/src -I../libnvme/src -I. -I.. -Iccan -I../ccan -Ilibnvme/src/nvme -I../libnvme/src/nvme -I/usr/include/json-c -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=gnu99 -O0 -g -fomit-frame-pointer -D_GNU_SOURCE -include /__w/nvme-cli/nvme-cli/.build-ci/nvme-config.h -DCCAN_LIST_DEBUG=1 -DCCAN_STR_DEBUG=1 -fPIC -MD -MQ libnvme/src/libnvme.so.3.0.0.p/nvme_util.c.o -MF libnvme/src/libnvme.so.3.0.0.p/nvme_util.c.o.d -o libnvme/src/libnvme.so.3.0.0.p/nvme_util.c.o -c ../libnvme/src/nvme/util.c
../libnvme/src/nvme/util.c:1188:8: error: initializing 'char *' with an expression of type 'typeof ((path) + 0)' (aka 'const char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
1188 | char *p = strrchr (path, '/');
| ^ ~~~~~~~~~~~~~~~~~~~5e28bb4 to
2a1b960
Compare
libgen.h must be included to silence a compiler error regarding the basename() function missing when building with musl libc. The basename() function call in libnvme/src/nvme/linux.c:__nvme_transport_handle_open_direct() causes a (fatal) compilation warning due to GNU using this declaration of basename: char *basename (const char *filename) and POSIX (and also musl) omitting const. It is thus possible that the const char *devname would be modified by basename(). The solution to the problem above is to use the internal implementation of basename from glibc directly and avoid these API compatibility problems. Signed-off-by: Michal Rábek <mrabek@redhat.com>
Signed-off-by: Michal Rábek <mrabek@redhat.com>
Builds with musl libc get broken too often. This patch suggests a new GitHub CI build job to help maintain them being functional. Closes: linux-nvme#2565 Link: linux-nvme#2565 Signed-off-by: Michal Rábek <mrabek@redhat.com>
The 'nvme-cli - uint128' test was failing when build with musl libc. The reason was that musl libc leaves the thousands separator from LC_NUMERIC empty with the fr_FR.utf-8. This patch offers a solution by skipping the test with a warning if the thousands separator cannot be obtained. Signed-off-by: Michal Rábek <mrabek@redhat.com>
2a1b960 to
4ab15fe
Compare
This series of patches contributes to solving the recurring problem with build fails with
musllibc. It includes proposed build configuration and a new CI build job.Things to check before removing draft status:
muslbuild?