<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54647>54647</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
compiler-rt-sanitizers fail to compile in ../lib/interception/interception_type_test.cpp:36:1 with error: static_assert failed when compiled against musl-libc on arm32
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
stefson
</td>
</tr>
</table>
<pre>
hello everyone,
I tried to compile compiler-rt sanitizers on a linux system that uses musl as its libc, on armv7a, and I got this error:
```
[108/278] /usr/lib/llvm/13/bin/armv7a-unknown-linux-musleabihf-clang++ -I/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.0-r1/work/compiler-rt/lib/interception/.. -DNDEBUG -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -fomit-frame-pointer -Wall -std=c++14 -Wno-unused-parameter -march=armv7-a -mfloat-abi=hard -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Werror=thread-safety -Werror=thread-safety-reference -Werror=thread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -nostdinc++ -fno-rtti -MD -MT lib/interception/CMakeFiles/RTInterception.armhf.dir/interception_type_test.cpp.o -MF lib/interception/CMakeFiles/RTInterception.armhf.dir/interception_type_test.cpp.o.d -o lib/interception/CMakeFiles/RTInterception.armhf.dir/interception_type_test.cpp.o -c /var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.0-r1/work/compiler-rt/lib/interception/interception_type_test.cpp
FAILED: lib/interception/CMakeFiles/RTInterception.armhf.dir/interception_type_test.cpp.o
/usr/lib/llvm/13/bin/armv7a-unknown-linux-musleabihf-clang++ -I/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.0-r1/work/compiler-rt/lib/interception/.. -DNDEBUG -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -fomit-frame-pointer -Wall -std=c++14 -Wno-unused-parameter -march=armv7-a -mfloat-abi=hard -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Werror=thread-safety -Werror=thread-safety-reference -Werror=thread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -nostdinc++ -fno-rtti -MD -MT lib/interception/CMakeFiles/RTInterception.armhf.dir/interception_type_test.cpp.o -MF lib/interception/CMakeFiles/RTInterception.armhf.dir/interception_type_test.cpp.o.d -o lib/interception/CMakeFiles/RTInterception.armhf.dir/interception_type_test.cpp.o -c /var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.0-r1/work/compiler-rt/lib/interception/interception_type_test.cpp
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.0-r1/work/compiler-rt/lib/interception/interception_type_test.cpp:36:1: error: static_assert failed due to requirement 'sizeof(unsigned long) == sizeof(long long)' ""
COMPILER_CHECK(sizeof(::OFF_T) == sizeof(off_t));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-13.0.0-r1/work/compiler-rt/lib/interception/../sanitizer_common/sanitizer_internal_defs.h:332:30: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
^ ~~~~
1 error generated.
```
I'm still with llvm-13.0.0 toolchain, but the file in question hasn't been touched for a longer time:
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/interception/interception_type_test.cpp#L36
to me it seems that this happens as the ifdef in #34 is written in a way that my compiler compiling the code ends up in believing to be on `SANITIZER_ANDROID`; which clearly is not the case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztV99v2zYQ_mvsF4KCLDlW_OCHx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