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

misc cross fixes, batch 4 #34198

Merged
merged 12 commits into from Jan 24, 2018
Merged

misc cross fixes, batch 4 #34198

merged 12 commits into from Jan 24, 2018

Conversation

dtzWill
Copy link
Member

@dtzWill dtzWill commented Jan 23, 2018

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).

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

cc @Ericson2314

Copy link
Member

@Ericson2314 Ericson2314 left a 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"
Copy link
Member

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

Copy link
Member Author

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}";
Copy link
Member

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?

Copy link
Member Author

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.

@@ -12,6 +12,7 @@ stdenv.mkDerivation rec {
sha256 = "0l1bfa0icng9vdwya00ff48fhvjazi5610ylbhl35qi13d6xqfc6";
};

depsBuildBuild = stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) file;
Copy link
Member

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.

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 is needed to avoid infinite recursion, or at least that's why it's present. Sounds like comment is needed, at least!

Copy link
Member

Choose a reason for hiding this comment

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

Oh, duh!

Copy link
Member

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" ];
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

CC=$CC AR=$AR

@dtzWill
Copy link
Member Author

dtzWill commented Jan 24, 2018

Feedback addressed, but haven't pushed yet, waiting on testing :).

Thanks for the review! Piece by piece the cross-compilation world shall be conquered!

@dtzWill
Copy link
Member Author

dtzWill commented Jan 24, 2018

Okay, believe all issues have been addressed!

Added depsBuildBuild to lsof since otherwise $CC_FOR_BUILD doesn't work :).

@dtzWill dtzWill mentioned this pull request Jan 24, 2018
8 tasks
bgamari and others added 12 commits January 24, 2018 09:33
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
@dtzWill
Copy link
Member Author

dtzWill commented Jan 24, 2018

Fixed "file" per review, thank you! Things still looking good on native and cross-aarch64.

@Ericson2314 Ericson2314 merged commit 8696dbe into NixOS:staging Jan 24, 2018
@dtzWill dtzWill deleted the fix/cross-misc-4 branch January 24, 2018 17:40
@vcunat
Copy link
Member

vcunat commented Jan 28, 2018

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).

@LnL7
Copy link
Member

LnL7 commented Jan 28, 2018

On darwin libiconv is https://opensource.apple.com/source/libiconv, not the gnu version.

@vcunat
Copy link
Member

vcunat commented Jan 28, 2018

That seems to be OK in build inputs (pkgs.libiconv).

@Ericson2314
Copy link
Member

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.

@vcunat
Copy link
Member

vcunat commented Jan 28, 2018

The dep used to work OK on Darwin (apparently), up to this PR which added a configure flag for Darwin (--with-libiconv=gnu).

@vcunat
Copy link
Member

vcunat commented Jan 28, 2018

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)

@dtzWill
Copy link
Member Author

dtzWill commented Jan 29, 2018

Sounds good to me, sorry about the breakage!

@Ericson2314 Ericson2314 mentioned this pull request Jan 29, 2018
8 tasks
Ericson2314 added a commit to obsidiansystems/nixpkgs that referenced this pull request Jan 29, 2018
Fix the failure caused in NixOS#34198 by a suggested change of mine. @vcunat
reported in [1].

[1]: NixOS#34198 (comment)
vcunat added a commit that referenced this pull request Jan 29, 2018
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

6 participants