[llvm-bugs] [Bug 49795] New: LLVM_ENABLE_RUNTIMES broken on linux/musl
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 31 13:27:52 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49795
Bug ID: 49795
Summary: LLVM_ENABLE_RUNTIMES broken on linux/musl
Product: Build scripts
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: cmake
Assignee: unassignedbugs at nondot.org
Reporter: chris at arachsys.com
CC: llvm-bugs at lists.llvm.org
TL;DR: LLVM_ENABLE_RUNTIMES in both release/12.x and main appears to be broken
on linux/musl but not on linux/glibc.
I stumbled over this whilst packaging llvm/clang/etc for a weird local linux
distribution, but I reproduce and demonstrate below with mainstream Alpine
Linux and Debian images.
In a linux/musl image, such as
https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-minirootfs-3.13.3-x86_64.tar.gz
apk add alpine-sdk cmake linux-headers python3
running
mkdir build && cd build
cmake -W no-dev \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;libunwind;libcxx;libcxxabi" \
-DLLVM_INCLUDE_TESTS=No \
-DLLVM_TARGETS_TO_BUILD="Native" \
-DLIBCXX_HAS_MUSL_LIBC=Yes \
-DCOMPILER_RT_BUILD_LIBFUZZER=No \
-DCOMPILER_RT_BUILD_MEMPROF=No \
-DCOMPILER_RT_BUILD_SANITIZERS=No \
-DCOMPILER_RT_BUILD_XRAY=No \
../llvm && make -j16
completes successfully, and the resulting compiler and runtimes can be
re-used to fully bootstrap. However, the same thing with ENABLE_RUNTIMES:
cmake -W no-dev \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind;libcxx;libcxxabi" \
-DLLVM_INCLUDE_TESTS=No \
-DLLVM_TARGETS_TO_BUILD="Native" \
-DLIBCXX_HAS_MUSL_LIBC=Yes \
-DCOMPILER_RT_BUILD_LIBFUZZER=No \
-DCOMPILER_RT_BUILD_MEMPROF=No \
-DCOMPILER_RT_BUILD_SANITIZERS=No \
-DCOMPILER_RT_BUILD_XRAY=No \
../llvm && make -j16
crashes when the runtimes build tries to configure:
[...]
-- Performing Test COMPILER_RT_HAS_FUSE_LD_LLD_FLAG
-- Performing Test COMPILER_RT_HAS_FUSE_LD_LLD_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT
-- Performing Test COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT - Failed
-- Performing Test COMPILER_RT_HAS_VERSION_SCRIPT
-- Performing Test COMPILER_RT_HAS_VERSION_SCRIPT - Failed
CMake Error at /root/llvm-project/compiler-rt/cmake/config-ix.cmake:196
(message):
Please use architecture with 4 or 8 byte pointers.
Call Stack (most recent call first):
/root/llvm-project/compiler-rt/CMakeLists.txt:245 (include)
-- Configuring incomplete, errors occurred!
See also
"/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeOutput.log".
See also
"/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeError.log".
make[2]: *** [runtimes/CMakeFiles/runtimes.dir/build.make:126:
runtimes/runtimes-stamps/runtimes-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:34100:
runtimes/CMakeFiles/runtimes.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
During this configure step, every runtimes-bin test is down as 'Failed',
even things like 'C_SUPPORTS_FPIC' or 'Looking for fopen in c'. Looking at
runtimes/runtimes-bin/CMakeFiles/CMakeError.log shows link repeatedly
failing like this:
Run Build Command(s):/usr/bin/make cmTC_ac0dd/fast && make[3]: Entering
directory
'/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTC_ac0dd.dir/build.make
CMakeFiles/cmTC_ac0dd.dir/build
make[4]: Entering directory
'/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_ac0dd.dir/src.cxx.o
/root/llvm-project/build2/./bin/clang++ --target=x86_64-unknown-linux-gnu
-Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-comment
-DCOMPILER_RT_HAS_VERSION_SCRIPT -nostdinc++ -isystem
/root/llvm-project/runtimes/../libcxx/include
-Wl,--version-script,/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp/dummy.vers
-o CMakeFiles/cmTC_ac0dd.dir/src.cxx.o -c
/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp/src.cxx
clang-12: warning:
-Wl,--version-script,/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp/dummy.vers:
'linker' input unused [-Wunused-command-line-argument]
Linking CXX executable cmTC_ac0dd
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ac0dd.dir/link.txt
--verbose=1
/root/llvm-project/build2/./bin/clang++ --target=x86_64-unknown-linux-gnu
-Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-comment
-DCOMPILER_RT_HAS_VERSION_SCRIPT -nostdinc++ -isystem
/root/llvm-project/runtimes/../libcxx/include
-Wl,--version-script,/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp/dummy.vers
CMakeFiles/cmTC_ac0dd.dir/src.cxx.o -o cmTC_ac0dd
clang-12: warning: argument unused during compilation: '-nostdinc++'
[-Wunused-command-line-argument]
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
clang-12: error: linker command failed with exit code 1 (use -v to see
invocation)
make[4]: *** [CMakeFiles/cmTC_ac0dd.dir/build.make:106: cmTC_ac0dd] Error 1
make[4]: Leaving directory
'/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp'
make[3]: *** [Makefile:140: cmTC_ac0dd/fast] Error 2
make[3]: Leaving directory
'/root/llvm-project/build2/runtimes/runtimes-bins/CMakeFiles/CMakeTmp'
This doesn't happen on a linux/glibc image, such as Debian unstable with
https://raw.githubusercontent.com/debuerreotype/docker-debian-artifacts/dist-amd64/unstable/rootfs.tar.xz
apt-get install build-essential cmake python3 python3-distutils
where
cmake -W no-dev \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind;libcxx;libcxxabi" \
-DLLVM_INCLUDE_TESTS=No \
-DLLVM_TARGETS_TO_BUILD="Native" \
-DCOMPILER_RT_BUILD_LIBFUZZER=No \
-DCOMPILER_RT_BUILD_MEMPROF=No \
-DCOMPILER_RT_BUILD_SANITIZERS=No \
-DCOMPILER_RT_BUILD_XRAY=No \
../llvm && make -j16
completes fine, as does a build with the runtimes in LLVM_ENABLE_PROJECTS.
(Same cmake command except I've dropped -DLIBCXX_HAS_MUSL_LIBC.)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210331/873ff142/attachment.html>
More information about the llvm-bugs
mailing list