Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvmPackages_7.compiler-rt fails to produce output path on armv7l #87266

Closed
Atemu opened this issue May 8, 2020 · 4 comments · Fixed by #87419
Closed

llvmPackages_7.compiler-rt fails to produce output path on armv7l #87266

Atemu opened this issue May 8, 2020 · 4 comments · Fixed by #87419
Labels
0.kind: bug Something is broken 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related

Comments

@Atemu
Copy link
Member

Atemu commented May 8, 2020

Describe the bug
A clear and concise description of what the bug is.

Same issue as #66693 or #85622, but on armv7l

Additional context
Add any other context about the problem here.

On @thefloweringash's hydra, the clang build first started failing with this error after going from 84cf00f to 7e07846.
I diffed the range and found 74f3b25 to be the most likely culprit.

It enabled some cmakeFlags globally which used to only be enabled on darwin and useLLVM systems.
I don't know what exactly these do but, I was able to build llvmPackages_7.compiler-rt on my rpi2 by disabling them on aarch32:

diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix
index 055fb01215f..e30a5171008 100644
--- a/pkgs/development/compilers/llvm/7/compiler-rt.nix
+++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
     "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
   ];
 
-  cmakeFlags = [
+  cmakeFlags = stdenv.lib.optionals (!stdenv.isAarch32) [
     "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
     "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
     "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"

Since I have no idea why this works and what would be affected, I'd rather have someone look over this.

Notify maintainers

@TravisWhitaker @matthewbauer

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "armv7l-linux"
  • host os: Linux 5.4.25, NixOS, 20.09pre-git (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.3
  • channels(root): "nixos-unstable2, nixos-20.09pre223023.fce7562cf46, nixos-unstable"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: llvmPackages
# a list of nixos modules affected by the problem
module:
@Atemu Atemu added the 0.kind: bug Something is broken label May 8, 2020
@matthewbauer
Copy link
Member

@Atemu
Copy link
Member Author

Atemu commented May 9, 2020

I tried but it fails with this error now:

CMake Error at cmake/Modules/AddCompilerRT.cmake:273 (add_library):
  No SOURCES given to target: clang_rt.builtins-armv7l
Call Stack (most recent call first):
  lib/builtins/CMakeLists.txt:602 (add_compiler_rt_runtime)

I guess it can't find a default target for armv7l somehow?

Not really familiar with cmake unfortunately

@Atemu
Copy link
Member Author

Atemu commented May 9, 2020

I made some progress, it seems to be taking the target arch from the triplet given to CMAKE_C_COMPILER_TARGET, even if you override the target arch with a flag. Printf debugging showed me that it does this halfway through the configure phase, it's armhf in the beginning if I set the flag.

Setting the compiler target to armhf-unknown-linux-gnueabihf instead of armv7l-unknown-linux-gnueabihf makes it find its target and compile successfully.

Does CMAKE_C_COMPILER_TARGET have any importance outside the build process?

@matthewbauer
Copy link
Member

Does CMAKE_C_COMPILER_TARGET have any importance outside the build process?

I don't think it does. It's possible it sets -marmhfin compiler calls, but that is considered equivalent to -marmv7l.

@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants