Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 753935 - sys-libs/compiler-rt-sanitizers-10.0.1 : Does not compile on musl
Summary: sys-libs/compiler-rt-sanitizers-10.0.1 : Does not compile on musl
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo musl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-10 19:40 UTC by Jonathan Davies
Modified: 2023-02-12 19:31 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Davies 2020-11-10 19:40:16 UTC
compiler-rt-sanitizers fails on musl with:

[59/558] /usr/lib/llvm/10/bin/x86_64-gentoo-linux-musl-clang++  -I/var/tmp/portage/sys-libs/compiler-rt-sanitizers-10.0.1/work/compiler-rt/lib/gwp_asan/..  -march=native -mtune=native -O2 -pipe -Wall -std=c++14 -Wno-unused-parameter    -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -
fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -nostdinc++ -pthread -fPIC -MD -MT lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o -MF lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o.d -o lib/gwp_asan/CMakeF
iles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o -c /var/tmp/portage/sys-libs/compiler-rt-sanitizers-10.0.1/work/compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp                                                                                                                                                                                       
FAILED: lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o                                                                                         
/usr/lib/llvm/10/bin/x86_64-gentoo-linux-musl-clang++  -I/var/tmp/portage/sys-libs/compiler-rt-sanitizers-10.0.1/work/compiler-rt/lib/gwp_asan/..  -march=native -mtune=native -O2 -pipe -Wall -std=c++14 -Wno-unused-parameter    -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -
O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -nostdinc++ -pthread -fPIC -MD -MT lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o -MF lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o.d -o lib/gwp_asan/CMakeFiles/RTGw
pAsanBacktraceLibc.x86_64.dir/optional/backtrace_linux_libc.cpp.o -c /var/tmp/portage/sys-libs/compiler-rt-sanitizers-10.0.1/work/compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp  
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-10.0.1/work/compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp:10:10: fatal error: 'execinfo.h' file not found
#include <execinfo.h>
         ^~~~~~~~~~~~       
1 error generated.

I checked with #llvm on OFTC and they told me that these options need to be set with musl:

set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
Comment 1 Larry the Git Cow gentoo-dev 2020-11-10 19:52:32 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2abf7b18e945a1baee9b503cbc6650bf28c46f22

commit 2abf7b18e945a1baee9b503cbc6650bf28c46f22
Author:     Jonathan Davies <jpds@protonmail.com>
AuthorDate: 2020-11-10 17:03:14 +0000
Commit:     Jory Pratt <anarchy@gentoo.org>
CommitDate: 2020-11-10 19:52:18 +0000

    musl profile: Disabled LLVM sanitizers as they do not work for now.
    
    Closes: https://bugs.gentoo.org/753935
    Closes: https://github.com/gentoo/gentoo/pull/18216
    
    Signed-off-by: Jonathan Davies <jpds@protonmail.com>
    Signed-off-by: Jory Pratt <anarchy@gentoo.org>

 profiles/default/linux/musl/package.use.mask | 3 +++
 1 file changed, 3 insertions(+)
Comment 2 hacatu5000 2021-05-27 08:02:01 UTC
I'm still encountering this on the musl hardened profile.  Am I doing something wrong or was sanitizer support only disabled on the musl vanilla profile?  Adding `-sanitizer` to the clang-runtime USE flags can work around it for now.
Comment 3 Larry the Git Cow gentoo-dev 2021-11-07 03:59:25 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f545c8ab490e3da017fb473c506c390954c5ec0

commit 7f545c8ab490e3da017fb473c506c390954c5ec0
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-11-07 03:54:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-11-07 03:58:59 +0000

    profiles: refine LLVM sanitizers mask for musl (more finely-grained)
    
    Some sanitizers work now.
    
    Bug: https://bugs.gentoo.org/753935
    Closes: https://bugs.gentoo.org/713072
    Reported-by: maskray
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/default/linux/musl/package.use.mask |  5 +----
 profiles/features/musl/package.use.mask      | 11 ++++++++++-
 2 files changed, 11 insertions(+), 5 deletions(-)
Comment 4 tt_1 2023-02-12 19:26:41 UTC
upstream bug report: https://github.com/llvm/llvm-project/issues/60687