You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
llvmPackages.compiler-rt-nolibc seems to be broken in different ways on both the aarch64-android and aarch64-android-prebuilt example platforms. This is especially problematic as it is part of stdenv, so these platforms are pretty much unusable.
aarch64-android:
$ nix-build '<nixpkgs>' -A pkgsCross.aarch64-android.llvmPackages.compiler-rt-no-libc
...
/build/compiler-rt-src-19.1.7/compiler-rt/lib/builtins/os_version_check.c:287:10: fatal error: 'pthread.h' file not found
287 | #include <pthread.h>
| ^~~~~~~~~~~
1 error generated.
...
aarch64-android-prebuilt:
$ nix-build '<nixpkgs>' -A pkgsCross.aarch64-android-prebuilt.llvmPackages.compiler-rt-no-libc
(The configurePhase seems a little broken too, but is too large to include in this post)
...
Running phase: buildPhase
build flags: -j16
ninja: no work to do.
Running phase: installPhase
install flags: -j16 install
[0/1] Install the project...
-- Install configuration: "Release"
Running phase: fixupPhase
find: '/nix/store/15nq8gb6fsj4hk18q3kgkskv1nyqy24j-compiler-rt-aarch64-unknown-linux-android-19.1.7-dev': No such file or directory
error: builder for '/nix/store/1qz3qds4kkra8v190ymkxyk4gk730yh9-compiler-rt-aarch64-unknown-linux-android-19.1.7.drv' failed to produce output path for output 'out' at '/nix/store/1qz3qds4kkra8v190ymkxyk4gk730yh9-compiler-rt-aarch64-unknown-linux-android-19.1.7.drv.chroot/root/nix/store/dx3ix6fh7mwi7g826ngz6qn4gkg4hwcd-compiler-rt-aarch64-unknown-linux-android-19.1.7'
cc @NixOS/llvm
Reacted by Axel Karjalainen, Julien M., Manuel Bergler, Theo Paris and Walter McKelvie
I cannot try hacking at this until the Android folks gets things compatible on aarch64-linux hosts. There's been some work but afaik, it's still not possible.
Could someone explain what's happening here? Why is the compiler of compiler-rt getting compiler-rt-no-libc? Was it always this way? In my mind, it compiler-rt shouldn't need a runtime to link to.
Why is compiler-rt using clangWithLibcAndBasicRt in llvm/common/default.nix?
Why not use stdenvNoLibc here? (Edit: seems that compiler-rt requires libc... llvm/llvm-project#127227)
Though I still can't build due to this error (repeated multiple times):
FAILED: lib/hwasan/CMakeFiles/RTHwasan.aarch64.dir/hwasan_linux.cpp.o
/nix/store/w28jaykhd6rl5aymsmyy545jsaxb80gh-aarch64-unknown-linux-android-clang-wrapper-19.1.7/bin/aarch64-unknown-linux-android-clang++ -DHWASAN_WITH_INTERCEPTORS=1 -I/build/compiler-rt-src-19.1.7/compiler-rt/lib>
In file included from /build/compiler-rt-src-19.1.7/compiler-rt/lib/hwasan/hwasan_linux.cpp:29:
In file included from /nix/store/zjmjbh2sax1xcicmmk0ljdxkbj92mqdv-aarch64-bionic-prebuilt-ndk-release-r23-dev/include/unistd.h:322:
/nix/store/zjmjbh2sax1xcicmmk0ljdxkbj92mqdv-aarch64-bionic-prebuilt-ndk-release-r23-dev/include/bits/fortify/unistd.h:90:9: error: use of undeclared identifier 'SSIZE_MAX'
90 | __error_if_overflows_ssizet(count, pread)
| ^
/nix/store/zjmjbh2sax1xcicmmk0ljdxkbj92mqdv-aarch64-bionic-prebuilt-ndk-release-r23-dev/include/bits/fortify/unistd.h:62:31: note: expanded from macro '__error_if_overflows_ssizet'
62 | __clang_error_if((what) > SSIZE_MAX, "in call to '" #fn "', '" #what "' must be <= SSIZE_MAX")
|
Using clangNoCompilerRtWithLibc and disabling sanitizers on isAndroid seems to make pkgsCross.aarch64-android.llvmPackages.compiler-rt-libc build up to #269077
Also pkgsCross.aarch64-android.stdenv.cc still depends on pkgsCross.aarch64-android.llvmPackages.compiler-rt-no-libc for whatever reason.
Activity
RossComputerGuy commentedon Apr 3, 2025
I cannot try hacking at this until the Android folks gets things compatible on aarch64-linux hosts. There's been some work but afaik, it's still not possible.
CC @numinit
axelkar commentedon Aug 6, 2025
Seems that
compiler-rthas always required Bionic libc on Android:https://github.com/llvm/llvm-project/blame/04691aae0dd783162919c85aef5b8b143c0ca411/compiler-rt/lib/builtins/os_version_check.c#L313
Could someone explain what's happening here? Why is the compiler of
compiler-rtgettingcompiler-rt-no-libc? Was it always this way? In my mind, itcompiler-rtshouldn't need a runtime to link to.Why is
compiler-rtusingclangWithLibcAndBasicRtinllvm/common/default.nix?Why not use
stdenvNoLibchere? (Edit: seems that compiler-rt requires libc... llvm/llvm-project#127227)nixpkgs/pkgs/development/compilers/llvm/common/default.nix
Lines 507 to 517 in e200027
axelkar commentedon Aug 6, 2025
What I just posted in the linked PR:
Though I still can't build due to this error (repeated multiple times):
axelkar commentedon Aug 6, 2025
Using
clangNoCompilerRtWithLibcand disabling sanitizers onisAndroidseems to makepkgsCross.aarch64-android.llvmPackages.compiler-rt-libcbuild up to #269077Also
pkgsCross.aarch64-android.stdenv.ccstill depends onpkgsCross.aarch64-android.llvmPackages.compiler-rt-no-libcfor whatever reason.axelkar commentedon Aug 6, 2025
Is there a way to fix this by disabling
builtins/os_version_check.c? We'll needcompiler-rt-nolibcto work to build Bionic from source.See also llvm/llvm-project#127227
Fix Android cross-compilation: use nixpkgs-2305 with LLVM 14