Using this flake
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
zig-overlay.url = "github:mitchellh/zig-overlay";
};
outputs = inputs:
let
inherit (inputs) nixpkgs zig-overlay flake-utils gsl;
systems = [ "x86_64-linux" ];
in
flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs { inherit system; };
zig = zig-overlay.packages.${system}.master;
gsl = pkgs.gsl;
blas = pkgs.blas;
in
{
devShells.default = pkgs.mkShell {
packages = [ zig gsl blas ];
};
});
}
I want to compile this C program using the Zig toolchain:
#include <gsl/gsl_cdf.h>
#include <stdio.h>
int main(){
double bottom_tail = gsl_cdf_gaussian_P(-1.96, 1);
printf("Area betweeen [-1.96, 1.96]: %g\n", 1 - 2*bottom_tail);
}
via
zig build-exe main_gsl.c -lgsl -lc
but I get a lot of undefined cblas_* from gsl.so
error: ld.lld: undefined reference due to --no-allow-shlib-undefined: cblas_ctrmv
note: referenced by /nix/store/wh63z2hi25bkiajrg6rzj9pfpyvwp0wy-gsl-2.7.1/lib/libgsl.so
error: ld.lld: undefined reference due to --no-allow-shlib-undefined: cblas_zswap
note: referenced by /nix/store/wh63z2hi25bkiajrg6rzj9pfpyvwp0wy-gsl-2.7.1/lib/libgsl.so
...
so the actual question, how can I pull in the BLAS dependency for GSL? I tried above with blas
package, but initially thought that the dependency would be pulled in with GSL already?