Bug#1051584: /usr/lib/llvm-15/bin/llvm-config: multiarch issues, with llvm-config-15
Witold Baryluk
witold.baryluk at gmail.com
Sun Sep 10 04:48:09 BST 2023
Package: llvm-15
Version: 1:15.0.7-8
Severity: normal
File: /usr/lib/llvm-15/bin/llvm-config
X-Debbugs-Cc: witold.baryluk at gmail.com
Dear Maintainer,
I am trying to cross compile Mesa for armhf, on arm64 box.
I installed llvm-15, libllvm15:arm64 and libllvm15:armhf
So I do have libLLVM.so now for armhf, but I am unable to convince the
llvm-config-15 to output proper paths with --ldflags.
[7/1106] Linking target src/amd/vulkan/libvulkan_radeon.so
FAILED: src/amd/vulkan/libvulkan_radeon.so
/usr/bin/arm-linux-gnueabihf-g++-12 -o src/amd/vulkan/libvulkan_radeon.so .... -Wl,--build-id=sha1 -Wl,-Bsymbolic -Wl,--gc-sections -Wl,--version-script /home/witold_baryluk/mesa-git/src/vulkan/vulkan.sym -L/usr/lib/llvm-15/lib -lLLVM-15 -pthread ... -Wl,--end-group
/usr/lib/llvm-15/lib/libLLVM-15.so: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
So, that is not using correct -L here.
Canonical way would be to use llvm-config-15 (Which Meson used by Mesa is
using to find all the flags), but it does not understand multiarch.
$ CC=arm-linux-gnueabihf-gcc-12 CXX=arm-linux-gnueabihf-g++-12 PKG_CONFIG=arm-linux-gnueabihf-pkg-config llvm-config-15 --ldflags
-L/usr/lib/llvm-15/lib
$
(libLLVM15.so there is a symlink which eventually leads to /usr/lib/arm64-linux-gnu/libLLVM15.so.1)
I checked source code of llvm-config and there is nothing in it to make
it smart, one just needs to compile two versions of LLVM and llvm-config,
but installing arm64 and armhf versions of llvm-config is not possible.
I am not able install llvm15:armhf and llvm15:arm64 simulataniously
either, as they conflict and provide same binaries.
This is not great, as the pkg-config provided by Debian is multi-arch
aware, and can provide correct paths.
The same issue happens on amd64, when cross-compiling mesa to i386. It
happens to work there, due to some other flags passed do the compiler,
and compiler sees both versions of libLLVM.so (amd64 and i386), and picks
i386 one, becase the other cannot be used. But that is more of an accident,
than working properly.
More information about the Pkg-llvm-team
mailing list