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
misc cross fixes, batch 4 #34198
misc cross fixes, batch 4 #34198
Conversation
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.
Thanks again!
@@ -75,8 +75,13 @@ stdenv.mkDerivation rec { | |||
# internal pcre would only add <200kB, but it's relatively common | |||
configureFlags = [ "--with-pcre=system" ] | |||
++ optional stdenv.isDarwin "--disable-compile-warnings" | |||
++ optional (stdenv.isFreeBSD || stdenv.isSunOS) "--with-libiconv=gnu" | |||
++ optional stdenv.isSunOS "--disable-dtrace"; | |||
++ optional (stdenv.isFreeBSD || stdenv.isSunOS || (stdenv.hostPlatform.libc != "glibc")) "--with-libiconv=gnu" |
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.
I think stdenv.hostPlatform.libc != "glibc"
covers the rest
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.
I thought so but didn't want to get that wrong... :).
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec { | |||
|
|||
# Stop build scripts from searching global include paths | |||
LSOF_INCLUDE = "${stdenv.cc.libc}/include"; | |||
configurePhase = "./Configure -n ${dialect}"; | |||
configurePhase = "LINUX_CONF_CC=${buildPackages.stdenv.cc}/bin/cc LSOF_CC=$CC LSOF_AR=\"$AR cr\" LSOF_RANLIB=$RANLIB ./Configure -n ${dialect}"; |
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.
Can use $CC_FOR_BUILD
for the first one. Probably easier to read (if not identical semantics) with exports and a multi-line string?
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.
d'oh, yes, much better.
pkgs/tools/misc/file/default.nix
Outdated
@@ -12,6 +12,7 @@ stdenv.mkDerivation rec { | |||
sha256 = "0l1bfa0icng9vdwya00ff48fhvjazi5610ylbhl35qi13d6xqfc6"; | |||
}; | |||
|
|||
depsBuildBuild = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) file; |
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.
I don't think depsBuildBuild
has a target platform so nativeBuildInputs
should be fine? Can make unconditional too.
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.
This is needed to avoid infinite recursion, or at least that's why it's present. Sounds like comment is needed, at least!
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.
Oh, duh!
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.
Oh oops. I meant to say file
doesn't have a target platform. So yes it should be conditional bit it should also be in nativeBuildInputs
.
@@ -15,6 +15,8 @@ stdenv.mkDerivation { | |||
|
|||
patches = [ ./connect.patch ./service-name.patch ]; | |||
|
|||
makeFlags = [ "AR=${stdenv.cc.targetPrefix}ar" ]; |
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.bintools.targetPrefix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec { | |||
# * .h files installed for static library target only | |||
# * .so.0 -> .so link only created in the static library install target | |||
buildPhase = '' | |||
make lib-shared lib-static build-shared CC=cc PREFIX=$out | |||
make lib-shared lib-static build-shared CC=${stdenv.cc.targetPrefix}cc AR=${stdenv.cc.bintools.targetPrefix}ar PREFIX=$out |
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.
CC=$CC
AR=$AR
Feedback addressed, but haven't pushed yet, waiting on testing :). Thanks for the review! Piece by piece the cross-compilation world shall be conquered! |
e66f907
to
f57b8ce
Compare
Okay, believe all issues have been addressed! Added |
build fails otherwise, presumably not also needed as a buildInput for some reason.
(cherry picked from commit 07f1d9e)
For whatever reason "selfNativeBuildInput = true" doesn't seeem to do the trick here? (reasons may include "it's not intended to solve this problem" ;))
tweaked to handle non-glibc along with others
f57b8ce
to
c68aa53
Compare
Fixed "file" per review, thank you! Things still looking good on native and cross-aarch64. |
The glib change caused a mass failure on Darwin: https://hydra.nixos.org/build/68330165 Anyone has an idea what configure parameter is best to pass if targeting Darwin? @LnL7 Not passing any seemed to be OK on Hydra (that was so before this PR). |
On darwin libiconv is https://opensource.apple.com/source/libiconv, not the gnu version. |
That seems to be OK in build inputs ( |
https://developer.gnome.org/glib/stable/glib-building.html I guess there is an iconv function vehich is good enough on Darwin? Or we can just add a libiconv dep. |
The dep used to work OK on Darwin (apparently), up to this PR which added a configure flag for Darwin ( |
Reading the gnome link, we'll go with this? diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 656cdffbb4c..2071eb935ae 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -75,7 +75,8 @@ stdenv.mkDerivation rec {
# internal pcre would only add <200kB, but it's relatively common
configureFlags = [ "--with-pcre=system" ]
++ optional stdenv.isDarwin "--disable-compile-warnings"
- ++ optional (stdenv.hostPlatform.libc != "glibc") "--with-libiconv=gnu"
+ ++ optional (stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isDarwin)
+ "--with-libiconv=gnu"
++ optional stdenv.isSunOS "--disable-dtrace"
# Can't run this test when cross-compiling
++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) |
Sounds good to me, sorry about the breakage! |
Fix the failure caused in NixOS#34198 by a suggested change of mine. @vcunat reported in [1]. [1]: NixOS#34198 (comment)
Tested on aarch64, all build except jwhois
which fails due to dependency not being fixed yet.
Included jwhois patch is relatively straightforward
and fixes cross-build on multiple musl-based platforms.
Coming Soon (tm).
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)cc @Ericson2314