Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Upgrade Cryptsetup 2.3 (fixes #669) #749

Closed
wants to merge 7 commits into from

Conversation

alex-nitrokey
Copy link
Contributor

@alex-nitrokey alex-nitrokey commented Jun 11, 2020

I tried around a bit to get cryptsetup 2.3 working. Unfortunately, I just can't find a solution to properly link libuuid with the library. I hope somebody here knows better than me...

(see CI build for output)

/bin/bash ./libtool  --tag=CC   --mode=link /root/project/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/root/project=heads -gno-record-gcc-switches -D__MUSL__ -I/root/project/install/include -L/root/project/install/lib  -Wall  -g -O2   -o libcrypto_backend.la  lib/crypto_backend/libcrypto_backend_la-crypto_cipher_kernel.lo lib/crypto_backend/libcrypto_backend_la-crypto_storage.lo lib/crypto_backend/libcrypto_backend_la-pbkdf_check.lo lib/crypto_backend/libcrypto_backend_la-crc32.lo lib/crypto_backend/libcrypto_backend_la-argon2_generic.lo lib/crypto_backend/libcrypto_backend_la-cipher_generic.lo lib/crypto_backend/libcrypto_backend_la-cipher_check.lo    lib/crypto_backend/libcrypto_backend_la-crypto_kernel.lo  lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo libargon2.la 
libtool: link: (cd .libs/libcrypto_backend.lax/libargon2.a && /root/project/crossgcc/bin/x86_64-linux-musl-ar x "/root/project/build/cryptsetup-2.3.3/./.libs/libargon2.a")
libtool: link: /root/project/crossgcc/bin/x86_64-linux-musl-ar cr .libs/libcrypto_backend.a lib/crypto_backend/.libs/libcrypto_backend_la-crypto_cipher_kernel.o lib/crypto_backend/.libs/libcrypto_backend_la-crypto_storage.o lib/crypto_backend/.libs/libcrypto_backend_la-pbkdf_check.o lib/crypto_backend/.libs/libcrypto_backend_la-crc32.o lib/crypto_backend/.libs/libcrypto_backend_la-argon2_generic.o lib/crypto_backend/.libs/libcrypto_backend_la-cipher_generic.o lib/crypto_backend/.libs/libcrypto_backend_la-cipher_check.o lib/crypto_backend/.libs/libcrypto_backend_la-crypto_kernel.o lib/crypto_backend/.libs/libcrypto_backend_la-pbkdf2_generic.o   .libs/libcrypto_backend.lax/libargon2.a/libargon2_la-argon2.o .libs/libcrypto_backend.lax/libargon2.a/libargon2_la-blake2b.o .libs/libcrypto_backend.lax/libargon2.a/libargon2_la-core.o .libs/libcrypto_backend.lax/libargon2.a/libargon2_la-encoding.o .libs/libcrypto_backend.lax/libargon2.a/libargon2_la-ref.o .libs/libcrypto_backend.lax/libargon2.a/libargon2_la-thread.o 
libtool: link: ranlib .libs/libcrypto_backend.a
libtool: link: rm -fr .libs/libcrypto_backend.lax
libtool: link: ( cd ".libs" && rm -f "libcrypto_backend.la" && ln -s "../libcrypto_backend.la" "libcrypto_backend.la" )
/bin/bash ./libtool  --tag=CC   --mode=link /root/project/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/root/project=heads -gno-record-gcc-switches -D__MUSL__ -I/root/project/install/include -L/root/project/install/lib  -Wall  -g -O2  -no-undefined -Wl,--version-script=./lib/libcryptsetup.sym -version-info 18:0:6  -o libcryptsetup.la -rpath //lib lib/libcryptsetup_la-setup.lo lib/libcryptsetup_la-utils.lo lib/libcryptsetup_la-utils_benchmark.lo lib/libcryptsetup_la-utils_crypt.lo lib/libcryptsetup_la-utils_loop.lo lib/libcryptsetup_la-utils_devpath.lo lib/libcryptsetup_la-utils_wipe.lo lib/libcryptsetup_la-utils_fips.lo lib/libcryptsetup_la-utils_device.lo lib/libcryptsetup_la-utils_keyring.lo lib/libcryptsetup_la-utils_device_locking.lo lib/libcryptsetup_la-utils_pbkdf.lo lib/libcryptsetup_la-utils_safe_memory.lo lib/libcryptsetup_la-utils_storage_wrappers.lo lib/libcryptsetup_la-libdevmapper.lo lib/libcryptsetup_la-volumekey.lo lib/libcryptsetup_la-random.lo lib/libcryptsetup_la-crypt_plain.lo lib/libcryptsetup_la-base64.lo lib/integrity/libcryptsetup_la-integrity.lo lib/loopaes/libcryptsetup_la-loopaes.lo lib/tcrypt/libcryptsetup_la-tcrypt.lo lib/luks1/libcryptsetup_la-af.lo lib/luks1/libcryptsetup_la-keyencryption.lo lib/luks1/libcryptsetup_la-keymanage.lo lib/verity/libcryptsetup_la-verity_hash.lo lib/verity/libcryptsetup_la-verity_fec.lo lib/verity/libcryptsetup_la-verity.lo lib/verity/libcryptsetup_la-rs_encode_char.lo lib/verity/libcryptsetup_la-rs_decode_char.lo lib/luks2/libcryptsetup_la-luks2_disk_metadata.lo lib/luks2/libcryptsetup_la-luks2_json_format.lo lib/luks2/libcryptsetup_la-luks2_json_metadata.lo lib/luks2/libcryptsetup_la-luks2_luks1_convert.lo lib/luks2/libcryptsetup_la-luks2_digest.lo lib/luks2/libcryptsetup_la-luks2_digest_pbkdf2.lo lib/luks2/libcryptsetup_la-luks2_keyslot.lo lib/luks2/libcryptsetup_la-luks2_keyslot_luks2.lo lib/luks2/libcryptsetup_la-luks2_keyslot_reenc.lo lib/luks2/libcryptsetup_la-luks2_reencrypt.lo lib/luks2/libcryptsetup_la-luks2_segment.lo lib/luks2/libcryptsetup_la-luks2_token_keyring.lo lib/luks2/libcryptsetup_la-luks2_token.lo lib/libcryptsetup_la-utils_blkid.lo lib/bitlk/libcryptsetup_la-bitlk.lo -luuid -ldevmapper -ldevmapper -L/root/project/install/root/project/install/lib -ljson-c -L/root/project/install//lib -lblkid  libcrypto_backend.la libutils_io.la 
libtool: warning: library '/root/project/install/lib/libuuid.la' was moved.
libtool: warning: library '/root/project/install/lib/libblkid.la' was moved.
libtool: link: /root/project/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/root/project=heads -gno-record-gcc-switches -D__MUSL__ -I/root/project/install/include -L/root/project/install/lib  -shared  -fPIC -DPIC  lib/.libs/libcryptsetup_la-setup.o lib/.libs/libcryptsetup_la-utils.o lib/.libs/libcryptsetup_la-utils_benchmark.o lib/.libs/libcryptsetup_la-utils_crypt.o lib/.libs/libcryptsetup_la-utils_loop.o lib/.libs/libcryptsetup_la-utils_devpath.o lib/.libs/libcryptsetup_la-utils_wipe.o lib/.libs/libcryptsetup_la-utils_fips.o lib/.libs/libcryptsetup_la-utils_device.o lib/.libs/libcryptsetup_la-utils_keyring.o lib/.libs/libcryptsetup_la-utils_device_locking.o lib/.libs/libcryptsetup_la-utils_pbkdf.o lib/.libs/libcryptsetup_la-utils_safe_memory.o lib/.libs/libcryptsetup_la-utils_storage_wrappers.o lib/.libs/libcryptsetup_la-libdevmapper.o lib/.libs/libcryptsetup_la-volumekey.o lib/.libs/libcryptsetup_la-random.o lib/.libs/libcryptsetup_la-crypt_plain.o lib/.libs/libcryptsetup_la-base64.o lib/integrity/.libs/libcryptsetup_la-integrity.o lib/loopaes/.libs/libcryptsetup_la-loopaes.o lib/tcrypt/.libs/libcryptsetup_la-tcrypt.o lib/luks1/.libs/libcryptsetup_la-af.o lib/luks1/.libs/libcryptsetup_la-keyencryption.o lib/luks1/.libs/libcryptsetup_la-keymanage.o lib/verity/.libs/libcryptsetup_la-verity_hash.o lib/verity/.libs/libcryptsetup_la-verity_fec.o lib/verity/.libs/libcryptsetup_la-verity.o lib/verity/.libs/libcryptsetup_la-rs_encode_char.o lib/verity/.libs/libcryptsetup_la-rs_decode_char.o lib/luks2/.libs/libcryptsetup_la-luks2_disk_metadata.o lib/luks2/.libs/libcryptsetup_la-luks2_json_format.o lib/luks2/.libs/libcryptsetup_la-luks2_json_metadata.o lib/luks2/.libs/libcryptsetup_la-luks2_luks1_convert.o lib/luks2/.libs/libcryptsetup_la-luks2_digest.o lib/luks2/.libs/libcryptsetup_la-luks2_digest_pbkdf2.o lib/luks2/.libs/libcryptsetup_la-luks2_keyslot.o lib/luks2/.libs/libcryptsetup_la-luks2_keyslot_luks2.o lib/luks2/.libs/libcryptsetup_la-luks2_keyslot_reenc.o lib/luks2/.libs/libcryptsetup_la-luks2_reencrypt.o lib/luks2/.libs/libcryptsetup_la-luks2_segment.o lib/luks2/.libs/libcryptsetup_la-luks2_token_keyring.o lib/luks2/.libs/libcryptsetup_la-luks2_token.o lib/.libs/libcryptsetup_la-utils_blkid.o lib/bitlk/.libs/libcryptsetup_la-bitlk.o  -Wl,--whole-archive ./.libs/libcrypto_backend.a ./.libs/libutils_io.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/root/project/install/lib -Wl,-rpath -Wl,/root/project/install/lib -L/root/project/install/lib /root/project/install/lib/libuuid.so -ldevmapper -L/root/project/install/root/project/install/lib -ljson-c -L/root/project/install//lib /root/project/install/lib/libblkid.so  -gno-record-gcc-switches -g -O2 -Wl,--version-script=./lib/libcryptsetup.sym   -pthread -Wl,-soname -Wl,libcryptsetup.so.12 -o .libs/libcryptsetup.so.12.6.0
libtool: link: (cd ".libs" && rm -f "libcryptsetup.so.12" && ln -s "libcryptsetup.so.12.6.0" "libcryptsetup.so.12")
libtool: link: (cd ".libs" && rm -f "libcryptsetup.so" && ln -s "libcryptsetup.so.12.6.0" "libcryptsetup.so")
/bin/sed: can't read //lib/libuuid.la: No such file or directory
libtool:   error: '//lib/libuuid.la' is not a valid libtool archive
make[3]: *** [Makefile:1518: libcryptsetup.la] Error 1
make[3]: Leaving directory '/root/project/build/cryptsetup-2.3.3'
make[2]: *** [Makefile:2318: all-recursive] Error 1
make[2]: Leaving directory '/root/project/build/cryptsetup-2.3.3'
make[1]: *** [Makefile:1138: all] Error 2
make[1]: Leaving directory '/root/project/build/cryptsetup-2.3.3'
make: *** [Makefile:382: /root/project/build/cryptsetup-2.3.3/.build] Error 1

Exited with code exit status 2

regarding the patch file:
rpath can be disabled directly nowadays, so I did not included this in the patchfile. Beside that I just looked at the old one, but I am not sure, if this is actually applicable anymore. So please have a closer look there.

Following commit ed3602f (maintain
reproducibility by removing rpath) and applying the same changes for new
version of cryptsetup.
* hardcode rpatch patch not needed as `--disable-rpath` is available
* remove obsolete config parameters
@alex-nitrokey alex-nitrokey force-pushed the cryptsetup-2.3 branch 2 times, most recently from d797630 to 5ce9f7e Compare June 16, 2020 09:20
* use --libdir to fix issue with .la files which had //lib as lib folder
* add libblkid as library
@tlaurion
Copy link
Collaborator

tlaurion commented Jun 28, 2020

@alex-nitrokey : I would suggest looking for external libraries, as an exemple: modules/libgpg-error and the dependency validation that is done from the module requiring it, for exemple modules/gpg2

In the current situation, the build library is under:

user@x230-master:~/heads$ ls build/json-c-0.14/build/libjson-c.so.*
build/json-c-0.14/build/libjson-c.so.5	build/json-c-0.14/build/libjson-c.so.5.0.0

under cryptsetup module, you have two cryptsetup_depends statements.
libjson gets built but cryptsetup cannot find the built library where it is expected to be found.

It seems like you made your exemple based on hidapi. I do not clearly understand why you put libjson under cryptsetup with non-functional dependencies.

@alex-nitrokey
Copy link
Contributor Author

It seems like you made your exemple based on hidapi.

That is correct, I thought it might be preferred. I changed it to a proper separate approach now. Yet, it still does not build. Maybe there was a problem with json-c before, but everything seems to be installed correctly regarding json-c for now. We still have a problem with libuuid and libblkid as far as I understand it. Both are part of modules/util-linux. I would have thought that something is wrong there, but I am a bit lost regarding this issue anyway :(

@tlaurion
Copy link
Collaborator

@alex-nitrokey :
This made it go a little farther


--- a/modules/cryptsetup
+++ b/modules/cryptsetup
@@ -14,6 +14,7 @@ cryptsetup_configure := ./configure \
 	$(CROSS_TOOLS) \
 	--host i386-elf-linux \
 	--prefix "/" \
+	--with-libgcrypt-prefix="$(INSTALL)" \
 	--disable-gcrypt-pbkdf2 \
 	--enable-cryptsetup-reencrypt \
 	--with-crypto_backend=kernel \
@@ -21,10 +22,11 @@ cryptsetup_configure := ./configure \
 # but after building, replace prefix so that they will be installed
 # in the correct directory.
 cryptsetup_target := \
-	$(MAKE) \
-	-C $(build)/$(cryptsetup_dir) \
-	prefix="$(INSTALL)" \
-	install
+	$(MAKE_JOBS) \
+	&& $(MAKE) \
+		-C $(build)/$(cryptsetup_dir) \
+		prefix="$(INSTALL)" \
+		install
 
 cryptsetup_output := \
 	src/.libs/cryptsetup \
@@ -53,6 +55,7 @@ json-c_configure := mkdir -p build && \
 
 json-c_target := \
 	$(CROSS_TOOLS) -C $(build)/$(json-c_dir)/build \
+	prefix="$(INSTALL)" \
 	all install
 
 json-c_libraries := build/.libs/libjson-c.so.5.0.0

I still don't get why cryptsetup can't find .h of json-c, but not surprised since Cmake is a pain:

2020-06-30 11:04:33-04:00 MAKE json-c
2020-06-30 11:04:33-04:00 DONE json-c
2020-06-30 11:04:33-04:00 MAKE cryptsetup
tail /home/user/heads/build/log/cryptsetup.log
-----
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3/tests'
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
  CC       src/utils_tools.o
src/utils_tools.c: In function ‘clogger’:
src/utils_tools.c:94:44: error: ‘CRYPT_LOG_DEBUG_JSON’ undeclared (first use in this function); did you mean ‘CRYPT_LOG_DEBUG’?
       level == CRYPT_LOG_DEBUG || level == CRYPT_LOG_DEBUG_JSON)
                                            ^~~~~~~~~~~~~~~~~~~~
                                            CRYPT_LOG_DEBUG
src/utils_tools.c:94:44: note: each undeclared identifier is reported only once for each function it appears in
src/utils_tools.c: In function ‘tool_log’:
src/utils_tools.c:117:7: error: ‘CRYPT_LOG_DEBUG_JSON’ undeclared (first use in this function); did you mean ‘CRYPT_LOG_DEBUG’?
  case CRYPT_LOG_DEBUG_JSON:
       ^~~~~~~~~~~~~~~~~~~~
       CRYPT_LOG_DEBUG
make[3]: *** [Makefile:1702: src/utils_tools.o] Error 1
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[2]: *** [Makefile:2318: all-recursive] Error 1
make[2]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[1]: *** [Makefile:1138: all] Error 2
make[1]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make: *** [Makefile:382: /home/user/heads/build/cryptsetup-2.3.3/.build] Error 1

@tlaurion
Copy link
Collaborator

user@x230-master:~/heads$ cat build/log/json-c.log 
make -C "/home/user/heads/build/json-c-0.14" CC=/home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  AR=/home/user/heads/crossgcc/bin/x86_64-linux-musl-ar LD=/home/user/heads/crossgcc/bin/x86_64-linux-musl-ld STRIP=/home/user/heads/crossgcc/bin/x86_64-linux-musl-strip NM=/home/user/heads/crossgcc/bin/x86_64-linux-musl-nm OBJCOPY=/home/user/heads/crossgcc/bin/x86_64-linux-musl-objcopy OBJDUMP=/home/user/heads/crossgcc/bin/x86_64-linux-musl-objdump PKG_CONFIG_PATH=/home/user/heads/install/lib/pkgconfig PKG_CONFIG_SYSROOT_DIR=/home/user/heads/install   -C /home/user/heads/build/json-c-0.14/build prefix=/home/user/heads/install all install
make[1]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[2]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 21%] Built target json-c
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 25%] Built target test_visit
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 28%] Built target test_util_file
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 31%] Built target test_set_value
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 34%] Built target test_parse_int64
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 37%] Built target test_parse
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 40%] Built target testReplaceExisting
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 43%] Built target test_printbuf
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 46%] Built target test_double_serializer
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 50%] Built target test4
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 54%] Built target test2Formatted
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 57%] Built target test_null
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 60%] Built target test2
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 65%] Built target test1Formatted
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 68%] Built target test_charcase
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 71%] Built target test_cast
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 75%] Built target test_object_iterator
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 78%] Built target test_set_serializer
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 81%] Built target test1
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 84%] Built target test_compare
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 87%] Built target test_deep_copy
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 90%] Built target test_float
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 93%] Built target test_int_add
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[ 96%] Built target test_json_pointer
make[3]: Entering directory '/home/user/heads/build/json-c-0.14/build'
make[3]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
[100%] Built target test_locale
make[2]: Leaving directory '/home/user/heads/build/json-c-0.14/build'
Install the project...
-- Install configuration: "debug"
-- Up-to-date: /home/user/heads/install/lib/libjson-c.so.5.0.0
-- Up-to-date: /home/user/heads/install/lib/libjson-c.so.5
-- Up-to-date: /home/user/heads/install/lib/libjson-c.so
-- Up-to-date: /home/user/heads/install/lib/cmake/json-c/json-c-targets.cmake
-- Up-to-date: /home/user/heads/install/lib/cmake/json-c/json-c-targets-debug.cmake
-- Up-to-date: /home/user/heads/install/lib/cmake/json-c/json-c-config.cmake
-- Up-to-date: /home/user/heads/install/lib/pkgconfig/json-c.pc
-- Up-to-date: /home/user/heads/install/include/json-c/config.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_config.h
-- Up-to-date: /home/user/heads/install/include/json-c/json.h
-- Up-to-date: /home/user/heads/install/include/json-c/arraylist.h
-- Up-to-date: /home/user/heads/install/include/json-c/debug.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_c_version.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_inttypes.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_object.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_object_iterator.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_pointer.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_tokener.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_types.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_util.h
-- Up-to-date: /home/user/heads/install/include/json-c/json_visit.h
-- Up-to-date: /home/user/heads/install/include/json-c/linkhash.h
-- Up-to-date: /home/user/heads/install/include/json-c/printbuf.h
make[1]: Leaving directory '/home/user/heads/build/json-c-0.14/build'

@tlaurion
Copy link
Collaborator

user@x230-master:~/heads$ cat build/log/cryptsetup.configure.log 
./configure CC=/home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  AR=/home/user/heads/crossgcc/bin/x86_64-linux-musl-ar LD=/home/user/heads/crossgcc/bin/x86_64-linux-musl-ld STRIP=/home/user/heads/crossgcc/bin/x86_64-linux-musl-strip NM=/home/user/heads/crossgcc/bin/x86_64-linux-musl-nm OBJCOPY=/home/user/heads/crossgcc/bin/x86_64-linux-musl-objcopy OBJDUMP=/home/user/heads/crossgcc/bin/x86_64-linux-musl-objdump PKG_CONFIG_PATH=/home/user/heads/install/lib/pkgconfig PKG_CONFIG_SYSROOT_DIR=/home/user/heads/install   --host i386-elf-linux --prefix / --with-libgcrypt-prefix=/home/user/heads/install --disable-gcrypt-pbkdf2 --enable-cryptsetup-reencrypt --with-crypto_backend=kernel 
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i386-elf-linux-strip... /home/user/heads/crossgcc/bin/x86_64-linux-musl-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... i386-elf-linux-gnu
checking whether make supports the include directive... yes (GNU style)
checking for i386-elf-linux-gcc... /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib 
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  accepts -g... yes
checking for /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  option to accept ISO C89... none needed
checking whether /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  understands -c and -o together... yes
checking dependency style of /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib ... gcc3
checking how to run the C preprocessor... /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for i386-elf-linux-gcc... (cached) /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib 
checking whether we are using the GNU C compiler... (cached) yes
checking whether /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  accepts -g... (cached) yes
checking for /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  option to accept ISO C89... (cached) none needed
checking whether /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  understands -c and -o together... (cached) yes
checking dependency style of /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib ... (cached) gcc3
checking how to run the C preprocessor... /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  -E
checking whether make sets $(MAKE)... (cached) yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib ... /home/user/heads/crossgcc/bin/x86_64-linux-musl-ld
checking if the linker (/home/user/heads/crossgcc/bin/x86_64-linux-musl-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /home/user/heads/crossgcc/bin/x86_64-linux-musl-nm
checking the name lister (/home/user/heads/crossgcc/bin/x86_64-linux-musl-nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to i386-elf-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /home/user/heads/crossgcc/bin/x86_64-linux-musl-ld option to reload object files... -r
checking for i386-elf-linux-objdump... /home/user/heads/crossgcc/bin/x86_64-linux-musl-objdump
checking how to recognize dependent libraries... pass_all
checking for i386-elf-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for i386-elf-linux-ar... /home/user/heads/crossgcc/bin/x86_64-linux-musl-ar
checking for archiver @FILE support... @
checking for i386-elf-linux-strip... (cached) /home/user/heads/crossgcc/bin/x86_64-linux-musl-strip
checking for i386-elf-linux-ranlib... no
checking for ranlib... ranlib
configure: WARNING: using cross tools not prefixed with host triplet
checking command to parse /home/user/heads/crossgcc/bin/x86_64-linux-musl-nm output from /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for i386-elf-linux-mt... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  supports -fno-rtti -fno-exceptions... no
checking for /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  option to produce PIC... -fPIC -DPIC
checking if /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  PIC flag -fPIC -DPIC works... yes
checking if /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  static flag -static works... yes
checking if /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  supports -c -o file.o... yes
checking if /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  supports -c -o file.o... (cached) yes
checking whether the /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  linker (/home/user/heads/crossgcc/bin/x86_64-linux-musl-ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for i386-elf-linux-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ld used by /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib ... /home/user/heads/crossgcc/bin/x86_64-linux-musl-ld
checking if the linker (/home/user/heads/crossgcc/bin/x86_64-linux-musl-ld) is GNU ld... yes
checking for shared library run path origin... done
checking for iconv... yes
checking for working iconv... guessing yes
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for C/C++ restrict keyword... __restrict
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for inttypes.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/sysmacros.h usability... yes
checking sys/sysmacros.h presence... yes
checking for sys/sysmacros.h... yes
checking sys/statvfs.h usability... yes
checking sys/statvfs.h presence... yes
checking for sys/statvfs.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking for unistd.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking byteswap.h usability... yes
checking byteswap.h presence... yes
checking for byteswap.h... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking for stdint.h... (cached) yes
checking whether O_CLOEXEC is declared... yes
checking uuid/uuid.h usability... yes
checking uuid/uuid.h presence... yes
checking for uuid/uuid.h... yes
checking libdevmapper.h usability... yes
checking libdevmapper.h presence... yes
checking for libdevmapper.h... yes
checking linux/keyctl.h usability... yes
checking linux/keyctl.h presence... yes
checking for linux/keyctl.h... yes
checking whether __NR_add_key is declared... yes
checking whether __NR_keyctl is declared... yes
checking whether __NR_request_key is declared... yes
checking for key_serial_t... no
checking for uuid_clear in -luuid... yes
checking for library containing clock_gettime... none required
checking for posix_memalign... yes
checking for clock_gettime... yes
checking for posix_fallocate... yes
checking for explicit_bzero... yes
checking for an ANSI C-conforming const... yes
checking whether byte ordering is bigendian... no
checking for off_t... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for _LARGEFILE_SOURCE value needed for large files... no
checking whether /home/user/heads/crossgcc/bin/x86_64-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ -I/home/user/heads/install/include -L/home/user/heads/install/lib  needs -traditional... no
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking whether NLS is requested... yes
checking for msgfmt... no
checking for gmsgfmt... :
checking for xgettext... no
checking for msgmerge... no
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... no
checking for iconv... (cached) yes
checking for working iconv... (cached) guessing yes
checking for GNU gettext in libintl... no
checking whether to use NLS... no
checking for poptConfigFileToString in -lpopt... yes
checking for devmapper >= 1.02.03... no
checking for dm_task_set_name in -ldevmapper... yes
checking for dm_task_set_message in -ldevmapper... yes
checking whether dm_task_secure_data is declared... yes
checking whether dm_task_retry_remove is declared... yes
checking whether dm_task_deferred_remove is declared... yes
checking whether dm_device_has_mounted_fs is declared... yes
checking whether dm_device_has_holders is declared... yes
checking whether dm_device_get_name is declared... yes
checking whether DM_DEVICE_GET_TARGET_VERSION is declared... no
checking whether DM_UDEV_DISABLE_DISK_RULES_FLAG is declared... yes
checking for json-c... yes
checking whether json_object_object_add_ex is declared... yes
checking whether json_object_deep_copy is declared... yes
checking linux/if_alg.h usability... yes
checking linux/if_alg.h presence... yes
checking for linux/if_alg.h... yes
checking for linux/if_alg.h... (cached) yes
configure: WARNING: Argon2 bundled (slow) reference implementation will be used, please consider to use system library with --enable-libargon2.
checking for blkid... yes
checking blkid/blkid.h usability... yes
checking blkid/blkid.h presence... yes
checking for blkid/blkid.h... yes
checking whether blkid_do_wipe is declared... yes
checking whether blkid_probe_step_back is declared... yes
checking whether blkid_reset_probe is declared... yes
checking whether blkid_probe_set_device is declared... yes
checking whether blkid_probe_filter_superblocks_type is declared... yes
checking whether blkid_do_safeprobe is declared... yes
checking whether blkid_do_probe is declared... yes
checking whether blkid_probe_lookup_value is declared... yes
checking for systemd tmpfiles config directory... /usr/lib/tmpfiles.d
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating lib/libcryptsetup.pc
config.status: creating po/Makefile.in
config.status: creating scripts/cryptsetup.conf
config.status: creating tests/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

@tlaurion
Copy link
Collaborator

user@x230-master:~/heads$ cat build/log/cryptsetup.
cryptsetup.configure.log  cryptsetup.log            
user@x230-master:~/heads$ cat build/log/cryptsetup.log 
make -C "/home/user/heads/build/cryptsetup-2.3.3"  && make -C /home/user/heads/build/cryptsetup-2.3.3 prefix=/home/user/heads/install install
make[1]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
make  all-recursive
make[2]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
Making all in po
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3/po'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3/po'
Making all in tests
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3/tests'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3/tests'
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
  CC       src/utils_tools.o
src/utils_tools.c: In function ‘clogger’:
src/utils_tools.c:94:44: error: ‘CRYPT_LOG_DEBUG_JSON’ undeclared (first use in this function); did you mean ‘CRYPT_LOG_DEBUG’?
       level == CRYPT_LOG_DEBUG || level == CRYPT_LOG_DEBUG_JSON)
                                            ^~~~~~~~~~~~~~~~~~~~
                                            CRYPT_LOG_DEBUG
src/utils_tools.c:94:44: note: each undeclared identifier is reported only once for each function it appears in
src/utils_tools.c: In function ‘tool_log’:
src/utils_tools.c:117:7: error: ‘CRYPT_LOG_DEBUG_JSON’ undeclared (first use in this function); did you mean ‘CRYPT_LOG_DEBUG’?
  case CRYPT_LOG_DEBUG_JSON:
       ^~~~~~~~~~~~~~~~~~~~
       CRYPT_LOG_DEBUG
make[3]: *** [Makefile:1702: src/utils_tools.o] Error 1
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[2]: *** [Makefile:2318: all-recursive] Error 1
make[2]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[1]: *** [Makefile:1138: all] Error 2
make[1]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'

@alex-nitrokey
Copy link
Contributor Author

the last one is because of old libcrypt...h in install/include/ you need to clean cryptsetup stuff off the install folder

@alex-nitrokey
Copy link
Contributor Author

so basically it is not a missing json-c header file (I thought this at first, too)

@tlaurion
Copy link
Collaborator

tlaurion commented Jun 30, 2020

the last one is because of old libcrypt...h in install/include/ you need to clean cryptsetup stuff off the install folder

so basically it is not a missing json-c header file (I thought this at first, too)

No, the missing definition is in cryptsetup self-provided headers. Cleaning and rebuilding and playing around...

@alex-nitrokey : proof

user@x230-master:~/heads/build/cryptsetup-2.3.3$ grep -R CRYPT_LOG_DEBUG_JSON
lib/luks2/luks2_json_metadata.c:		crypt_log(cd, CRYPT_LOG_DEBUG_JSON, desc);
lib/luks2/luks2_json_metadata.c:	crypt_log(cd, CRYPT_LOG_DEBUG_JSON, json_object_to_json_string_ext(jobj,
lib/setup.c:		    level == CRYPT_LOG_DEBUG || level == CRYPT_LOG_DEBUG_JSON)
lib/libcryptsetup.h:#define CRYPT_LOG_DEBUG_JSON -2
docs/v2.1.0-ReleaseNotes: * CRYPT_LOG_DEBUG_JSON (message type for JSON debug)
src/utils_tools.c:		    level == CRYPT_LOG_DEBUG || level == CRYPT_LOG_DEBUG_JSON)
src/utils_tools.c:	case CRYPT_LOG_DEBUG_JSON:

user@x230-master:~/heads/build/json-c-0.14$ grep -R CRYPT_LOG_DEBUG_JSON
user@x230-master:~/heads/build/json-c-0.14$ 

user@x230-master:~/heads/install$ grep -R CRYPT_LOG_DEBUG_JSON
user@x230-master:~/heads/install$ 

@alex-nitrokey
Copy link
Contributor Author

Yes, it is, but the old one in install/include is used before if existent. For me this error was gone after cleaning it (and thus the self-provided was used). But it looks like this is not the case in your example. mh...

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 1, 2020

@alex-nitrokey doing small steps.
New error when replacing MAKE by MAKE_JOBS


tail /home/user/heads/build/log/cryptsetup.log
-----
  CC       lib/crypto_backend/libcrypto_backend_la-pbkdf2_generic.lo
  CC       lib/crypto_backend/argon2/blake2/libargon2_la-blake2b.lo
  CC       lib/crypto_backend/argon2/libargon2_la-argon2.lo
  CC       lib/crypto_backend/argon2/libargon2_la-core.lo
  CC       lib/crypto_backend/argon2/libargon2_la-encoding.lo
  CC       lib/crypto_backend/argon2/libargon2_la-thread.lo
  CC       lib/crypto_backend/argon2/libargon2_la-ref.lo
  CCLD     libargon2.la
  CCLD     libcrypto_backend.la
  CCLD     libcryptsetup.la
libtool: warning: library '/home/user/heads/install/lib/libuuid.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libblkid.la' was moved.
/usr/bin/sed: can't read //lib/libuuid.la: No such file or directory
libtool:   error: '//lib/libuuid.la' is not a valid libtool archive
make[3]: *** [Makefile:1518: libcryptsetup.la] Error 1
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[2]: *** [Makefile:2318: all-recursive] Error 1
make[2]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[1]: *** [Makefile:1138: all] Error 2
make[1]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make: *** [Makefile:382: /home/user/heads/build/cryptsetup-2.3.3/.build] Error 1

CI build with incremental changes to have build results public on attempts

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 2, 2020

New error after latest commit. CI

tail /home/user/heads/build/log/cryptsetup.log
-----
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_get_error'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_get_ex'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_array_length'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_parse_verbose'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_to_json_string_ext'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_string'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_is_type'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_string_len'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_string'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_array'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_error_desc'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_int'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_int'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1551: cryptsetup] Error 1
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[2]: *** [Makefile:2318: all-recursive] Error 1
make[2]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[1]: *** [Makefile:1138: all] Error 2
make[1]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make: *** [Makefile:382: /home/user/heads/build/cryptsetup-2.3.3/.build] Error 1
user@x230-master:~/heads$ cat /home/user/heads/build/log/cryptsetup.log
make -C "/home/user/heads/build/cryptsetup-2.3.3"  && make -C /home/user/heads/build/cryptsetup-2.3.3 prefix=/home/user/heads/install DESTDIR=/home/user/heads/install install
make[1]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
make  all-recursive
make[2]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
Making all in po
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3/po'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3/po'
Making all in tests
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3/tests'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3/tests'
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
 CCLD     cryptsetup
libtool: warning: library '/home/user/heads/install/lib/libpopt.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libuuid.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libblkid.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libpopt.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libuuid.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libblkid.la' was moved.
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: warning: libjson-c.so.5, needed by ./.libs/libcryptsetup.so, not found (try using -rpath or -rpath-link)
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_array_add'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_add_ex'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_length'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_int64'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_add'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_type_to_name'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_object'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_deep_copy'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_new'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_parse_ex'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_put'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_object'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_string_len'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_int64'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_del'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_free'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_array_get_idx'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_get_error'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_get_ex'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_array_length'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_parse_verbose'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_to_json_string_ext'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_string'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_is_type'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_string_len'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_string'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_array'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_error_desc'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_int'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_int'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1551: cryptsetup] Error 1
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[2]: *** [Makefile:2318: all-recursive] Error 1
make[2]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[1]: *** [Makefile:1138: all] Error 2
make[1]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
user@x230-master:~/heads$ cat /home/user/heads/build/log/cryptsetup.log 
make -C "/home/user/heads/build/cryptsetup-2.3.3"  && make -C /home/user/heads/build/cryptsetup-2.3.3 prefix=/home/user/heads/install DESTDIR=/home/user/heads/install install
make[1]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
make  all-recursive
make[2]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
Making all in po
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3/po'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3/po'
Making all in tests
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3/tests'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3/tests'
make[3]: Entering directory '/home/user/heads/build/cryptsetup-2.3.3'
 CCLD     cryptsetup
libtool: warning: library '/home/user/heads/install/lib/libpopt.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libuuid.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libblkid.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libpopt.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libuuid.la' was moved.
libtool: warning: library '/home/user/heads/install/lib/libblkid.la' was moved.
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: warning: libjson-c.so.5, needed by ./.libs/libcryptsetup.so, not found (try using -rpath or -rpath-link)
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_array_add'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_add_ex'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_length'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_int64'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_add'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_type_to_name'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_object'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_deep_copy'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_new'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_parse_ex'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_put'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_object'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_string_len'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_int64'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_del'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_free'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_array_get_idx'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_get_error'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_object_get_ex'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_array_length'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_parse_verbose'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_to_json_string_ext'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_string'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_is_type'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_string_len'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_string'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_array'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_tokener_error_desc'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_get_int'
/home/user/heads/crossgcc/bin/../lib/gcc/x86_64-linux-musl/8.3.0/../../../../x86_64-linux-musl/bin/ld: ./.libs/libcryptsetup.so: undefined reference to `json_object_new_int'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1551: cryptsetup] Error 1
make[3]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[2]: *** [Makefile:2318: all-recursive] Error 1
make[2]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
make[1]: *** [Makefile:1138: all] Error 2
make[1]: Leaving directory '/home/user/heads/build/cryptsetup-2.3.3'
user@x230-master:~/heads$ vim /home/user/heads/build/log/cryptsetup.log 
(failed reverse-i-search)`git sdd': ^Ct status
user@x230-master:~/heads$ git diff
diff --git a/install/.gitignore b/install/.gitignore
deleted file mode 100644
index 72e8ffc..0000000
--- a/install/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/modules/cryptsetup b/modules/cryptsetup
index 74b33f7..4158a72 100644
--- a/modules/cryptsetup
+++ b/modules/cryptsetup
@@ -25,6 +25,7 @@ cryptsetup_target := \
       && $(MAKE) \
               -C $(build)/$(cryptsetup_dir) \
               prefix="$(INSTALL)" \
+                DESTDIR="$(INSTALL)" \
               install

cryptsetup_output := \

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 2, 2020

@alex-nitrokey : any more success? New error points into fixing rpath. Will dig that.
@szszszsz : advices?

@tlaurion
Copy link
Collaborator

tlaurion commented Jul 2, 2020

Continuing attempts.....

Don't understand:
libcryptsetup.la:dependency_libs=' -L/home/user/heads/install/lib /home/user/heads/install/lib/libuuid.la -ldevmapper -L/home/user/heads/install/home/user/heads/install/lib -ljson-c -L/home/user/heads/install//lib /home/user/heads/install/lib/libblkid.la //lib/libuuid.la'

EDIT: where is that //lib/libuuid.la coming from

end of that line being the current problem.
@szszszsz ? @alex-nitrokey ?

@alex-nitrokey
Copy link
Contributor Author

EDIT: where is that //lib/libuuid.la coming from

It is from util-linux. I played around with this as well, but couldn't find a configuration that would fix this plus it was needed from old cryptsetup version as well so that I wouldn't expect that there would be a need to change anything. Yet, there are these persistent problems with libuuid.la and libblkdid.la which are both coming from util-linux

@alex-nitrokey
Copy link
Contributor Author

@alex-nitrokey : any more success? New error points into fixing rpath. Will dig that.

Honestly, I am not that experienced redarding the rpath stuff. At first, I thought you could use the .configure --disable-rpath option instead of using the patchfile with the hardcode_libdir_flag_spec. @flammit added these to the previous patchfile so maybe he has insides regarding these issue or maybe this is totally misleading...

@tlaurion tlaurion mentioned this pull request Jul 22, 2020
@tlaurion
Copy link
Collaborator

@alex-nitrokey updates?

@alex-nitrokey
Copy link
Contributor Author

Unfortunately, I wasn't able to work on this the last weeks nor do I have any good idea how to fix this yet :(

@root-hardenedvault
Copy link
Contributor

The cmake-configure of json-c does not seem to support the configuration of cross compiling. According to the current method, only a libjson-c.so linked to the libc of the host system can be obtained.

To configure cross compiling for json-c using cmake, we need to follow the cmake approach.

To link libraries such as libjson-c.so without rpath, the Makefile.in of cryptsetup 2 may need further patches.

See the patch below for specific changes:

diff --git a/modules/json-c b/modules/json-c
index 9fba289..2119d7e 100644
--- a/modules/json-c
+++ b/modules/json-c
@@ -8,9 +8,27 @@ json-c_hash := 99914e644a25201d82ccefa20430f7515c110923360f9ef46755527c02412afa
 
 # there is a bug in cmake-configure so that it can not be used with a "=", fxed in next
 # release though (then it needs to read '--prefix="$(INSTALL)"' here instead
-json-c_configure := mkdir -p build && \
+define toolchain_file =
+set\(CMAKE_SYSTEM_NAME Linux\)\n\
+set\(CMAKE_SYSROOT $(INSTALL)\)\n\
+set\(CMAKE_C_COMPILER $(CROSS)gcc\)\n\
+set\(CMAKE_AR $(CROSS)ar\)\n\
+set\(CMAKE_LINKER $(CROSS)ld\)\n\
+set\(CMAKE_NM $(CROSS)nm\)\n\
+set\(CMAKE_OBJCOPY $(CROSS)objcopy\)\n\
+set\(CMAKE_OBJDUMP $(CROSS)objdump\)\n\
+set\(INSTALL_PKGCONFIG_DIR $(INSTALL)/lib/pkgconfig\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY\)
+endef 
+
+json-c_configure := \
+	echo -e "$(toolchain_file)" | sed 's/\\//g' > toolchain && \
+	mkdir -p build && \
 	cd build && \
-	../cmake-configure --prefix "$(INSTALL)"
+	cmake .. -DCMAKE_INSTALL_PREFIX="$(INSTALL)" -DCMAKE_TOOLCHAIN_FILE=../toolchain
 
 json-c_target := \
 	$(CROSS_TOOLS) -C $(build)/$(json-c_dir)/build \
diff --git a/patches/cryptsetup-2.3.3.patch b/patches/cryptsetup-2.3.3.patch
index 644d9a6..8a673ef 100644
--- a/patches/cryptsetup-2.3.3.patch
+++ b/patches/cryptsetup-2.3.3.patch
@@ -511,17 +511,36 @@ diff -u -r cryptsetup-2.3.3-clean/Makefile.in cryptsetup-2.3.3/Makefile.in
  @CRYPTSETUP_TRUE@cryptsetup_LDADD = $(LDADD)	\
  @CRYPTSETUP_TRUE@	libcryptsetup.la	\
  @CRYPTSETUP_TRUE@	@POPT_LIBS@		\
-+@CRYPTSETUP_TRUE@	@UUID_LIBS@		\
 +@CRYPTSETUP_TRUE@	@DEVMAPPER_LIBS@	\
++@CRYPTSETUP_TRUE@	@JSON_C_LIBS@		\
  @CRYPTSETUP_TRUE@	@PWQUALITY_LIBS@	\
  @CRYPTSETUP_TRUE@	@PASSWDQC_LIBS@		\
  @CRYPTSETUP_TRUE@	@UUID_LIBS@		\
-@@ -1060,6 +1062,8 @@
+@@ -1060,6 +1062,9 @@
  @VERITYSETUP_TRUE@veritysetup_LDADD = $(LDADD)	\
  @VERITYSETUP_TRUE@	libcryptsetup.la	\
  @VERITYSETUP_TRUE@	@POPT_LIBS@		\
 +@VERITYSETUP_TRUE@	@UUID_LIBS@		\
 +@VERITYSETUP_TRUE@	@DEVMAPPER_LIBS@	\
++@VERITYSETUP_TRUE@	@JSON_C_LIBS@		\
  @VERITYSETUP_TRUE@	@PWQUALITY_LIBS@	\
  @VERITYSETUP_TRUE@	@PASSWDQC_LIBS@		\
  @VERITYSETUP_TRUE@	@BLKID_LIBS@
+@@ -1093,6 +1093,8 @@
+ @INTEGRITYSETUP_TRUE@	libcryptsetup.la	\
+ @INTEGRITYSETUP_TRUE@	@POPT_LIBS@		\
+ @INTEGRITYSETUP_TRUE@	@UUID_LIBS@		\
++@INTEGRITYSETUP_TRUE@	@DEVMAPPER_LIBS@	\
++@INTEGRITYSETUP_TRUE@	@JSON_C_LIBS@		\
+ @INTEGRITYSETUP_TRUE@	@BLKID_LIBS@
+
+ @INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_SOURCES = $(integritysetup_SOURCES)
+@@ -1122,6 +1122,8 @@
+ @REENCRYPT_TRUE@	@POPT_LIBS@			\
+ @REENCRYPT_TRUE@	@PWQUALITY_LIBS@		\
+ @REENCRYPT_TRUE@	@PASSWDQC_LIBS@			\
++@REENCRYPT_TRUE@	@DEVMAPPER_LIBS@		\
++@REENCRYPT_TRUE@	@JSON_C_LIBS@			\
+ @REENCRYPT_TRUE@	@UUID_LIBS@			\
+ @REENCRYPT_TRUE@	@BLKID_LIBS@
+ 

Noted that "system" header files should be introduced using -isystem instead of -I, that is:

diff --git a/Makefile b/Makefile
index a0bda55..23ffbfa 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,7 @@ heads_cc	:= $(CROSS)gcc \
 	-fdebug-prefix-map=$(pwd)=heads \
 	-gno-record-gcc-switches \
 	-D__MUSL__ \
-	-I$(INSTALL)/include \
+	-isystem $(INSTALL)/include \
 	-L$(INSTALL)/lib \
 
 CROSS_TOOLS_NOCC := \

At present, it may be because the patching of cryptsetup 2's configure is still incomplete, so the executable of cryptsetup cannot be linked successfully. The direct reason is remains that //lib/libuuid.la appears in dependency_libs in la files such as libcryptsetup.la.

@tlaurion
Copy link
Collaborator

The cmake-configure of json-c does not seem to support the configuration of cross compiling. According to the current method, only a libjson-c.so linked to the libc of the host system can be obtained.

To configure cross compiling for json-c using cmake, we need to follow the cmake approach.

To link libraries such as libjson-c.so without rpath, the Makefile.in of cryptsetup 2 may need further patches.

See the patch below for specific changes:

diff --git a/modules/json-c b/modules/json-c
index 9fba289..2119d7e 100644
--- a/modules/json-c
+++ b/modules/json-c
@@ -8,9 +8,27 @@ json-c_hash := 99914e644a25201d82ccefa20430f7515c110923360f9ef46755527c02412afa
 
 # there is a bug in cmake-configure so that it can not be used with a "=", fxed in next
 # release though (then it needs to read '--prefix="$(INSTALL)"' here instead
-json-c_configure := mkdir -p build && \
+define toolchain_file =
+set\(CMAKE_SYSTEM_NAME Linux\)\n\
+set\(CMAKE_SYSROOT $(INSTALL)\)\n\
+set\(CMAKE_C_COMPILER $(CROSS)gcc\)\n\
+set\(CMAKE_AR $(CROSS)ar\)\n\
+set\(CMAKE_LINKER $(CROSS)ld\)\n\
+set\(CMAKE_NM $(CROSS)nm\)\n\
+set\(CMAKE_OBJCOPY $(CROSS)objcopy\)\n\
+set\(CMAKE_OBJDUMP $(CROSS)objdump\)\n\
+set\(INSTALL_PKGCONFIG_DIR $(INSTALL)/lib/pkgconfig\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY\)\n\
+set\(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY\)
+endef 
+
+json-c_configure := \
+	echo -e "$(toolchain_file)" | sed 's/\\//g' > toolchain && \
+	mkdir -p build && \
 	cd build && \
-	../cmake-configure --prefix "$(INSTALL)"
+	cmake .. -DCMAKE_INSTALL_PREFIX="$(INSTALL)" -DCMAKE_TOOLCHAIN_FILE=../toolchain
 
 json-c_target := \
 	$(CROSS_TOOLS) -C $(build)/$(json-c_dir)/build \
diff --git a/patches/cryptsetup-2.3.3.patch b/patches/cryptsetup-2.3.3.patch
index 644d9a6..8a673ef 100644
--- a/patches/cryptsetup-2.3.3.patch
+++ b/patches/cryptsetup-2.3.3.patch
@@ -511,17 +511,36 @@ diff -u -r cryptsetup-2.3.3-clean/Makefile.in cryptsetup-2.3.3/Makefile.in
  @CRYPTSETUP_TRUE@cryptsetup_LDADD = $(LDADD)	\
  @CRYPTSETUP_TRUE@	libcryptsetup.la	\
  @CRYPTSETUP_TRUE@	@POPT_LIBS@		\
-+@CRYPTSETUP_TRUE@	@UUID_LIBS@		\
 +@CRYPTSETUP_TRUE@	@DEVMAPPER_LIBS@	\
++@CRYPTSETUP_TRUE@	@JSON_C_LIBS@		\
  @CRYPTSETUP_TRUE@	@PWQUALITY_LIBS@	\
  @CRYPTSETUP_TRUE@	@PASSWDQC_LIBS@		\
  @CRYPTSETUP_TRUE@	@UUID_LIBS@		\
-@@ -1060,6 +1062,8 @@
+@@ -1060,6 +1062,9 @@
  @VERITYSETUP_TRUE@veritysetup_LDADD = $(LDADD)	\
  @VERITYSETUP_TRUE@	libcryptsetup.la	\
  @VERITYSETUP_TRUE@	@POPT_LIBS@		\
 +@VERITYSETUP_TRUE@	@UUID_LIBS@		\
 +@VERITYSETUP_TRUE@	@DEVMAPPER_LIBS@	\
++@VERITYSETUP_TRUE@	@JSON_C_LIBS@		\
  @VERITYSETUP_TRUE@	@PWQUALITY_LIBS@	\
  @VERITYSETUP_TRUE@	@PASSWDQC_LIBS@		\
  @VERITYSETUP_TRUE@	@BLKID_LIBS@
+@@ -1093,6 +1093,8 @@
+ @INTEGRITYSETUP_TRUE@	libcryptsetup.la	\
+ @INTEGRITYSETUP_TRUE@	@POPT_LIBS@		\
+ @INTEGRITYSETUP_TRUE@	@UUID_LIBS@		\
++@INTEGRITYSETUP_TRUE@	@DEVMAPPER_LIBS@	\
++@INTEGRITYSETUP_TRUE@	@JSON_C_LIBS@		\
+ @INTEGRITYSETUP_TRUE@	@BLKID_LIBS@
+
+ @INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_SOURCES = $(integritysetup_SOURCES)
+@@ -1122,6 +1122,8 @@
+ @REENCRYPT_TRUE@	@POPT_LIBS@			\
+ @REENCRYPT_TRUE@	@PWQUALITY_LIBS@		\
+ @REENCRYPT_TRUE@	@PASSWDQC_LIBS@			\
++@REENCRYPT_TRUE@	@DEVMAPPER_LIBS@		\
++@REENCRYPT_TRUE@	@JSON_C_LIBS@			\
+ @REENCRYPT_TRUE@	@UUID_LIBS@			\
+ @REENCRYPT_TRUE@	@BLKID_LIBS@
+ 

Noted that "system" header files should be introduced using -isystem instead of -I, that is:

diff --git a/Makefile b/Makefile
index a0bda55..23ffbfa 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,7 @@ heads_cc	:= $(CROSS)gcc \
 	-fdebug-prefix-map=$(pwd)=heads \
 	-gno-record-gcc-switches \
 	-D__MUSL__ \
-	-I$(INSTALL)/include \
+	-isystem $(INSTALL)/include \
 	-L$(INSTALL)/lib \
 
 CROSS_TOOLS_NOCC := \

At present, it may be because the patching of cryptsetup 2's configure is still incomplete, so the executable of cryptsetup cannot be linked successfully. The direct reason is remains that //lib/libuuid.la appears in dependency_libs in la files such as libcryptsetup.la.

@root-hardenedvault would you point to a PR so that commits can be cherry-picked to give you proper credit?

@tlaurion
Copy link
Collaborator

Superseded by #876

@tlaurion tlaurion closed this Nov 10, 2020
@daringer daringer deleted the cryptsetup-2.3 branch November 15, 2023 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants