Skip to content
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

audiofile: fix static build #103270

Merged
merged 1 commit into from Nov 12, 2020
Merged

audiofile: fix static build #103270

merged 1 commit into from Nov 12, 2020

Conversation

expipiplus1
Copy link
Contributor

Fixes #103215

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@FRidh FRidh changed the base branch from master to staging November 10, 2020 09:29
@FRidh FRidh added this to WIP in Staging via automation Nov 10, 2020
@veprbl
Copy link
Member

veprbl commented Nov 12, 2020

This works for me:

diff --git a/pkgs/development/libraries/audiofile/default.nix b/pkgs/development/libraries/audiofile/default.nix
index 46c29e2fa12..4362aec7da6 100644
--- a/pkgs/development/libraries/audiofile/default.nix
+++ b/pkgs/development/libraries/audiofile/default.nix
@@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
   # fix build with gcc9
   NIX_CFLAGS_LINK = lib.optional (stdenv.system == "i686-linux") "-lgcc";
 
+  LIBTOOL_FLAGS = lib.optionalString stdenv.targetPlatform.isStatic "-static";
+
   patches = [
     ./gcc-6.patch
     ./CVE-2015-7747.patch

@veprbl
Copy link
Member

veprbl commented Nov 12, 2020

I suppose that line could even go into the adapter

NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static";
configureFlags = (args.configureFlags or []) ++ [
"--disable-shared" # brrr...

@expipiplus1
Copy link
Contributor Author

This works for me:

diff --git a/pkgs/development/libraries/audiofile/default.nix b/pkgs/development/libraries/audiofile/default.nix
index 46c29e2fa12..4362aec7da6 100644
--- a/pkgs/development/libraries/audiofile/default.nix
+++ b/pkgs/development/libraries/audiofile/default.nix
@@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
   # fix build with gcc9
   NIX_CFLAGS_LINK = lib.optional (stdenv.system == "i686-linux") "-lgcc";
 
+  LIBTOOL_FLAGS = lib.optionalString stdenv.targetPlatform.isStatic "-static";
+
   patches = [
     ./gcc-6.patch
     ./CVE-2015-7747.patch

Weird, doesn't work for me, I still have to keep both my hacks in

@expipiplus1
Copy link
Contributor Author

I suppose that line could even go into the adapter

NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static";
configureFlags = (args.configureFlags or []) ++ [
"--disable-shared" # brrr...

Yeah, makes sense.

@veprbl
Copy link
Member

veprbl commented Nov 12, 2020

Weird, doesn't work for me, I still have to keep both my hacks in

My bad, LIBTOOLFLAGS doesn't seem to work for me either. I think it makes sense to return to the original commit minus the static argument.

@expipiplus1
Copy link
Contributor Author

Weird, doesn't work for me, I still have to keep both my hacks in

My bad, LIBTOOLFLAGS doesn't seem to work for me either. I think it makes sense to return to the original commit minus the static argument.

done, thanks for the feedback :)

@Mic92 Mic92 merged commit 58388e6 into NixOS:staging Nov 12, 2020
Staging automation moved this from WIP to Done Nov 12, 2020
@expipiplus1 expipiplus1 deleted the joe-audiofile branch November 12, 2020 07:55
@expipiplus1
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Staging
  
Done
Development

Successfully merging this pull request may close these issues.

pkgsStatic.audiofile failes to compile
3 participants