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

Build failure invalid use of '__builtin_va_arg_pack () #11

Open
nomeata opened this issue Sep 24, 2021 · 4 comments
Open

Build failure invalid use of '__builtin_va_arg_pack () #11

nomeata opened this issue Sep 24, 2021 · 4 comments

Comments

@nomeata
Copy link

nomeata commented Sep 24, 2021

I am trying to build svgcairo and I am running into this problem. This is on NixOS; I do not know yet if this is related to the issue:

$ LANG=C nix-shell -p ghc pkg-config  glib librsvg gtk3 --command "cabal install --env . --lib svgcairo --allow-newer Cabal"
Resolving dependencies...
Build profile: -w ghc-8.10.4 -O1
In order, the following will be built (use -v for more details):
 - svgcairo-0.13.2.1 (lib:svgcairo) (requires build)
Starting     svgcairo-0.13.2.1 (all, legacy fallback)
Building     svgcairo-0.13.2.1 (all, legacy fallback)

Failed to build svgcairo-0.13.2.1.
Build log (
/home/jojo/.cabal/logs/ghc-8.10.4/svgcairo-0.13.2.1-68a39d4f88dbd083ae6472f582970f652d6e266186a715acb905297992100bbb.log
):
[1 of 1] Compiling Main             ( /run/user/1000/cabal-install.-659504/dist-newstyle/tmp/src-659504/svgcairo-0.13.2.1/dist/setup/setup.hs, /run/user/1000/cabal-install.-659504/dist-newstyle/tmp/src-659504/svgcairo-0.13.2.1/dist/setup/Main.o )
Linking /run/user/1000/cabal-install.-659504/dist-newstyle/tmp/src-659504/svgcairo-0.13.2.1/dist/setup/setup ...
Warning: svgcairo.cabal:9:24: Packages with 'cabal-version: 1.12' or later
should specify a specific version of the Cabal spec of the form
'cabal-version: x.y'. Use 'cabal-version: 1.24'.
Configuring svgcairo-0.13.2.1...
Preprocessing library for svgcairo-0.13.2.1..
Building library for svgcairo-0.13.2.1..
[1 of 1] Compiling Graphics.Rendering.Cairo.SVG ( dist/build/Graphics/Rendering/Cairo/SVG.hs, dist/build/Graphics/Rendering/Cairo/SVG.o, dist/build/Graphics/Rendering/Cairo/SVG.dyn_o )
In file included from /nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/stdio.h:866,
                 from /nix/store/dlb3m1wyccb157yzfzjx9vpv6cgw212x-ghc-8.10.4/lib/ghc-8.10.4/include/rts/Flags.h:16,
                 from /nix/store/dlb3m1wyccb157yzfzjx9vpv6cgw212x-ghc-8.10.4/lib/ghc-8.10.4/include/rts/storage/GC.h:243,
                 from /nix/store/dlb3m1wyccb157yzfzjx9vpv6cgw212x-ghc-8.10.4/lib/ghc-8.10.4/include/Rts.h:210,

                 from /run/user/1000/ghc659813_0/ghc_3.c:2:0: error:
    
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function 'sprintf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:38:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
       38 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       39 |       __bos (__s), __fmt, __va_arg_pack ());
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   |
38 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
   |          ^
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function 'snprintf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:70:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
       70 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       71 |        __bos (__s), __fmt, __va_arg_pack ());
          |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   |
70 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
   |          ^
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function 'fprintf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:103:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
      103 |   return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      104 |    __va_arg_pack ());
          |    ~~~~~~~~~~~~~~~~~
    |
103 |   return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
    |          ^
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function 'printf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:110:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
      110 |   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |
110 |   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
    |          ^
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function 'dprintf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:147:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
      147 |   return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      148 |    __va_arg_pack ());
          |    ~~~~~~~~~~~~~~~~~
    |
147 |   return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
    |          ^
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function 'asprintf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:184:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
      184 |   return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      185 |     __va_arg_pack ());
          |     ~~~~~~~~~~~~~~~~~
    |
184 |   return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
    |          ^
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function '__asprintf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:192:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
      192 |   return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      193 |     __va_arg_pack ());
          |     ~~~~~~~~~~~~~~~~~
    |
192 |   return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
    |          ^
/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h: In function 'obstack_printf':

/nix/store/q141hd8jl7in5223jmf7kmx9h517km4p-glibc-2.32-54-dev/include/bits/stdio2.h:200:10: error:
     error: invalid use of '__builtin_va_arg_pack ()'
      200 |   return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      201 |           __va_arg_pack ());
          |           ~~~~~~~~~~~~~~~~~
    |
200 |   return __obstack_printf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt,
    |          ^
`cc' failed in phase `C Compiler'. (Exit code: 1)
cabal: Failed to build svgcairo-0.13.2.1. See the build log above for details.
@nomeata
Copy link
Author

nomeata commented Sep 24, 2021

Ok, seems to be related to glibc, according to NixOS/nixpkgs#19095, although that was fixed a while in the past

@nomeata
Copy link
Author

nomeata commented Sep 24, 2021

More digging reveals it’s related to nix’s hardening features. By building in an environment with hardening disabled, i.e.

$ cat shell.nix 
with import <nixpkgs> {};
stdenv.mkDerivation {
  name = "env";
  nativeBuildInputs = [
    bashInteractive
  ];
  buildInputs = [
    glibc
    ghc
    pkg-config
    glib
    librsvg
    gtk3
  ];
  hardeningDisable = ["all"];
}

(based on NixOS/nixpkgs#101979 (comment)) I can build.

@andreabedini
Copy link

I run into this also on Ubuntu 20.04.3

@andreabedini
Copy link

Fixing cpp-options solves it for me (as in #12)

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

No branches or pull requests

2 participants