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

Fix for building GCC with --sysroot on ppc64le #2315

Merged
merged 3 commits into from
Feb 17, 2021

Conversation

bedroge
Copy link
Contributor

@bedroge bedroge commented Jan 25, 2021

When using --sysroot (and --rpath) on ppc64le (and possibly more PowerPC systems), the dynamic linker does not get injected into executables correctly: it will pick up the one from the host, instead of the one from the sysroot location.

I ran into the same issue when building Gentoo Prefix on a ppc64le system, see:
https://bugs.gentoo.org/755551

The proposed fix there solved that issue, see here for an extensive description of the cause and solution:
https://755551.bugs.gentoo.org/attachment.cgi?id=684058

So I'm now including a similar fix here.

@bedroge
Copy link
Contributor Author

bedroge commented Jan 25, 2021

Still marked as draft, as I still need to verify that this indeed works on my POWER9 system.

@bedroge
Copy link
Contributor Author

bedroge commented Jan 25, 2021

Tested it on a POWER9 system. and it solved the issue.

== temporary log file in case of crash /tmp/eb-5dzgmoek/easybuild-jp6bd5_v.log
  >> running command:
	[started at: 2021-01-25 16:07:20]
	[working dir: /tmp/eb-5dzgmoek/tmpd7di3qop/easybuilders]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-mnnstpp_.log]
	tar xzf /tmp/eb-5dzgmoek/tmpd7di3qop/easybuilders/develop.tar.gz
  >> command completed: exit 0, ran in < 1s
== easyblock gcc.py included from PR #2315
== found valid index for /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/EasyBuild/4.3.2/easybuild/easyconfigs, so using it...
== resolving dependencies ...
== found valid index for /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/EasyBuild/4.3.2/easybuild/easyconfigs, so using it...
== processing EasyBuild easyconfig /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/EasyBuild/4.3.2/easybuild/easyconfigs/g/GCCcore/GCCcore-9.3.0.eb
== building and installing GCCcore/9.3.0...
  >> installation prefix: /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/GCCcore/9.3.0
== fetching files...
  >> sources:
  >> /tmp/centos/easybuild/sources/g/GCCcore/gcc-9.3.0.tar.gz [SHA256: 5258a9b6afe9463c2e56b9e8355b1a4bee125ca828b8078f910303bc2ef91fa6]
  >> /tmp/centos/easybuild/sources/g/GCCcore/gmp-6.2.0.tar.bz2 [SHA256: f51c99cb114deb21a60075ffb494c1a210eb9d7cb729ed042ddb7de9534451ea]
  >> /tmp/centos/easybuild/sources/g/GCCcore/mpfr-4.0.2.tar.bz2 [SHA256: c05e3f02d09e0e9019384cdd58e0f19c64e6db1fd6f5ecf77b4b1c61ca253acc]
  >> /tmp/centos/easybuild/sources/g/GCCcore/mpc-1.1.0.tar.gz [SHA256: 6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e]
  >> /tmp/centos/easybuild/sources/g/GCCcore/isl-0.22.1.tar.bz2 [SHA256: 1a668ef92eb181a7c021e8531a3ca89fd71aa1b3744db56f68365ab0a224c5cd]
  >> patches:
  >> /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/EasyBuild/4.3.2/easybuild/easyconfigs/g/GCCcore/GCCcore-6.2.0-fix-find-isl.patch [SHA256: 5ad909606d17d851c6ad629b4fddb6c1621844218b8d139fed18c502a7696c68]
  >> /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/EasyBuild/4.3.2/easybuild/easyconfigs/g/GCCcore/GCCcore-9.3.0_gmp-c99.patch [SHA256: 0e135e1cc7cec701beea9d7d17a61bab34cfd496b4b555930016b98db99f922e]
== creating build dir, resetting environment...
  >> build dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system
