Skip to content

rts/RtsSymbols.c:63:27: conflicting types for ‘environ’ with glibc-2.34

When building https://downloads.haskell.org/ghc/9.2.1/ghc-9.2.1-src.tar.xz (of Oct-28) with "make", I get the following error Fedora GNU/Linux 35 only (works on F34, and on Debian 11)

my system:

$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 8.10.7
$ gcc --version
gcc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)
$ uname -a
Linux ... 5.14.11-300.fc35.x86_64 #1 SMP Sun Oct 10 14:36:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

build error:

"inplace/bin/ghc-stage1" -optc-Wall -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-Wno-aggregate-return -optc-Iincludes -optc-Iincludes/dist -optc-Iincludes/dist-derivedconstants/header -optc-Iincludes/dist-ghcconstants/header -optc-Iincludes/dist-install/build -optc-Irts -optc-Irts/dist/build -optc-DCOMPILING_RTS -optc-DFS_NAMESPACE=rts -optc-fno-strict-aliasing -optc-fno-common -optc-Irts/dist/build/./autogen -optc-Werror=unused-but-set-variable -optc-Wno-error=inline -optc-O2 -optc-fomit-frame-pointer -optc-g -optc-DRtsWay=\"rts_v\" -optc-ffunction-sections -optc-fdata-sections -static  -H32m -O -Wall  -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Iincludes/dist-install/build -Irts -Irts/dist/build -DCOMPILING_RTS -DFS_NAMESPACE=rts -this-unit-id rts -dcmm-lint     -package-env - -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen            -O2 -Wcpp-undef   -Wnoncanonical-monad-instances  -c rts/RtsSymbols.c -o rts/dist/build/RtsSymbols.o

rts/RtsSymbols.c:63:27: error:
     error: conflicting types for ‘environ’; have ‘StgWord[]’ {aka ‘long unsigned int[]’}
       63 |       SymI_NeedsDataProto(environ)              \
          |                           ^~~~~~~
   |
63 |       SymI_NeedsDataProto(environ)              \
   |                           ^

rts/RtsSymbols.c:1067:50: error:
     note: in definition of macro ‘SymI_NeedsDataProto’
     1067 | #define SymI_NeedsDataProto(vvv)  extern StgWord vvv[];
          |                                                  ^~~
     |
1067 | #define SymI_NeedsDataProto(vvv)  extern StgWord vvv[];
     |                                                  ^

rts/RtsSymbols.c:1087:1: error:
     note: in expansion of macro ‘RTS_POSIX_ONLY_SYMBOLS’
     1087 | RTS_POSIX_ONLY_SYMBOLS
          | ^~~~~~~~~~~~~~~~~~~~~~
     |
1087 | RTS_POSIX_ONLY_SYMBOLS
     | ^
In file included from /usr/include/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from rts/posix/Signals.h:12,

                 from rts/RtsSymbols.c:21:0: error: 

/usr/include/unistd.h:566:15: error:
     note: previous declaration of ‘environ’ with type ‘char **’
      566 | extern char **environ;
          |               ^~~~~~~
    |
566 | extern char **environ;
    |               ^
`cc' failed in phase `C Compiler'. (Exit code: 1)
make[1]: *** [rts/ghc.mk:345: rts/dist/build/RtsSymbols.o] Error 1
make: *** [Makefile:128: all] Error 2

The build goes fine (on this machine) for ghc-9.2.0.20210821 (9.2.1-rc1)

Edited by Jens Petersen
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information