Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkgs/development/libraries/glibc/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ stdenv.mkDerivation ({


'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
unset NIX_COREFOUNDATION_RPATH
Copy link
Member

Choose a reason for hiding this comment

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

This is going to cause problems in multiple places, we should not set this at all if the target platform is linux. This might also be wrong for darwin->darwin cross.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's fair. It looks like it's getting set here:

preHook = commonPreHook + ''
export NIX_COREFOUNDATION_RPATH=${pkgs.darwin.CF}/Library/Frameworks
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
'';

But that gets deep enough into the weeds of stdenv and cross infrastructure that I'm not sure how best to fix it. If possible, it would probably be better to do the target check in nix (as opposed to in bash) so we don't cause rebuilds for non-cross packages.

Copy link
Member

Choose a reason for hiding this comment

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

The way that's currently added isn't great and was also done before most of the cross work. Most things, including the counterpart that overrides this when frameworks are included, use addEnvHooks which I think would improve the situation.

Ideally this would also just be another setup-hook, just for the pure CF. The reason I added it here was to ensure that the hooks from frameworks run last. There's probably a better way to do that.

For testing it might be possible to use an if (stdenv.hostPlatform != stdenv.buildPlatform) then addEnvHook else export in the preHook but that might be too late. Either way the proper thing should probably go to staging.


sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"

cat > config.cache << "EOF"
Expand Down
25 changes: 0 additions & 25 deletions pkgs/development/libraries/glibc/darwin-cross-build.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ enable cross-compilation of glibc on Darwin (build=Darwin, host=Linux)
* use host version of ar, which is given by environment variable
* build system uses stamp.os and stamp.oS files, which only differ in case;
this fails on macOS, so replace .oS with .o_S
* libintl.h does not exist (and is not needed) on macOS

--- glibc-2.27/Makefile.in 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/Makefile.in 2019-02-15 17:38:27.022965553 +0100
Expand Down Expand Up @@ -77,27 +76,3 @@ enable cross-compilation of glibc on Darwin (build=Darwin, host=Linux)
endef

# Also remove the dependencies and generated source files.
--- glibc-2.27/sunrpc/rpc_main.c 2019-02-15 17:32:43.710244513 +0100
+++ glibc-2.27/sunrpc/rpc_main.c 2019-02-15 17:23:57.139617796 +0100
@@ -38,7 +38,9 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#ifndef __APPLE__
#include <libintl.h>
+#endif
#include <locale.h>
#include <ctype.h>
#include <sys/types.h>
--- glibc-2.27/sunrpc/rpc_scan.c 2019-02-15 17:32:54.845490606 +0100
+++ glibc-2.27/sunrpc/rpc_scan.c 2019-02-15 17:24:54.288066644 +0100
@@ -37,7 +37,9 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
+#ifndef __APPLE__
#include <libintl.h>
+#endif
#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"