== unpacking...
  >> running command:
	[started at: 2021-01-25 16:07:31]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-revodbt6.log]
	tar xzf /tmp/centos/easybuild/sources/g/GCCcore/gcc-9.3.0.tar.gz
  >> command completed: exit 0, ran in 00h00m19s
  >> running command:
	[started at: 2021-01-25 16:07:50]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-kjzhicow.log]
	tar xjf /tmp/centos/easybuild/sources/g/GCCcore/gmp-6.2.0.tar.bz2
  >> command completed: exit 0, ran in 00h00m01s
  >> running command:
	[started at: 2021-01-25 16:07:51]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-yt_1salv.log]
	tar xjf /tmp/centos/easybuild/sources/g/GCCcore/mpfr-4.0.2.tar.bz2
  >> command completed: exit 0, ran in 00h00m01s
  >> running command:
	[started at: 2021-01-25 16:07:53]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-wjnyqz26.log]
	tar xzf /tmp/centos/easybuild/sources/g/GCCcore/mpc-1.1.0.tar.gz
  >> command completed: exit 0, ran in < 1s
  >> running command:
	[started at: 2021-01-25 16:07:53]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-bd4962vp.log]
	tar xjf /tmp/centos/easybuild/sources/g/GCCcore/isl-0.22.1.tar.bz2
  >> command completed: exit 0, ran in < 1s
== patching...
  >> applying patch GCCcore-6.2.0-fix-find-isl.patch
  >> applying patch GCCcore-9.3.0_gmp-c99.patch
== preparing...
== configuring...
  >> running command:
	[started at: 2021-01-25 16:07:55]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage1_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-z7gbzvn2.log]
	/tmp/centos/easybuild/sources/generic/eb_v4.3.2/ConfigureMake/config.guess
  >> command completed: exit 0, ran in < 1s
  >> running command:
	[started at: 2021-01-25 16:07:55]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage1_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-iubtuxqf.log]
	../configure   --with-sysroot=/cvmfs/pilot.eessi-hpc.org/2020.12/compat/linux/ppc64le  --enable-languages=c,c++,fortran --enable-lto --enable-checking=release  --disable-multilib --enable-shared=yes --enable-static=yes  --enable-threads=posix  --enable-plugins  --enable-gold=default --enable-ld --with-plugin-ld=ld.gold  --disable-bootstrap --prefix=/tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/GCC_stage1_eb --with-local-prefix=/tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/GCC_stage1_eb --build=powerpc64le-unknown-linux-gnu --host=powerpc64le-unknown-linux-gnu
  >> command completed: exit 0, ran in 00h00m12s
== building...
  >> running command:
	[started at: 2021-01-25 16:08:07]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage1_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-29jxs5tg.log]
	make -j 8
  >> command completed: exit 0, ran in 00h32m55s
  >> running command:
	[started at: 2021-01-25 16:41:05]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage1_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-y87p55tm.log]
	make install
  >> command completed: exit 0, ran in 00h01m41s
  >> running command:
	[started at: 2021-01-25 16:42:48]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/gmp]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-1jah5kkb.log]
	/tmp/centos/easybuild/sources/generic/eb_v4.3.2/ConfigureMake/config.guess
  >> command completed: exit 0, ran in < 1s
  >> running command:
	[started at: 2021-01-25 16:42:48]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/gmp]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-d9m509k3.log]
	./configure --prefix=/tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff --with-pic --disable-shared --enable-cxx  --build=powerpc64le-unknown-linux-gnu --host=powerpc64le-unknown-linux-gnu
  >> command completed: exit 0, ran in 00h01m18s
  >> running command:
	[started at: 2021-01-25 16:44:07]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/gmp]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-ht9_xtm9.log]
	make -j 8
  >> command completed: exit 0, ran in 00h00m51s
  >> running command:
	[started at: 2021-01-25 16:44:58]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/gmp]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-klxdgam7.log]
	make install
  >> command completed: exit 0, ran in 00h00m01s
  >> running command:
	[started at: 2021-01-25 16:45:00]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/isl]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-e682f15w.log]
	/tmp/centos/easybuild/sources/generic/eb_v4.3.2/ConfigureMake/config.guess
  >> command completed: exit 0, ran in < 1s
  >> running command:
	[started at: 2021-01-25 16:45:00]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/isl]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-m_2oqs4r.log]
	./configure --prefix=/tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff --with-pic --disable-shared --with-gmp=system --with-gmp-prefix=/tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff  --build=powerpc64le-unknown-linux-gnu --host=powerpc64le-unknown-linux-gnu
  >> command completed: exit 0, ran in 00h00m19s
  >> running command:
	[started at: 2021-01-25 16:45:20]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/isl]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-ay087kzy.log]
	make -j 8
  >> command completed: exit 0, ran in 00h00m26s
  >> running command:
	[started at: 2021-01-25 16:45:47]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff/isl]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-lkz6prtu.log]
	make install
  >> command completed: exit 0, ran in 00h00m01s
  >> running command:
	[started at: 2021-01-25 16:45:48]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage3_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-otzzuemc.log]
	/tmp/centos/easybuild/sources/generic/eb_v4.3.2/ConfigureMake/config.guess
  >> command completed: exit 0, ran in < 1s
  >> running command:
	[started at: 2021-01-25 16:45:48]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage3_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-zphv2uh1.log]
	../configure  --with-sysroot=/cvmfs/pilot.eessi-hpc.org/2020.12/compat/linux/ppc64le  --enable-languages=c,c++,fortran --enable-lto --enable-checking=release  --disable-multilib --enable-shared=yes --enable-static=yes  --enable-threads=posix  --enable-plugins  --enable-gold=default --enable-ld --with-plugin-ld=ld.gold  --prefix=/cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/GCCcore/9.3.0 --with-local-prefix=/cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/GCCcore/9.3.0 --enable-bootstrap --with-isl=/tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage2_stuff  --build=powerpc64le-unknown-linux-gnu --host=powerpc64le-unknown-linux-gnu
  >> command completed: exit 0, ran in 00h00m08s
  >> running command:
	[started at: 2021-01-25 16:45:56]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage3_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-ku22cwyg.log]
	make -j 8  bootstrap
  >> command completed: exit 0, ran in 01h28m24s
== testing...
== installing...
  >> running command:
	[started at: 2021-01-25 18:14:27]
	[working dir: /tmp/centos/easybuild/build/GCCcore/9.3.0/system-system/gcc-9.3.0/stage3_obj]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-l4e84eq1.log]
	make install
  >> command completed: exit 0, ran in 00h01m18s
== taking care of extensions...
== restore after iterating...
== postprocessing...
== sanity checking...
  >> file 'bin/gcov' found: OK
  >> file 'bin/cpp' found: OK
  >> file 'bin/gcc' found: OK
  >> file 'bin/c++' found: OK
  >> file 'bin/g++' found: OK
  >> file 'bin/gfortran' found: OK
  >> file 'lib64/libgcc_s.so' or 'lib/libgcc_s.so' or 'lib32/libgcc_s.so' found: OK
  >> file 'lib64/libasan.so' or 'lib/libasan.so' or 'lib32/libasan.so' found: OK
  >> file 'lib64/libasan.a' or 'lib/libasan.a' or 'lib32/libasan.a' found: OK
  >> file 'lib64/libstdc++.so' or 'lib/libstdc++.so' or 'lib32/libstdc++.so' found: OK
  >> file 'lib64/libstdc++.a' or 'lib/libstdc++.a' or 'lib32/libstdc++.a' found: OK
  >> file 'lib64/libgfortran.so' or 'lib/libgfortran.so' or 'lib32/libgfortran.so' found: OK
  >> file 'lib64/libgfortran.a' or 'lib/libgfortran.a' or 'lib32/libgfortran.a' found: OK
  >> file 'libexec/gcc/powerpc64le-unknown-linux-gnu/9.3.0/lto1' or 'lib/gcc/powerpc64le-unknown-linux-gnu/9.3.0/lto1' found: OK
  >> file 'libexec/gcc/powerpc64le-unknown-linux-gnu/9.3.0/lto-wrapper' or 'lib/gcc/powerpc64le-unknown-linux-gnu/9.3.0/lto-wrapper' found: OK
  >> file 'libexec/gcc/powerpc64le-unknown-linux-gnu/9.3.0/liblto_plugin.so' or 'lib/gcc/powerpc64le-unknown-linux-gnu/9.3.0/liblto_plugin.so' found: OK
  >> file 'bin/cc' found: OK
  >> file 'bin/c++' found: OK
  >> file 'bin/f77' found: OK
  >> file 'bin/f95' found: OK
  >> (non-empty) directory 'lib/gcc/powerpc64le-unknown-linux-gnu/9.3.0' found: OK
  >> (non-empty) directory 'include/c++/9.3.0' found: OK
== cleaning up...
== creating module...
  >> generating module file @ /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/modules/all/GCCcore/9.3.0.lua
