Message ID | 20231106130835.116844-1-enki@fsck.pl |
---|---|
State | Changes Requested |
Headers | show |
Series | [v4,1/1] package/spirv-tools: fix build issue | expand |
Maciej, All, On 2023-11-06 14:08 +0100, Maciej Grela spake thusly: > spirv-tools requires a toolchain w/ shared libs, add flag dependency and comment. > > Fixes: http://autobuild.buildroot.net/results/a1f615d2410bffb6fdacc8586761c9def05aafa9 > Fixes: http://autobuild.buildroot.net/results/294ade8c9aa3d650fa5ab6cc34701c4176bc197f Sorry, but I still don't understansd how those two build failures relate to static builds. Both failed build logs are about a broken C++ compiler: -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: /usr/bin/clang++ -- Check for working CXX compiler: /usr/bin/clang++ - broken And indeed, it is not surprising that the host C++ compiler be broken when doing cross-compilation, as it is used to tentatively build taget code: /usr/bin/clang++ --sysroot=/home/thomas/autobuild/instance-1/output-1/host/armeb-buildroot-linux-uclibcgnueabi/sysroot -O3 -DNDEBUG -static CMakeFiles/cmTC_faefe.dir/testCXXCompiler.cxx.o -o cmTC_faefe /usr/bin/ld: /home/thomas/autobuild/instance-1/output-1/host/armeb-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/crt1.o: relocations in generic ELF (EM: 40) /usr/bin/ld: /home/thomas/autobuild/instance-1/output-1/host/armeb-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/crt1.o: error adding symbols: file in wrong format clang: error: linker command failed with exit code 1 (use -v to see invocation) So, if it really is about a static linking issue, we need more details... Regards, Yann E. MORIN. > Signed-off-by: Maciej Grela <enki@fsck.pl> > --- > package/spirv-tools/Config.in | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/package/spirv-tools/Config.in b/package/spirv-tools/Config.in > index 39fdb80b86..c1d3a4f9bc 100644 > --- a/package/spirv-tools/Config.in > +++ b/package/spirv-tools/Config.in > @@ -2,6 +2,7 @@ config BR2_PACKAGE_SPIRV_TOOLS > bool "spirv-tools" > depends on BR2_INSTALL_LIBSTDCPP > depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # C++17 > + depends on !BR2_STATIC_LIBS > select BR2_PACKAGE_SPIRV_HEADERS > help > The SPIR-V Tools project provides an API and commands for > @@ -9,6 +10,8 @@ config BR2_PACKAGE_SPIRV_TOOLS > > https://github.com/KhronosGroup/SPIRV-Tools > > -comment "spirv-tools needs a toolchain w/ C++, gcc >= 7" > +comment "spirv-tools needs a toolchain w/ C++, gcc >= 7, dynamic library" > depends on !BR2_INSTALL_LIBSTDCPP || \ > - !BR2_TOOLCHAIN_GCC_AT_LEAST_7 > + !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \ > + BR2_STATIC_LIBS > + > -- > 2.39.2 > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot
---- On Mon, 06 Nov 2023 14:30:12 +0100 Yann E. MORIN wrote --- > Maciej, All, > > > > On 2023-11-06 14:08 +0100, Maciej Grela spake thusly: > > > spirv-tools requires a toolchain w/ shared libs, add flag dependency and comment. > > > > > > Fixes: http://autobuild.buildroot.net/results/a1f615d2410bffb6fdacc8586761c9def05aafa9 > > > Fixes: http://autobuild.buildroot.net/results/294ade8c9aa3d650fa5ab6cc34701c4176bc197f > > > > Sorry, but I still don't understansd how those two build failures relate > > to static builds. > > > > Both failed build logs are about a broken C++ compiler: > > > > -- Detecting CXX compiler ABI info > > -- Detecting CXX compiler ABI info - failed > > -- Check for working CXX compiler: /usr/bin/clang++ > > -- Check for working CXX compiler: /usr/bin/clang++ - broken > > > > And indeed, it is not surprising that the host C++ compiler be broken > > when doing cross-compilation, as it is used to tentatively build taget > > code: > > > > /usr/bin/clang++ --sysroot=/home/thomas/autobuild/instance-1/output-1/host/armeb-buildroot-linux-uclibcgnueabi/sysroot -O3 -DNDEBUG -static CMakeFiles/cmTC_faefe.dir/testCXXCompiler.cxx.o -o cmTC_faefe > > /usr/bin/ld: /home/thomas/autobuild/instance-1/output-1/host/armeb-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/crt1.o: relocations in generic ELF (EM: 40) > > /usr/bin/ld: /home/thomas/autobuild/instance-1/output-1/host/armeb-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/crt1.o: error adding symbols: file in wrong format > > clang: error: linker command failed with exit code 1 (use -v to see invocation) > > > > So, if it really is about a static linking issue, we need more > > details... > > If you take (as an example) the config from a1f615d2410bffb6fdacc8586761c9def05aafa9, enable the C++ support and try to build you get the failure caused by ld trying to do a dynamic link with a static library: [ 54%] Building CXX object source/opt/CMakeFiles/SPIRV-Tools-opt.dir/dataflow.cpp.o /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/armeb-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__uClibc_main.os): in function `__uClibc_fini': __uClibc_main.c:(.text+0x140): undefined reference to `__fini_array_start' /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: __uClibc_main.c:(.text+0x144): undefined reference to `__fini_array_end' /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: __uClibc_main.c:(.text+0x148): undefined reference to `__fini_array_start' /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/armeb-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__uClibc_main.os): in function `__uClibc_main': __uClibc_main.c:(.text+0x430): undefined reference to `__preinit_array_start' /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: __uClibc_main.c:(.text+0x434): undefined reference to `__preinit_array_end' /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: __uClibc_main.c:(.text+0x438): undefined reference to `__init_array_start' /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: __uClibc_main.c:(.text+0x43c): undefined reference to `__init_array_end' /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: libSPIRV-Tools-shared.so: hidden symbol `__preinit_array_start' isn't defined /home/enki/a1f615d2410bffb6fdacc8586761c9def05aafa9/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/12.3.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make[4]: *** [source/CMakeFiles/SPIRV-Tools-shared.dir/build.make:1223: source/libSPIRV-Tools-shared.so] Błąd 1 make[3]: *** [CMakeFiles/Makefile2:1091: source/CMakeFiles/SPIRV-Tools-shared.dir/all] Błąd 2 Enabling the shared libs and rebuilding the toolchain fixes this. In other words those two builds fail *both* because of missing C++ support as well as a static-only toolchain. It's just that the missing C++ makes it fail early.
Maciej, All, On 2023-11-06 22:00 +0100, enki spake thusly: > ---- On Mon, 06 Nov 2023 14:30:12 +0100 Yann E. MORIN wrote --- > > On 2023-11-06 14:08 +0100, Maciej Grela spake thusly: > > > spirv-tools requires a toolchain w/ shared libs, add flag dependency and comment. > > > Fixes: http://autobuild.buildroot.net/results/a1f615d2410bffb6fdacc8586761c9def05aafa9 > > > Fixes: http://autobuild.buildroot.net/results/294ade8c9aa3d650fa5ab6cc34701c4176bc197f > > Sorry, but I still don't understansd how those two build failures relate > > to static builds. > If you take (as an example) the config from a1f615d2410bffb6fdacc8586761c9def05aafa9, enable the C++ support and try to build you get the > failure caused by ld trying to do a dynamic link with a static library: [--SNIP--] > Enabling the shared libs and rebuilding the toolchain fixes this. In > other words those two builds fail *both* because of missing C++ support > as well as a static-only toolchain. It's just that the missing C++ > makes it fail early. Here is a minimalist defconfig with static-libs: BR2_arm=y BR2_cortex_a7=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7_EABIHF_MUSL_BLEEDING_EDGE=y BR2_STATIC_LIBS=y BR2_PACKAGE_SPIRV_TOOLS=y And with this, spirv-tools does build successfully; $ make spirv-tools-configure [...] -- The C compiler identification is GNU 13.2.0 -- The CXX compiler identification is GNU 13.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /home/ymorin/dev/buildroot/O/master/host/bin/arm-linux-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /home/ymorin/dev/buildroot/O/master/host/bin/arm-linux-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Python3: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter -- Configuring done (0.4s) -- Generating done (0.1s) CMake Warning: Manually-specified variables were not used by the project: BUILD_DOC BUILD_DOCS BUILD_EXAMPLE BUILD_EXAMPLES BUILD_TEST BUILD_TESTING BUILD_TESTS -- Build files have been written to: /home/ymorin/dev/buildroot/O/master/build/spirv-tools-1.3.261.1 $ make spirv-tools-build [...] [ 99%] Linking CXX static library libSPIRV-Tools-reduce.a [ 99%] Built target SPIRV-Tools-reduce [100%] Building CXX object tools/CMakeFiles/spirv-reduce.dir/util/flags.cpp.o [100%] Building CXX object tools/CMakeFiles/spirv-reduce.dir/reduce/reduce.cpp.o [100%] Building CXX object tools/CMakeFiles/spirv-reduce.dir/util/cli_consumer.cpp.o [100%] Linking CXX executable spirv-reduce [100%] Built target spirv-reduce $ make spirv-tools-install [...] $ file target/usr/bin/spirv-* target/usr/bin/spirv-as: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-cfg: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-dis: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-lesspipe.sh: a /usr/bin/env sh script, ASCII text executable target/usr/bin/spirv-link: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-lint: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-objdump: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-opt: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-reduce: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped target/usr/bin/spirv-val: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped So, strictly speaking, spirv-tools do not require shared libs, and do build OK with static-only. So, if there is an issue with static-only, there is a hidden condition as well. Can you investigate a bit further, please? Regards, Yann E. MORIN.
diff --git a/package/spirv-tools/Config.in b/package/spirv-tools/Config.in index 39fdb80b86..c1d3a4f9bc 100644 --- a/package/spirv-tools/Config.in +++ b/package/spirv-tools/Config.in @@ -2,6 +2,7 @@ config BR2_PACKAGE_SPIRV_TOOLS bool "spirv-tools" depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # C++17 + depends on !BR2_STATIC_LIBS select BR2_PACKAGE_SPIRV_HEADERS help The SPIR-V Tools project provides an API and commands for @@ -9,6 +10,8 @@ config BR2_PACKAGE_SPIRV_TOOLS https://github.com/KhronosGroup/SPIRV-Tools -comment "spirv-tools needs a toolchain w/ C++, gcc >= 7" +comment "spirv-tools needs a toolchain w/ C++, gcc >= 7, dynamic library" depends on !BR2_INSTALL_LIBSTDCPP || \ - !BR2_TOOLCHAIN_GCC_AT_LEAST_7 + !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \ + BR2_STATIC_LIBS +
spirv-tools requires a toolchain w/ shared libs, add flag dependency and comment. Fixes: http://autobuild.buildroot.net/results/a1f615d2410bffb6fdacc8586761c9def05aafa9 Fixes: http://autobuild.buildroot.net/results/294ade8c9aa3d650fa5ab6cc34701c4176bc197f Signed-off-by: Maciej Grela <enki@fsck.pl> --- package/spirv-tools/Config.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)