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

swig: fix cross compilation #51172

Merged
merged 2 commits into from Nov 28, 2018
Merged

swig: fix cross compilation #51172

merged 2 commits into from Nov 28, 2018

Conversation

eburimu
Copy link
Contributor

@eburimu eburimu commented Nov 28, 2018

Motivation for this change

Fixes #51171

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Nov 28, 2018

@GrahamcOfBorg build pkgsCross.aarch64-multiplatform.buildPackages.swig

@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
sha256 = "1wyffskbkzj5zyhjnnpip80xzsjcr3p0q5486z3wdwabnysnhn8n";
};

nativeBuildInputs = [ autoconf automake libtool bison ];
nativeBuildInputs = [ autoconf automake libtool bison pcre.dev ];
Copy link
Member

Choose a reason for hiding this comment

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

Since it is in nativeBuildInputs I wonder why this is the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pcre-config is missing when pcre is in buildInputs. See pcre drv.

Copy link
Contributor Author

@eburimu eburimu Nov 28, 2018

Choose a reason for hiding this comment

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

wow, rebuild linux 500+ :( Could you also check the normal compilation? Got scard.

Copy link
Member

Choose a reason for hiding this comment

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

We can push this to staging.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pkgsCross.aarch64-multiplatform.buildPackages.swig

Partial log (click to expand)

Installation complete
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/0mahqdy3q1hjazfcb2dw6cdzrmzhb8zp-swig-3.0.12
shrinking /nix/store/0mahqdy3q1hjazfcb2dw6cdzrmzhb8zp-swig-3.0.12/bin/ccache-swig
shrinking /nix/store/0mahqdy3q1hjazfcb2dw6cdzrmzhb8zp-swig-3.0.12/bin/swig
strip is /nix/store/6yjvaipy9zffribmc4l13c7i8k19ama5-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/0mahqdy3q1hjazfcb2dw6cdzrmzhb8zp-swig-3.0.12/bin
patching script interpreter paths in /nix/store/0mahqdy3q1hjazfcb2dw6cdzrmzhb8zp-swig-3.0.12
checking for references to /build/ in /nix/store/0mahqdy3q1hjazfcb2dw6cdzrmzhb8zp-swig-3.0.12...
/nix/store/0mahqdy3q1hjazfcb2dw6cdzrmzhb8zp-swig-3.0.12

@Mic92 Mic92 merged commit be6b461 into NixOS:staging Nov 28, 2018
@Mic92
Copy link
Member

Mic92 commented Nov 28, 2018

Ah it was already staging. Nevermind. I merged it in 8e97e80

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-linux (full log)

Attempted: pkgsCross.aarch64-multiplatform.buildPackages.swig

Partial log (click to expand)

cannot build derivation '/nix/store/682jwnjr1vyz5hiaiwsd7rivwnwy956w-gnum4-1.4.18.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/iwnlgfwmcwzrjx2jjyvndq8p6vl2hyx2-perl-5.28.0.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/9zg31vz0gkwr1nmsmllagvbvgq200qml-autoconf-2.69.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/hswlkl5q9wbad8fysphvn0qn9yd182fx-bison-3.2.2.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/hli2hnixrykq9hb5ira6gi0a3znd6hna-perl5.28.0-gettext-1.07.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/8jc1pgl9fj2bivzf2hpjqgr4mpy5w1xw-automake-1.16.1.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/93yi4h6bj9zq6pkg45dfh5s8glj47k95-help2man-1.47.8.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/694llhzxb6vgzrh93p97q60g3ng8dpvs-libtool-2.4.6.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/18pslgc3jhpwi98skk7skxq00gfn5f0j-swig-3.0.12.drv': 7 dependencies couldn't be built
error: build of '/nix/store/18pslgc3jhpwi98skk7skxq00gfn5f0j-swig-3.0.12.drv' failed

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: pkgsCross.aarch64-multiplatform.buildPackages.swig

Partial log (click to expand)

cannot build derivation '/nix/store/jdx4hcj3ywdvx57fshjkas5r1nhv8l7x-gnum4-1.4.18.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/5y9a2vzf4v8yqy1v1fxiaa5vdwsyc5yq-perl-5.28.0.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/71kyss56zs22qrvh46c69irf54dybz3r-autoconf-2.69.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/y7k2k8zjydkxhir3js7r37kyxkia22aa-bison-3.2.2.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/2zr8drg8kc5xq03fwk0vw8i7ydl0w7km-perl5.28.0-gettext-1.07.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/64v28rd960f5g1xqh6karyz13l7svpj9-automake-1.16.1.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/76qsn9h0jnprx9n9zs026p6dggx3759r-help2man-1.47.8.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/5bskd77rfh2nni5kzs6g5splss93g0zi-libtool-2.4.6.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/6xsrhxsqj2b7yjg1wbxmgx52wfsd1zqb-swig-3.0.12.drv': 5 dependencies couldn't be built
error: build of '/nix/store/6xsrhxsqj2b7yjg1wbxmgx52wfsd1zqb-swig-3.0.12.drv' failed

@matthewbauer
Copy link
Member

This doesn't look right... you should not use buildPackages pcre-config. Instead, something like this is recommended:

PCRE_CONFIG = "${pcre.dev}/bin/pcre-config";

@Mic92
Copy link
Member

Mic92 commented Dec 18, 2018

well. This does not work either when pcre-config is compiled for the wrong architecture.

@matthewbauer
Copy link
Member

It should be a bash script in this case at least

@Mic92
Copy link
Member

Mic92 commented Dec 18, 2018

But the shebang is still incorrect.

@matthewbauer
Copy link
Member

Yeah ideally it would use /usr/bin/env sh in this case. Although it is safe for now to just assume the build platform will always be the same in nix. build1 -> target will be a different drv from build2-> target even though they should in theory be the same.

@Mic92
Copy link
Member

Mic92 commented Dec 19, 2018

There is no /usr/bin/env in the nix sandbox. /bin/sh has its own set of problems, in the sandbox it is a stripped down bash, on systems without a sandbox it might be a dash.

@Mic92
Copy link
Member

Mic92 commented Dec 19, 2018

An more general solution for the problem could be to have a build support hook that puts the right binary/variant in the PATH. Which means that pcre-config in $dev/bin remains the original one, but when we add it as a buildInput it would add a build-nativet to $PATH. llvm-config has the same problem but is a complex executable that cannot be easily re-implemented.

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

5 participants