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
gcc: include dylibs for darwin build #24637
Conversation
@@ -237,10 +237,16 @@ stdenv.mkDerivation ({ | |||
|
|||
# This should kill all the stdinc frameworks that gcc and friends like to | |||
# insert into default search paths. | |||
prePatch = if stdenv.isDarwin then '' | |||
prePatch = stdenv.lib.optionalString stdenv.isDarwin '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By making it into optionalString
instead of if ... then ... else null
, you actually change the hash on Linux 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the builder also changed so I think it doesn't really matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I guess if we merge this to staging (since we'll already make changes to Linux hash) then we can get rid of the null
, which would be nice...
@@ -251,6 +253,16 @@ postInstall() { | |||
done | |||
fi | |||
|
|||
if type "install_name_tool"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still necessary if you get the install name right the first time above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not really looked at it, but I still get a cycle when removing the install_name_tool -id
commands.
@LnL7 adding this to diff --git a/pkgs/applications/science/math/csdp/default.nix b/pkgs/applications/science/math/csdp/default.nix
index 7aafe9da41..353607a0fc 100644
--- a/pkgs/applications/science/math/csdp/default.nix
+++ b/pkgs/applications/science/math/csdp/default.nix
@@ -14,6 +14,15 @@ stdenv.mkDerivation {
substituteInPlace Makefile --replace /usr/local/bin $out/bin
'';
+ # If we don't set this here (just setting it as a derivation variable gets overridden by something)
+ # something earlier in the build sets CC=clang (on Darwin) which skips the cc provided by the
+ # gfortran wrapper, which then doesn't include sensible library search paths. This should be done
+ # more cleanly, by making the fortran wrapper propagate the underlying libraries more cleanly, but
+ # I'm scared of changing the wrapper right now so for now this should work.
+ preBuild = ''
+ export CC=cc
+ '';
+
preInstall = ''
rm -f INSTALL
mkdir -p $out/bin So basically, it works on Linux because they look for So in essence, it sort of feels like it works by accident on Linux. The proper behavior IMO is to use the Another simple fix would be to use
I assume those missing symbols get magically passed in by diff --git a/pkgs/applications/science/math/csdp/default.nix b/pkgs/applications/science/math/csdp/default.nix
index 7aafe9da41..9205f3e5d3 100644
--- a/pkgs/applications/science/math/csdp/default.nix
+++ b/pkgs/applications/science/math/csdp/default.nix
@@ -8,12 +8,14 @@ stdenv.mkDerivation {
sha256 = "1f9ql6cjy2gwiyc51ylfan24v1ca9sjajxkbhszlds1lqmma8n05";
};
- buildInputs = [ blas gfortran liblapack ];
+ buildInputs = [ blas gfortran.cc liblapack ];
postPatch = ''
substituteInPlace Makefile --replace /usr/local/bin $out/bin
'';
+ NIX_LDFLAGS = "-lgcc_ext.10.5 -lquadmath";
+
preInstall = ''
rm -f INSTALL
mkdir -p $out/bin Perhaps when building |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least on Linux side this seems OK (but I haven't tried it yet).
😓 Just found this! I've made many of the same changes in a working branch and it seems to work well. It also seems like a lot of packages that fail on Hydra are built on top of Fortran so hopefully this fixes that ! |
Unless somebody an idea on how to improve this I would propose to merge and fix |
The *.dylib changes are definitely good! All of the install_name_tool makes me nervous though because it doesn't seem like gcc should be needing it. There are still lots of times with go packages that this same kind of cycle-avoidance needs to be done. I start to wonder if something is off with our linker/compiler system that the Linux stdenv doesn't have. I probably shouldn't be complaining because I was the one that originally put the |
Do the |
Motivation for this change
WIP: libgfortran is currently not found correctly when using the wrapper, but csdp etc does work when using
gfortran.cc.lib
directly.Fixes #24197
/cc @copumpkin @vcunat
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)