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

Installation issue: gcc@4.8.5 #15229

Open
rountree opened this issue Feb 26, 2020 · 1 comment
Open

Installation issue: gcc@4.8.5 #15229

rountree opened this issue Feb 26, 2020 · 1 comment

Comments

@rountree
Copy link
Contributor

I have successfully installed gcc@develop, gcc@9.2.0 and gcc@9.1.0. gcc@4.8.5 fails.

$ spack install gcc@4.8.5 
...
/mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/spack-build/./gcc/xgcc -B/mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/spack-build/./gcc/ -B/mnt/ramdisk/spack/opt/spack/linux-ubuntu19.10-skylake/gcc-9.2.1/gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/x86_64-unknown-linux-gnu/bin/ -B/mnt/ramdisk/spack/opt/spack/linux-ubuntu19.10-skylake/gcc-9.2.1/gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/x86_64-unknown-linux-gnu/lib/ -isystem /mnt/ramdisk/spack/opt/spack/linux-ubuntu19.10-skylake/gcc-9.2.1/gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/x86_64-unknown-linux-gnu/include -isystem /mnt/ramdisk/spack/opt/spack/linux-ubuntu19.10-skylake/gcc-9.2.1/gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/x86_64-unknown-linux-gnu/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fpic -mlong-double-80 -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fpic -mlong-double-80 -I. -I. -I../.././gcc -I/mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/libgcc -I/mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/libgcc/. -I/mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/libgcc/../gcc -I/mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/libgcc/../include -I/mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -o emutls.o -MT emutls.o -MD -MP -MF emutls.dep -fexceptions -c /mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/libgcc/emutls.c -fvisibility=hidden -DHIDE_EXPORTS
In file included from /mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/libgcc/unwind-dw2.c:405:0:
./md-unwind-support.h: In function 'x86_64_fallback_frame_state':
./md-unwind-support.h:65:47: error: dereferencing pointer to incomplete type
       sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
                                               ^

A similar issue was reported against gcc here with fixes backported to gcc-7.1.1, gcc-6.5.0 and gcc-5.5.0.

A similar Issue also reported here: stackoverflow with the following diagnosis from Johnathan Wakely (not quite on point):

N.B. the problem has nothing to do with using GCC 7.2, it's caused by the recent version of glibc used by your Arch system. Glibc headers stopped declaring the non-standard name struct ucontext and now only use the ucontext_t typedef required by POSIX.

The version of xgcc used above is, of course, 4.8.5. However...

$ ldd /mnt/ramdisk/spack/var/spack/stage/rountree/spack-stage-gcc-4.8.5-u2oqtceckujbk3u4tsphayf3mfyboim3/spack-src/spack-build/./gcc/xgcc 
	linux-vdso.so.1 (0x00007ffc151ff000)
	libiconv.so.2 => /mnt/ramdisk/spack/opt/spack/linux-ubuntu19.10-skylake/gcc-9.2.1/libiconv-1.16-pauu3o43t7lav57d3zwjw5ze5uh6yek2/lib/libiconv.so.2 (0x00007f0aa285b000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0aa264f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f0aa2a58000)

I'm guessing that libc-6.0 is too new to build the ancient gcc-4.8.5, but I'm new enough to spack that I don't know how to go about forcing and older version of the library to be used instead.

A few other notes:

$ uname -a 
Linux Solvent 5.3.0-40-generic #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -d
Description:	Ubuntu 19.10

packages.yaml compilers.yaml are both unchanged from stock.

$ spack spec --install-status gcc@4.8.5
Input spec
--------------------------------
 -   gcc@4.8.5

Concretized
--------------------------------
 -   gcc@4.8.5%gcc@9.2.1~binutils languages=c,c++,fortran ~nvptx patches=0689c26bd7f38c5c9594eb8a4932ae7fce96cc8796c45839e050dc42c83112f1 ~piclibs~strip arch=linux-ubuntu19.10-skylake
[+]      ^gmp@6.1.2%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]          ^autoconf@2.69%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]              ^m4@1.4.18%gcc@9.2.1 patches=3877ab548f88597ab2327a2230ee048d2d07ace1062efe81fc92e91b7f39cd00,fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8 +sigsegv arch=linux-ubuntu19.10-skylake
[+]                  ^libsigsegv@2.12%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]              ^perl@5.30.0%gcc@9.2.1+cpanm+shared+threads arch=linux-ubuntu19.10-skylake
[+]                  ^gdbm@1.18.1%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]                      ^readline@8.0%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]                          ^ncurses@6.1%gcc@9.2.1~symlinks~termlib arch=linux-ubuntu19.10-skylake
[+]                              ^pkgconf@1.6.3%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]          ^automake@1.16.1%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]          ^libtool@2.4.6%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]      ^libiconv@1.16%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]      ^mpc@1.1.0%gcc@9.2.1 arch=linux-ubuntu19.10-skylake
[+]          ^mpfr@3.1.6%gcc@9.2.1 patches=66a5d58364113a21405fc53f4a48f4e8 arch=linux-ubuntu19.10-skylake
@romintomasetti
Copy link

romintomasetti commented Apr 13, 2021

Step 0

I tested in a fresh Ubuntu 20 docker image (installing gcc g++ gfortran make curl)

* **Spack:** 0.16.1-2184-6c632dad71
* **Python:** 3.8.5
* **Platform:** linux-ubuntu20.04-skylake
* **Concretizer:** original

Step 1

  • spack install gcc@4.8.5 ends up in the error mentioned above.

Step 2

     29738    echo INHIBIT_LIBC_CFLAGS = '' >> tmp-libgcc.mvars
  >> 29739    xgcc: error trying to exec 'cc1': execvp: No such file or directory
     29740    echo TARGET_SYSTEM_ROOT = '' >> tmp-libgcc.mvars

