Skip to content

openblas: fix static musl build #76832

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

Merged
merged 1 commit into from
Jan 3, 2020
Merged

openblas: fix static musl build #76832

merged 1 commit into from
Jan 3, 2020

Conversation

FRidh
Copy link
Member

@FRidh FRidh commented Jan 2, 2020

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

Sorry, something went wrong.

@FRidh
Copy link
Member Author

FRidh commented Jan 2, 2020

Normal and cross builds still function.

@FRidh FRidh changed the title openblas: fix pkgsStatic.openblas build openblas: fix static musl build Jan 2, 2020
@veprbl veprbl mentioned this pull request Jan 2, 2020
10 tasks
@veprbl
Copy link
Member

veprbl commented Jan 2, 2020

#75798 currently implements a following change:

diff a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -115,6 +115,9 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     perl
     which
+  ];
+
+  depsBuildBuild = [
     buildPackages.gfortran
     buildPackages.stdenv.cc
   ];

It may (or may not be) useful here.

@ofborg ofborg bot removed 6.topic: haskell 6.topic: lua 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: pantheon The Pantheon desktop environment 6.topic: printing 6.topic: python 6.topic: qt/kde 6.topic: ruby 6.topic: rust 6.topic: vim 6.topic: xfce The Xfce Desktop Environment 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 2.status: merge conflict This PR has merge conflicts with the target branch labels Jan 3, 2020
@FRidh FRidh changed the title openblas: fix static musl build WIP openblas: fix static musl build Jan 3, 2020
@@ -60,7 +61,7 @@ let
TARGET = setTarget "ATHLON";
DYNAMIC_ARCH = true;
NO_AVX512 = true;
USE_OPENMP = true;
USE_OPENMP = !stdenv.hostPlatform.isMusl;
Copy link
Member Author

@FRidh FRidh Jan 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just this seems to be sufficient actually to solve the omp issue

FC = "${stdenv.cc.targetPrefix}gfortran";
CC = "${stdenv.cc.targetPrefix}${if stdenv.cc.isClang then "clang" else "cc"}";
PREFIX = placeholder "out";
NUM_THREADS = 64;
INTERFACE64 = blas64;
NO_STATIC = !enableStatic;
NO_SHARED = !enableShared;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does speed up the build

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, it is also needed to prevent

/nix/store/394p75bacqaiv0xvyna0kazf2lg16sjs-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/cmrar1sgj5jpr9h1ypf3s6sbphaxp8zk-x86_64-unknown-linux-musl-stage-final-gfortran-debug-9.2.0/lib/gcc/x86_64-unknown-linux-musl/9.2.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/nix/store/394p75bacqaiv0xvyna0kazf2lg16sjs-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/cmrar1sgj5jpr9h1ypf3s6sbphaxp8zk-x86_64-unknown-linux-musl-stage-final-gfortran-debug-9.2.0/lib/gcc/x86_64-unknown-linux-musl/9.2.0/crtend.o: relocation R_X86_64_32 against `.ctors' can not be used when making a shared object; recompile with -fPIC
/nix/store/394p75bacqaiv0xvyna0kazf2lg16sjs-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: final link failed: nonrepresentable section on output

CROSS = stdenv.hostPlatform != stdenv.buildPlatform;
HOSTCC = "cc";
HOSTCC = if stdenv.hostPlatform.isMusl then CC else "cc";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was fixed by using depsBuildBuild

@FRidh FRidh changed the title WIP openblas: fix static musl build openblas: fix static musl build Jan 3, 2020
@FRidh FRidh requested a review from tobim January 3, 2020 10:08
@FRidh FRidh merged commit 8675529 into NixOS:staging Jan 3, 2020
@FRidh FRidh deleted the openblas branch January 3, 2020 11:51
@FRidh FRidh added the 6.topic: static Static builds (e.g. pkgsStatic) label Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants