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

Fix cross compilation of LLVM-3.9 #25218

Merged
merged 7 commits into from May 2, 2017
Merged

Conversation

expipiplus1
Copy link
Contributor

@expipiplus1 expipiplus1 commented Apr 25, 2017

Although LLVM now cross compiles successfully the executable do not run, the
RUNPATH of the resultant executables in incorrect, it does not contain the
LLVM lib output.

It's now possible to cross compile llvm:

`nix-build -E '(import ./. { crossSystem = import ./platform.nix; }).pkgs.llvm'`
@mention-bot
Copy link

@expipiplus1, thanks for your PR! By analyzing the history of the files in this pull request, we identified @gebner, @vcunat and @copumpkin to be potential reviewers.

@expipiplus1 expipiplus1 changed the title Fix cross compilation of LLVM Fix cross compilation of LLVM-3.9 Apr 25, 2017
@@ -39,7 +42,13 @@ in stdenv.mkDerivation rec {

outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";

buildInputs = [ perl groff cmake libxml2 python libffi ]
buildInputs = [
buildPackages.perl
Copy link
Member

Choose a reason for hiding this comment

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

Can these be nativeBuildInputs? might not even cause rebuild for native due to some normalizing in stdenv.

@@ -13,7 +13,7 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra
'';

buildInputs = [ cmake libedit libxml2 llvm python ];
buildInputs = [ buildPackages.cmake libedit libxml2 llvm python ];
Copy link
Member

Choose a reason for hiding this comment

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

cmake should also be a nativeBuildInput. Note that buildPackages. is not necessary in this case because mkDerivation will magically fish it out.

@@ -88,6 +97,9 @@ in stdenv.mkDerivation rec {
++ stdenv.lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false"
] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this is a general cmake thing? This could be generalized to be so added for all derivations with cmakeFlags I suppose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

buildInputs = [
groff
libxml2
libffi ]
Copy link
Member

Choose a reason for hiding this comment

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

Not to be a big nit, but ] on the line below before ++ I think would be more idiomatic.

The current cc-wrapper script seems to have trouble setting the rpath
correctly. Hopefully NixOS#25047 will fix this.
@7c6f434c
Copy link
Member

7c6f434c commented May 1, 2017

@expipiplus1 do you consider this ready to merge? Given LLVM 3.9 is what Mesa currently uses, I would target this to staging

@Ericson2314
Copy link
Member

It's not entirely clear to me this is/need-be a hash-breaking change given the way *inputs are normalized.

It does look good to me, so definitely want to merge somewhere.

@7c6f434c
Copy link
Member

7c6f434c commented May 1, 2017

I think the order of inputs needs to change (because the current situation means interleaving of native and target inputs), and that's a hash change.

@expipiplus1
Copy link
Contributor Author

@7c6f434c Yeah, I think it's good to go. I'd like to get to the bottom of why the shared library support doesn't work at some time.

@expipiplus1
Copy link
Contributor Author

I'm in no hurry though!

@7c6f434c
Copy link
Member

7c6f434c commented May 2, 2017

Well, I guess when you want it merged you want to retarget it to the staging branch

@expipiplus1 expipiplus1 changed the base branch from master to staging May 2, 2017 20:18
@expipiplus1
Copy link
Contributor Author

done!

@7c6f434c 7c6f434c merged commit 7527355 into NixOS:staging May 2, 2017
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

4 participants