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
libxnd, libndtypes: refactor add support for darwin #46578
Conversation
I'm a bit confused by the comments, cc is the compiler and ld is the linker. Does the build pass compiler flags to |
For some reason the |
Yes that's very normal, gcc and clang are not linkers. Could you explain or post the error? |
Here is the error if I do not manually set I am aware that gcc and clang are not linkers (they are wrappers around preprocessing, compiling, and linking). From what I know they can be used as linkers and call
|
Ah I see, the build is passing compiler specific flags to ld like I thought. That should be, so using $CC -Wl,-soname,libndtypes.so.0 ...
# or
$LD -soname libndtypes.so.0 ... Might be worth creating an upstream issue. |
8e97580
to
8bb1190
Compare
Ok I have updated the pull request with a better comment for why cc was used as a linker. Its ready to merge. I still am not convinced this is incorrect usage. While in this case using ld would have been simple enough. For some complex libraries this is not always the case. Take for example Here are the linking flags used by
|
I only have a vague understanding of this, somebody like @Ericson2314 can probably explain this better. But we explicitly set |
makeFlags = [ "CONFIGURE_LDFLAGS='-shared'" ]; | ||
# Override linker with cc (symlink to either gcc or clang) | ||
# Library expects to use cc for linking | ||
configureFlags = [ "LD=cc" ]; |
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.
${stdenv.cc.targetPrefix}cc
instead of cc
, for sake of cross
makeFlags = [ "CONFIGURE_LDFLAGS='-shared'" ]; | ||
# Override linker with cc (symlink to either gcc or clang) | ||
# Library expects to use cc for linking | ||
configureFlags = [ "LD=cc" ]; |
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.
ditto
Yeah it is done for cross on other things to force configure scripts to use the right linker. But then some configure scripts are crazy and have defaults like |
8bb1190
to
9666881
Compare
@Ericson2314 I have made the changes that you requested for cross compatibiliy. Just to make sure that I understand correctly. Using a variable |
@costrouc I'd change "compiler to determine the linker" to "using a compiler to do the linking". The compiler will modify how you link things in subtle ways to pick up the C/C++ runtime things, etc. |
Should be ready for a build now |
Motivation for this change
Prior build instructions were hacks because I did not understand that the configure script was choosing
ld
as the linker instead of usinggcc
to properly link. This commit fixes these issues and simplifies the build.Things done
libxnd: refactor
libndtypes: refactor
Please ensure that this build works on darwin.
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)