-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
nix: static build #5814
nix: static build #5814
Changes from 7 commits
b4ac6f0
51ec91b
498e998
bf11052
db22ce3
48830d7
3cfb0f0
d12f239
bc51e28
7a2ca8b
4aa00f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,6 @@ | ||||||||||
{ | ||||||||||
lib, | ||||||||||
glibc, | ||||||||||
config, | ||||||||||
stdenv, | ||||||||||
mkShell, | ||||||||||
|
@@ -30,6 +31,8 @@ | |||||||||
useRocm ? config.rocmSupport, | ||||||||||
useVulkan ? false, | ||||||||||
llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake | ||||||||||
effectiveStdenv = if useCuda then cudaPackages.backendStdenv else stdenv, | ||||||||||
enableStatic ? effectiveStdenv.hostPlatform.isStatic | ||||||||||
}@inputs: | ||||||||||
|
||||||||||
let | ||||||||||
|
@@ -167,6 +170,9 @@ effectiveStdenv.mkDerivation ( | |||||||||
# TODO: Replace with autoAddDriverRunpath | ||||||||||
# once https://github.com/NixOS/nixpkgs/pull/275241 has been merged | ||||||||||
cudaPackages.autoAddOpenGLRunpathHook | ||||||||||
] | ||||||||||
++ optionals buildStatic [ | ||||||||||
glibc.static | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @SomeoneSerge is correct - or more specifically There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing is that there are other static builds using other libc implementations -- musl being a great example -- that don't require adding glibc static edition. I agree that the test should include enableStatic rather than my proposal of The other approach, since you're hosting the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see what you mean. I agree that adding |
||||||||||
]; | ||||||||||
|
||||||||||
buildInputs = | ||||||||||
|
@@ -181,7 +187,7 @@ effectiveStdenv.mkDerivation ( | |||||||||
[ | ||||||||||
(cmakeBool "LLAMA_NATIVE" false) | ||||||||||
(cmakeBool "LLAMA_BUILD_SERVER" true) | ||||||||||
(cmakeBool "BUILD_SHARED_LIBS" true) | ||||||||||
(cmakeBool "BUILD_SHARED_LIBS" (!enableStatic)) | ||||||||||
(cmakeBool "CMAKE_SKIP_BUILD_RPATH" true) | ||||||||||
(cmakeBool "LLAMA_BLAS" useBlas) | ||||||||||
(cmakeBool "LLAMA_CLBLAST" useOpenCL) | ||||||||||
|
@@ -190,6 +196,7 @@ effectiveStdenv.mkDerivation ( | |||||||||
(cmakeBool "LLAMA_METAL" useMetalKit) | ||||||||||
(cmakeBool "LLAMA_MPI" useMpi) | ||||||||||
(cmakeBool "LLAMA_VULKAN" useVulkan) | ||||||||||
(cmakeBool "LLAMA_STATIC" enableStatic) | ||||||||||
] | ||||||||||
++ optionals useCuda [ | ||||||||||
( | ||||||||||
|
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.
Comment from line 47 needs to move up here, and the effectiveStdenv below needs to be removed, I think.
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 should be implemented and working now 👍