-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Conversation
It's now possible to cross compile llvm: `nix-build -E '(import ./. { crossSystem = import ./platform.nix; }).pkgs.llvm'`
@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. |
@@ -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 |
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 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 ]; |
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.
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" |
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.
Hmm, this is a general cmake thing? This could be generalized to be so added for all derivations with cmakeFlags
I suppose.
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 error was cause by multiple-outputs.sh not setting NIX_CROSS_LDFLAGS
buildInputs = [ | ||
groff | ||
libxml2 | ||
libffi ] |
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.
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.
@expipiplus1 do you consider this ready to merge? Given LLVM 3.9 is what Mesa currently uses, I would target this to |
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. |
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. |
@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. |
I'm in no hurry though! |
Well, I guess when you want it merged you want to retarget it to the |
done! |
Although LLVM now cross compiles successfully the executable do not run, the
RUNPATH
of the resultant executables in incorrect, it does not contain theLLVM lib output.