Okay, I figured out what is happening here. There are two issues:

1. llvm-config is placed into the target sysroot (by mesa recipe),
without adjusting rpath to point to the native sysroot. This may work
if native and target are both x86, but will fail if they are not, or
if the native and target use different libdir paths (e.g. lib and
lib64). It needs to be able to find libraries from the native sysroot.

2. llvm-config hardcodes the lib location inside of itself to
lib+LLVM_LIBDIR_SUFFIX. This one is harder to solve, as llvm-config
should be built once, and must be reusable between target builds, even
if those builds have different lib suffixes. What we can do is adjust
llvm-config wrapper (one in crossscripts) to have more special-cases.
Maybe this will even make installing llvm-config native binary into
target bindir unnecessary.

I'll try to come up with a patchset.

Alex

On Mon, 14 Nov 2022 at 01:40, Vincent Davis Jr <[email protected]> wrote:
>
> To answer second question. When you don't include
>
> EXTRA_OECMAKE:append:class-native = "\
>      -DLLVM_LIBDIR_SUFFIX=64 \
>      "
>
> meson configure fails with
> ....
> ....
> ....
> | llvm-config found: YES 
> (/../../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/bin/crossscripts/llvm-config15.0.1)
>  15.0.1
> | Run-time dependency LLVM (modules: amdgpu, asmparser, bitreader, bitwriter, 
> core, engine, executionengine, instcombine, ipo, mcdisassembler, mcjit, 
> native, scalaropts, transformutils, coroutines) found: NO (tried cmake and 
> config-tool)
> | Building fallback subproject with default_library=shared
> |
> | ../mesa-22.2.2/meson.build:1783:2: ERROR: Neither a subproject directory 
> nor a llvm.wrap file was found.
> |
> | A full log can be found at 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/build/meson-logs/meson-log.txt
> ....
> ....
> ....
>
> Now if you
>
> $ cat < 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/build/meson-logs/meson-log.txt
>
> You see
>
> llvm-config found: YES 
> (/../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/bin/crossscripts/llvm-config15.0.1)
>  15.0.1
> llvm-config --shared-mode returned an error
> Run-time dependency LLVM (modules: amdgpu, asmparser, bitreader, bitwriter, 
> core, engine, executionengine, instcombine, ipo, mcdisassembler, mcjit, 
> native, scalaropts, transformutils, coroutines) found: NO (tried cmake and 
> config-tool)
>
> Now run llvm-config --shared-mode directly you see
>
> $ llvm-config --shared-mode
> llvm-config: error: component libraries and shared library
> ....
> ....
> ....
> ....
> llvm-config: error: missing: 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/lib/libLLVMMCParser.a
> llvm-config: error: missing: 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/lib/libLLVMTextAPI.a
> llvm-config: error: missing: 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/lib/libLLVMObject.a
> llvm-config: error: missing: 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/lib/libLLVMDebugInfoDWARF.a
> llvm-config: error: missing: 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/lib/libLLVMDebugInfoMSF.a
> llvm-config: error: missing: 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/lib/libLLVMDebugInfoPDB.a
> ....
> ....
> ....
> ....
>
>
> ../mesa/2_22.2.2-r0/mesa-22.2.2# llvm-config --libdir
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr/lib
>
> ../mesa/2_22.2.2-r0/mesa-22.2.2# ls 
> /../../.../../../../../../../tmp/work/amd64-northstar-linux/mesa/2_22.2.2-r0/recipe-sysroot/usr
> bin  include  lib64  share
>
> That folder doesn't exists for me.
>
> Also another false statement on my end its llvm-config that hard sets 
> directory where to load libs.
> mesa never calls llvm-config --libdir.
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173237): 
https://lists.openembedded.org/g/openembedded-core/message/173237
Mute This Topic: https://lists.openembedded.org/mt/94995332/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to