6 Oct 2024 |
srasu | would a git link be useful? It's not a very large project, just a personal template I use for building C projects | 16:20:14 |
K900 | If it's your own project, you probably want to just use Meson | 16:21:23 |
K900 | And Meson will do the right thing | 16:21:28 |
srasu | I've been told to use meson before and not had a good time | 16:22:18 |
Artturin | In reply to @suskeyhose:matrix.org
doing a devShell
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bear
doxygen
nodejs
lldb_18
llvmPackages_18.bintools
clang-tools_18
valgrind
man-pages
man-pages-posix
];
nativeBuildInputs = with pkgs; [
llvmPackages_18.clang
pkg-config
wine64
] ++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
llvmPackages_18.clang
]);
buildInputs = with pkgs; [
libblocksruntime
] ++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
libblocksruntime
]);
NOVENDOR = "yes";
DEBUG = "yes";
LEAKCHECK = "yes";
UBSAN_OPTIONS="suppressions=template.supp";
hardeningDisable = [ "all" ];
CPATH = "${pkgs.llvmPackages_18.clang}/resource-root/include:${pkgs.glibc.dev}/include";
WINCPATH = with pkgs.pkgsCross.mingwW64.buildPackages;
"${llvmPackages_18.clang}/resource-root/include";
};
You'll want to get everything from the cross set and it's __splicedPackages so dependency attributes work correctly pkgsCross.mingwW64.__splicedPackages It's also best to avoid packages when you're doing cross compilation as it can obscure which packages are being talked about, instead use nativeBuildInputs directly https://github.com/NixOS/nixpkgs/blob/85813b7cfeb12a87da5506035f73b5b18a0a50c3/pkgs/build-support/mkshell/default.nix#L41 | 16:23:26 |
srasu | packages only has stuff that's not actually used by the build process, just build tooling | 16:24:20 |
srasu | * packages only has stuff that's not actually used by the build process, just dev tooling | 16:24:26 |
srasu | I can give that a go though | 16:25:03 |
Artturin | You should put tooling that does not care about target to depsBuildBuild , that way you won't have to rebuild them as for rarer platforms their depsBuildHost versions aren't usually cached | 16:25:39 |
Artturin | Probably something like this
devShells.default =
let
pkgs = pkgsCross.mingwW64.__splicedPackages;
in
pkgs.mkShell {
packages = with pkgs; [
bear
doxygen
nodejs
man-pages
man-pages-posix
];
nativeBuildInputs = with pkgs; [
llvmPackages_18.clang
llvmPackages_18.bintools
lldb_18
clang-tools_18
valgrind
pkg-config
wine64
];
buildInputs =
with pkgs;
[
libblocksruntime
]
++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
libblocksruntime
]);
NOVENDOR = "yes";
DEBUG = "yes";
LEAKCHECK = "yes";
UBSAN_OPTIONS = "suppressions=template.supp";
hardeningDisable = [ "all" ];
CPATH = "${pkgs.llvmPackages_18.clang}/resource-root/include:${pkgs.glibc.dev}/include";
WINCPATH =
with pkgs.pkgsCross.mingwW64.buildPackages;
"${llvmPackages_18.clang}/resource-root/include";
};
| 16:26:56 |
Artturin | * Probably something like this
devShells.default =
let
pkgs = pkgsCross.mingwW64.__splicedPackages;
in
pkgs.mkShell {
depsBuildBuild = with pkgs; [
bear
doxygen
nodejs
man-pages
man-pages-posix
];
nativeBuildInputs = with pkgs; [
llvmPackages_18.clang
llvmPackages_18.bintools
lldb_18
clang-tools_18
valgrind
pkg-config
wine64
];
buildInputs =
with pkgs;
[
libblocksruntime
]
++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
libblocksruntime
]);
NOVENDOR = "yes";
DEBUG = "yes";
LEAKCHECK = "yes";
UBSAN_OPTIONS = "suppressions=template.supp";
hardeningDisable = [ "all" ];
CPATH = "${pkgs.llvmPackages_18.clang}/resource-root/include:${pkgs.glibc.dev}/include";
WINCPATH =
with pkgs.pkgsCross.mingwW64.buildPackages;
"${llvmPackages_18.clang}/resource-root/include";
};
| 16:27:04 |
srasu | oh thanks! | 16:27:26 |
Artturin | You want to use llvm tools so do (mkShell.override { stdenv = pkgs.llvmPackages_18.stdenv; }) | 16:29:30 |
Artturin | And remove the llvmPackages from the dependency attributes | 16:29:53 |
Artturin | * And remove the llvmPackages stuff from the dependency attributes | 16:29:57 |
Artturin | * You want to use llvm tools so do
(pkgs.mkShell.override { stdenv = pkgs.llvmPackages_18.stdenv; }) | 16:35:06 |
srasu | I've started to get this weird mktemp failed to create directory via template with /tmp/nix-shell.JtWooZ/nix-shell.XXXXXX | 16:36:27 |
srasu | no such file or directory | 16:36:40 |
srasu | google is being no help | 16:36:43 |
srasu | Redacted or Malformed Event | 16:43:38 |
srasu | Redacted or Malformed Event | 16:43:41 |
srasu | Ok, that went away with a reboot, which is weird, but ok | 16:45:17 |
srasu | Trying to set things up like you posted, but I seem to be running into weird errors presumably because I had originally wanted the devshell to work for both cross compilation and usual compilation. I think I'll separate them out into different devshells though and hopefully that'll work itself out. | 16:48:24 |
Artturin | You can add the build compiler to depsBuildBuild | 16:49:35 |
Artturin | it'll be non prefixed | 16:49:57 |
Artturin | $CC_FOR_BUILD | 16:50:08 |
Artturin | * And in $CC_FOR_BUILD | 16:50:16 |
Artturin | It'll look for libraries in nativeBuildInputs | 16:50:36 |
Artturin | In reply to @artturin:matrix.org
Probably something like this
devShells.default =
let
pkgs = pkgsCross.mingwW64.__splicedPackages;
in
pkgs.mkShell {
depsBuildBuild = with pkgs; [
bear
doxygen
nodejs
man-pages
man-pages-posix
];
nativeBuildInputs = with pkgs; [
llvmPackages_18.clang
llvmPackages_18.bintools
lldb_18
clang-tools_18
valgrind
pkg-config
wine64
];
buildInputs =
with pkgs;
[
libblocksruntime
]
++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
libblocksruntime
]);
NOVENDOR = "yes";
DEBUG = "yes";
LEAKCHECK = "yes";
UBSAN_OPTIONS = "suppressions=template.supp";
hardeningDisable = [ "all" ];
CPATH = "${pkgs.llvmPackages_18.clang}/resource-root/include:${pkgs.glibc.dev}/include";
WINCPATH =
with pkgs.pkgsCross.mingwW64.buildPackages;
"${llvmPackages_18.clang}/resource-root/include";
};
Oh and do
buildInputs = (
with windows-pkgs.pkgsCross.mingwW64.__splicedPackages;
[
libblocksruntime
]
)
| 16:55:41 |
Artturin | In reply to @artturin:matrix.org
Probably something like this
devShells.default =
let
pkgs = pkgsCross.mingwW64.__splicedPackages;
in
pkgs.mkShell {
depsBuildBuild = with pkgs; [
bear
doxygen
nodejs
man-pages
man-pages-posix
];
nativeBuildInputs = with pkgs; [
llvmPackages_18.clang
llvmPackages_18.bintools
lldb_18
clang-tools_18
valgrind
pkg-config
wine64
];
buildInputs =
with pkgs;
[
libblocksruntime
]
++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
libblocksruntime
]);
NOVENDOR = "yes";
DEBUG = "yes";
LEAKCHECK = "yes";
UBSAN_OPTIONS = "suppressions=template.supp";
hardeningDisable = [ "all" ];
CPATH = "${pkgs.llvmPackages_18.clang}/resource-root/include:${pkgs.glibc.dev}/include";
WINCPATH =
with pkgs.pkgsCross.mingwW64.buildPackages;
"${llvmPackages_18.clang}/resource-root/include";
};
* Oh and do
buildInputs = (
with windows-pkgs.pkgsCross.mingwW64.__splicedPackages;
[
libblocksruntime
]
)
The buildPackages would give you the dep for placement in nativeBuildInputs
| 16:57:31 |