I am trying to compile a Kotlin native application on linix with a nix flake that depends on glibc 2.19, but I am not able to find out how I can fix the glibc version in my nix flake
{
description = "Server equivalent of the popular Phoenix wallet";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ ];
};
in
{
packages = {
default = pkgs.gnumake;
};
formatter = pkgs.nixpkgs-fmt;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
# build dependencies
sqlite
curl
jdk
pkg-config
ncurses
glibc
git
];
shellHook = ''
# FIXME: this need to go in a build task
./gradlew linuxX64DistZip
'';
};
}
);
}
What do you mean with “depends on”?
glibc is generally backwards compatible, i.e. you can run applications that were built against an older glibc than they were linked to.
The opposite doesn’t work however, if you have a program that was built against a very new glibc, you can’t use an old one.
We use mkShellNoCC here since we don’t want to use the glibc that comes with the shell by default.
To check the version:
$ ldd --version
ldd (GNU libc) 2.19
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.