[Buildroot] [PATCH v4 1/1] package/spirv-tools: fix build issue

Yann E. MORIN yann.morin.1998 at free.fr
Mon Nov 6 21:43:37 UTC 2023


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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list