Followup to #35397 (review), which partially reverts changes from #34491.
Also, make sure we install the correct version of lld in OpenBSD job.
Followup to #35397 (review), which partially reverts changes from #34491.
Also, make sure we install the correct version of lld in OpenBSD job.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35649.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
| Type | Reviewers |
|---|---|
| ACK | willcl-ark |
If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
Commit 8347d351570b8e93f54824498d3de162100f17fb can be dropped in favour of the generalised approach suggested in 56701ff6d5c695d80075075953e20eac5cabff4d.
As pointed out by Hebasto, the approach used in #35397 and #35412 is
better, rather than hardcoding flags and putting the SDK handling into
depends.
If we don't suffix with -${APT_LLVM_V}, then lld-21 will be installed.ACK 22ac4ad9496697f5881cb9a990fd0b50849e437e
Keeping the CI-managed SDK, LLVM version and linker setup in CI files (rather than depends) make better sense to me. If depends users need a sysroot they can provide one manually.
18 | +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld-${APT_LLVM_V}" 19 | +export SYSROOT="--sysroot=${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" 20 | +export DEP_OPTS="build_CC=clang build_CXX=clang++ \ 21 | + CC='clang --target=${HOST} ${SYSROOT}' \ 22 | + CXX='clang++ --target=${HOST} ${SYSROOT} -stdlib=libc++' \ 23 | + LDFLAGS='-Wc,-fuse-ld=lld -fuse-ld=lld' \
What's the purpose of the -Wc,-fuse-ld=lld Libtool's option here? All the depends packages that use Libtool seem to build fine without it.
Fontconfig doesn't build without it, because it's bundled libtool filters -fuse-ld=lld, and the build uses ld:
2 warnings generated.
CCLD fcarch
1 warning generated.
CCLD libfontconfig.la
/usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62)
/usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62)
/usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62)
/usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62)
/usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: error adding symbols: file in wrong format
clang: error: linker command failed with exit code 1 (use -v to see invocation)
All the depends packages that use Libtool seem to build fine without it.
How are you testing the build?
Fontconfig doesn't build without it, because it's bundled libtool filters
-fuse-ld=lld, and the build usesld:2 warnings generated. CCLD fcarch 1 warning generated. CCLD libfontconfig.la /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: error adding symbols: file in wrong format clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is this something that has been fixed in the modern Libtool versions?
All the depends packages that use Libtool seem to build fine without it.
How are you testing the build?
https://github.com/hebasto/bitcoin/actions/runs/29028591723/job/86154951601
Is this something that has been fixed in the modern Libtool versions?
I haven't looked.
I just checked the verbose build logs for for fontconfig. Notice how adding -Wc,-fuse-ld=lld to LDFLAGS silently drops -pthread:
-libtool: link: clang --target=x86_64-unknown-freebsd --sysroot=/home/hebasto/SDKs/freebsd-x86_64-unknown-freebsd-15.0 -shared -fPIC -DPIC .libs/fcatomic.o .libs/fcblanks.o .libs/fccache.o .libs/fccfg.o .libs/fccharset.o .libs/fccompat.o .libs/fcdbg.o .libs/fcdefault.o .libs/fcdir.o .libs/fcformat.o .libs/fcfreetype.o .libs/fcfs.o .libs/fcinit.o .libs/fclang.o .libs/fclist.o .libs/fcmatch.o .libs/fcmatrix.o .libs/fcname.o .libs/fcobjs.o .libs/fcpat.o .libs/fcrange.o .libs/fcserialize.o .libs/fcstat.o .libs/fcstr.o .libs/fcweight.o .libs/fcxml.o .libs/ftglue.o -L/home/hebasto/dev/bitcoin/depends/x86_64-unknown-freebsd/lib -lfreetype -lexpat --sysroot=/home/hebasto/SDKs/freebsd-x86_64-unknown-freebsd-15.0 -O2 -pthread -pthread -Wl,-soname -Wl,libfontconfig.so.1 -o .libs/libfontconfig.so.1.10.1
+libtool: link: clang --target=x86_64-unknown-freebsd --sysroot=/home/hebasto/SDKs/freebsd-x86_64-unknown-freebsd-15.0 -shared -fPIC -DPIC .libs/fcatomic.o .libs/fcblanks.o .libs/fccache.o .libs/fccfg.o .libs/fccharset.o .libs/fccompat.o .libs/fcdbg.o .libs/fcdefault.o .libs/fcdir.o .libs/fcformat.o .libs/fcfreetype.o .libs/fcfs.o .libs/fcinit.o .libs/fclang.o .libs/fclist.o .libs/fcmatch.o .libs/fcmatrix.o .libs/fcname.o .libs/fcobjs.o .libs/fcpat.o .libs/fcrange.o .libs/fcserialize.o .libs/fcstat.o .libs/fcstr.o .libs/fcweight.o .libs/fcxml.o .libs/ftglue.o -L/home/hebasto/dev/bitcoin/depends/x86_64-unknown-freebsd/lib -lfreetype -lexpat --sysroot=/home/hebasto/SDKs/freebsd-x86_64-unknown-freebsd-15.0 -O2 -fuse-ld=lld -Wl,-soname -Wl,libfontconfig.so.1 -o .libs/libfontconfig.so.1.10.1
Given this, shouldn't we adjust LDFLAGS as follows:
LDFLAGS='-Wc,-pthread -Wc,-fuse-ld=lld -fuse-ld=lld' \
and document this Libtool hack in a comment?
Fontconfig doesn't build without it, because it's bundled libtool filters
-fuse-ld=lld, and the build usesld:2 warnings generated. CCLD fcarch 1 warning generated. CCLD libfontconfig.la /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: Relocations in generic ELF (EM: 62) /usr/bin/aarch64-linux-gnu-ld.bfd: /ci_container_base/depends/SDKs/freebsd-x86_64-unknown-freebsd-15.1/usr/lib/crti.o: error adding symbols: file in wrong format clang: error: linker command failed with exit code 1 (use -v to see invocation)
We should switch the OS image to the arm64 architecture to catch similar issues in the future: https://github.com/hebasto/bitcoin/actions/runs/29087392625/job/86344255907.
Given this, shouldn't we adjust LDFLAGS as follows: and document this Libtool hack in a comment?
I don't mind. The point of adding this CI was to have a sanity check that bitcoin code actually compiles, when targeting FreeBSD. This seems to be getting well into the weeds, trying to document and workaround a problem in a sub dependency (where the issue is likely fixed in newer versions), of an optional dependency, which doesn't seem to have any effect on compilation, and only manifests on 1 architecture.
28 | + RANLIB=llvm-ranlib-${APT_LLVM_V} \ 29 | + STRIP=llvm-strip-${APT_LLVM_V}" 30 | export GOAL="install" 31 | export BITCOIN_CONFIG="\ 32 | --preset=dev-mode \ 33 | + -DCMAKE_LINKER_TYPE=LLD \
This CMake option seems redundant, as -fuse-ld=lld is already passed via the toolchain file, no?
Post-merge ACK 22ac4ad9496697f5881cb9a990fd0b50849e437e.