Here is the full log:
spack-build-out.txt

Note This patch is already in spack under ucontext_t.patch.

Step 3

I tried to make it with a single thread (-j1) and the error is

     31845    checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
     31846    checking for gawk... mawk
     31847    checking whether make sets $(MAKE)... yes
     31848    checking whether to enable maintainer-specific portions of Makefiles... no
     31849    checking for x86_64-unknown-linux-gnu-gcc... /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2
              nbn6/spack-src/spack-build/./gcc/xgcc -B/tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/
              spack-src/spack-build/./gcc/ -B/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.3.0/gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmt
              iyft2nbn6/x86_64-unknown-linux-gnu/bin/ -B/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.3.0/gcc-4.8.5-4uzyfcq4bzbt
              3txtvwqflmtiyft2nbn6/x86_64-unknown-linux-gnu/lib/ -isystem /spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.3.0/gcc-
              4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/x86_64-unknown-linux-gnu/include -isystem /spack/opt/spack/linux-ubuntu20.04-s
              kylake/gcc-9.3.0/gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/x86_64-unknown-linux-gnu/sys-include
     31850    checking for C compiler default output file name...
  >> 31851    configure: error: in `/tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/spack-bu
              ild/x86_64-unknown-linux-gnu/libsanitizer':
  >> 31852    configure: error: C compiler cannot create executables
     31853    See `config.log' for more details.
     31854    make[2]: *** [Makefile:13896: configure-stage1-target-libsanitizer] Error 77
     31855    make[2]: Leaving directory '/tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/sp
              ack-build'
     31856    make[1]: *** [Makefile:19785: stage1-bubble] Error 2
     31857    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/sp
              ack-build'
     31858    make: *** [Makefile:886: all] Error 2

Here is the config.log from /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/spack-build/x86_64-unknown-linux-gnu/libsanitizer/
config.log
and a relevant extract from this file is

/tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/spack-build/./gcc/cc1: /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/spack-build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/spack-build/./gcc/cc1)

which is awaited as

strings /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/spack-build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1
CXXABI_1.3
CXXABI_1.3.2
CXXABI_1.3.6
CXXABI_1.3.1
CXXABI_1.3.5
CXXABI_1.3.4
CXXABI_TM_1
CXXABI_1.3.7
CXXABI_1.3.3

this ABI is indeed not present.

Step 4

So I've tried preloading as suggested in https://hpc-discourse.usc.edu/t/usr-lib64-libstdc-so-6-too-old/171/4:

root@93c78c74120b:/spack# LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./bin/spack install -v -j1 gcc@4.8.5

but it failed with

32091    /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/libsanitizer/asan/asan_linux.cc: In function 'bool __asan::AsanInterceptsSignal(int)':
  >> 32092    /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/libsanitizer/asan/asan_linux.cc:95:20: error: 'SIGSEGV' was not declared in this scope
     32093       return signum == SIGSEGV && flags()->handle_segv;
     32094                        ^
     32095    /tmp/root/spack-stage/spack-stage-gcc-4.8.5-4uzyfcq4bzbt3txtvwqflmtiyft2nbn6/spack-src/libsanitizer/asan/asan_linux.cc:96:1: warning: control reaches end of non-void function [-Wreturn-typ
              e]
     32096     }
     32097     ^
     32098    make[4]: *** [Makefile:441: asan_linux.lo] Error 1

so I'll try the patch suggested in https://patchwork.ozlabs.org/project/gcc/patch/6824253.3U2boEivI2@devpool21/.

Note In fact this patch is already in spack under signal.patch.

Step 5

I applied the patch https://patchwork.ozlabs.org/project/gcc/patch/6824253.3U2boEivI2@devpool21/ and again it failed

32171    /tmp/root/spack-stage/spack-stage-gcc-4.8.5-n4s2pbg3distxn6uzewvzqf3eck7x2su/spack-src/libsanitizer/tsan/tsan_platform_linux.cc: In function 'int __tsan::ExtractResolvFDs(void*, int*, int)
              ':
  >> 32172    /tmp/root/spack-stage/spack-stage-gcc-4.8.5-n4s2pbg3distxn6uzewvzqf3eck7x2su/spack-src/libsanitizer/tsan/tsan_platform_linux.cc:295:16: error: 'statp' was not declared in this scope
     32173       __res_state *statp = (__res_state*)state;
     32174                    ^
  >> 32175    /tmp/root/spack-stage/spack-stage-gcc-4.8.5-n4s2pbg3distxn6uzewvzqf3eck7x2su/spack-src/libsanitizer/tsan/tsan_platform_linux.cc:295:37: error: expected primary-expression before ')' token
     32176       __res_state *statp = (__res_state*)state;
     32177                                         ^
  >> 32178    /tmp/root/spack-stage/spack-stage-gcc-4.8.5-n4s2pbg3distxn6uzewvzqf3eck7x2su/spack-src/libsanitizer/tsan/tsan_platform_linux.cc:295:38: error: expected ';' before 'state'
     32179       __res_state *statp = (__res_state*)state;
     32180                                          ^
     32181    make[4]: *** [Makefile:475: tsan_platform_linux.lo] Error 1

Successful step

In the end, starting from scratch:

  • package.py modified to add:
    patch('ucontext_t-4.8.patch',when='@4.8.5 os=ubuntu20.04')
    patch('signal.patch',when='@4.8.5 os=ubuntu20.04')
    patch('stack_t-4.8.patch', when='@4.8 os=ubuntu20.04')

It works only with the preload:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 spack install gcc@4.8.5

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

No branches or pull requests

2 participants