== permissions...
== packaging...
  >> running command:
	[started at: 2021-01-25 18:16:27]
	[working dir: /swlayer]
	[output logged in /tmp/eb-5dzgmoek/easybuild-run_cmd-ik0nioin.log]
	bzip2 /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/GCCcore/9.3.0/easybuild/easybuild-GCCcore-9.3.0-20210125.181627.log
  >> command completed: exit 0, ran in 00h00m13s
== COMPLETED: Installation ended successfully (took 2 hours 9 min 18 sec)
== Results of the build can be found in the log file(s) /cvmfs/pilot.eessi-hpc.org/2020.12/software/ppc64le/power9le/software/GCCcore/9.3.0/easybuild/easybuild-GCCcore-9.3.0-20210125.181627.log.bz2

This shows that the regex replaced the right thing:

== 2021-01-25 16:07:54,336 filetools.py:1387 INFO Replacing line 252 in gcc/config/rs6000/linux64.h: 'DYNAMIC_LINKER_PREFIX	""' -> '\1"/cvmfs/pilot.eessi-hpc.org/2020.12/compat/linux/ppc64le"'

@bedroge bedroge marked this pull request as ready for review January 25, 2021 18:48
@boegel boegel added the bug fix label Feb 3, 2021
@boegel boegel added this to the next release (4.3.3?) milestone Feb 3, 2021
@boegel boegel changed the title Fix for using GCC with --sysroot on ppc64le Fix for building GCC with --sysroot on ppc64le Feb 3, 2021
@boegel
Copy link
Member

boegel commented Feb 17, 2021

Test report by @boegel

Overview of tested easyconfigs (in order)

  • SUCCESS GCCcore-4.9.3.eb
  • SUCCESS GCCcore-6.3.0.eb
  • SUCCESS GCCcore-7.3.0.eb

Build succeeded for 3 out of 3 (3 easyconfigs in total)
node3108.skitty.os - Linux centos linux 7.9.2009, x86_64, Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz, Python 3.6.8
See https://gist.github.com/85195323d0f89929d4c82565f98a2615 for a full test report.

@boegel
Copy link
Member

boegel commented Feb 17, 2021

Test report by @boegel

Overview of tested easyconfigs (in order)

  • SUCCESS GCCcore-10.2.0.eb
  • SUCCESS GCCcore-8.3.0.eb
  • SUCCESS GCCcore-9.3.0.eb

Build succeeded for 3 out of 3 (3 easyconfigs in total)
node2614.swalot.os - Linux centos linux 7.9.2009, x86_64, Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz (haswell), Python 3.6.8
See https://gist.github.com/afd61f13a3fd31cd0b1514044db27d03 for a full test report.

@boegel
Copy link
Member

boegel commented Feb 17, 2021

Test report by @boegel

Overview of tested easyconfigs (in order)

  • SUCCESS GCCcore-9.3.0.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
node3401.kirlia.os - Linux UNKNOWN UNKNOWN, x86_64, Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz (cascadelake), Python 3.8.7
See https://gist.github.com/6072c34cb5ba1b23e13ab4964a049bcd for a full test report.

edit: this was tested in a --sysroot configuration

@boegel
Copy link
Member

boegel commented Feb 17, 2021

Test report by @boegel

Overview of tested easyconfigs (in order)

  • SUCCESS GCCcore-8.3.0.eb
  • SUCCESS GCCcore-9.3.0.eb
  • SUCCESS GCCcore-10.2.0.eb

Build succeeded for 3 out of 3 (3 easyconfigs in total)
easybuild2.novalocal - Linux centos linux 8.3.2011, POWER, IBM pSeries (emulated by qemu) (power9le), Python 3.6.8
See https://gist.github.com/53661bfc45a54906e9b5974686900002 for a full test report.

@boegel
Copy link
Member

boegel commented Feb 17, 2021

Test report by @boegel

Overview of tested easyconfigs (in order)

  • SUCCESS GCCcore-9.3.0.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
easybuild2.novalocal - Linux UNKNOWN UNKNOWN, POWER, IBM pSeries (emulated by qemu) (power9le), Python 3.8.7
See https://gist.github.com/45bc0e7165250cc02fd110f1ed1eccd0 for a full test report.

edit: this was tested in a --sysroot configuration

Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@boegel boegel merged commit ffc9105 into easybuilders:develop Feb 17, 2021
@bedroge bedroge deleted the fix_gcc_rs6000_sysroot branch February 17, 2021 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants