| 10 Dec 2021 |
symphorien | are you looking for "cc=${stdenv.cc.targetPrefix}cc" ? | 13:50:27 |
Mic92 | You can use shellHook though | 13:50:33 |
ErPepone | yep I'm using shellHook now but CMake is complaining | 13:51:10 |
ErPepone | I have to setup also the CMake flags | 13:51:17 |
ErPepone | In reply to @symphorien:xlumurb.eu are you looking for "cc=${stdenv.cc.targetPrefix}cc" ? Thanks! | 13:51:22 |
ErPepone | CMake looks for cc and c++ | 13:51:47 |
ErPepone | Hmm, gccWithLldStdenv seems not to have any .cc.targetPrefix! | 13:53:48 |
ErPepone | So maybe is overrideCC that is not working properly? | 13:54:03 |
ErPepone | shellHook = ''
export CC=${gccWithLldStdenv.cc.targetPrefix}cc
export CXX=${gccWithLldStdenv.cc.targetPrefix}c++
'';
ends up in
$ echo $CC
cc
$ echo $CXX
c++
| 13:54:47 |
Mic92 | ErPepone: maybe gccWithLldStdenv.cc.targetPrefix is empty? | 13:57:33 |
ErPepone | I was just trying with what symphorien suggested me earlier | 13:58:04 |
ErPepone | It shouldn't be empty though, right? | 13:58:16 |
ErPepone | Because I'm overriding the stdenv of gnu32 | 13:58:28 |
Mic92 | Usually it's not empty, only if it is not a cross compiler | 13:58:37 |
ErPepone | Just to be sure, this is what I'm using now:
gccWithLld = pkgsCross32.wrapCCWith {
cc = pkgsCross32.buildPackages.gcc-unwrapped;
bintools = pkgsCross32.buildPackages.llvmPackages_13.bintools;
};
gccWithLldStdenv = pkgsCross32.overrideCC pkgsCross32.stdenv gccWithLld;
| 13:59:18 |
Mic92 | I mean maybe wrapCCWith does not apply the target prefix correctly | 13:59:56 |
ErPepone | Is there another way to force LLVM's bintools onto a stdenv? | 14:00:19 |
Mic92 | You could also hard code the correct prefix for now | 14:00:58 |
Mic92 | or use pkgsCross.gnu32.stdenv.cc.targetPrefix | 14:01:25 |
Mic92 | (targetPlatform.config + "-");
| 14:04:39 |
Mic92 | Somehow this condition does not set the prefix in your case: https://github.com/NixOS/nixpkgs/blob/d0d209fd591c40ac8a2be4a0379ee14ab5b556bb/pkgs/build-support/cc-wrapper/default.nix#L38 | 14:05:39 |
ErPepone | It's because I'm on x86-64 "cross-compiling" for x86 | 14:06:24 |
ErPepone | Probably | 14:06:28 |
ErPepone | I am compiling a fork of LLVM with the pkgsCross set but it seems that when linking one of the buildInputs, the file format is not correct | 14:18:45 |
ErPepone | /nix/store/g876mcfvkd6h80s28z5p1czvdcsxr3q3-i686-unknown-linux-gnu-binutils-2.35.2/bin/i686-unknown-linux-gnu-ld: /nix/store/2q3qzdrx1pka5gb93si9wca2a5b1qgx6-z3-4.8.12-lib/lib/libz3.so: error adding symbols: file in wrong format
| 14:20:37 |
ErPepone | gccWithLldStdenv.mkDerivation {
pname = "mypkg";
version = "0.1.0";
enableParallelBuilding = true;
nativeBuildInputs = [
cmake
git
curl
pkg-config
ninja
] ++ lib.optional (use_ccache == true) [ ccache ];
buildInputs = [ z3 libxml2 python ];
| 14:21:20 |
ErPepone | (if I put the deps in buildInputs into nativeBuildInputs, LLVM doesn't find them when configuring the build) | 14:21:53 |
Mic92 | do you take packages from pkgsCross? | 14:22:26 |
Mic92 | At least the stuff in buildInputs should come from pkgsCross | 14:23:04 |
ErPepone | In reply to @pepe:matrix.giugl.io
let
gccWithLld = pkgsCross32.wrapCCWith {
cc = pkgsCross32.buildPackages.gcc;
bintools = pkgsCross32.buildPackages.llvmPackages_13.bintools;
};
gccWithLldStdenv = pkgsCross32.overrideCC pkgsCross32.stdenv gccWithLld;
derivation_function = { llvmPackages_13, cmake, git, curl, pkg-config, z3
, libxml2, ninja, ccache, ocaml, use_ccache ? false, debug ? false }:
gccWithLldStdenv.mkDerivation {
....
}
This: shall I call derivation_function with pkgs or pkgsCross? | 14:23:11 |