Skip to content

Conversation

@bedroge
Copy link
Contributor

@bedroge bedroge commented Mar 5, 2024

This fixes an issue where building GCC on RISC-V will fail due to:

/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory
   27 | #include <bits/libc-header-start.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106271 and https://bugs.gentoo.org/890636.

Also depends on easybuilders/easybuild-easyblocks#3256.

@bedroge bedroge added bug fix EESSI Related to EESSI project riscv labels Mar 5, 2024
@boegel boegel added this to the release after 4.9.0 milestone Mar 5, 2024
@boegel
Copy link
Member

boegel commented Mar 5, 2024

@boegelbot please test @ generoso
CORE_CNT=16
EB_ARGS="--installpath /tmp/$USER/pr20035"

@boegelbot
Copy link
Collaborator

@boegel: Request for testing this PR well received on login1

PR test command 'EB_PR=20035 EB_ARGS="--installpath /tmp/$USER/pr20035" EB_CONTAINER= EB_REPO=easybuild-easyconfigs /opt/software/slurm/bin/sbatch --job-name test_PR_20035 --ntasks="16" ~/boegelbot/eb_from_pr_upload_generoso.sh' executed!

  • exit code: 0
  • output:
Submitted batch job 13022

Test results coming soon (I hope)...

- notification for comment with ID 1978383314 processed

Message to humans: this is just bookkeeping information for me,
it is of no use to you (unless you think I have a bug, which I don't).

@boegelbot
Copy link
Collaborator

Test report by @boegelbot
SUCCESS
Build succeeded for 5 out of 5 (5 easyconfigs in total)
cnx1 - Linux Rocky Linux 8.9, x86_64, Intel(R) Xeon(R) CPU E5-2667 v3 @ 3.20GHz (haswell), Python 3.6.8
See https://gist.github.com/boegelbot/3209b0bc21c6d6817b29667d76b0c3b6 for a full test report.

@bedroge
Copy link
Contributor Author

bedroge commented Mar 5, 2024

Test report by @bedroge
FAILED
Build succeeded for 0 out of 1 (1 easyconfigs in total)
starfive - Linux Debian GNU/Linux n/a, RISC-V-64, UNKNOWN, Python 3.10.9
See https://gist.github.com/bedroge/0e8b9884f2a3087b8d9fa5e361368e41 for a full test report.

@boegel
Copy link
Member

boegel commented Mar 6, 2024

@bedroge Can you try again on RISC-V using an updated config.guess (see easybuilders/easybuild-easyblocks#3013)?

@bedroge
Copy link
Contributor Author

bedroge commented Mar 6, 2024

@bedroge Can you try again on RISC-V using an updated config.guess (see easybuilders/easybuild-easyblocks#3013)?

I gave it a try, but unfortunately that didn't help. I'm still seeing this error in gcc-12.3.0/stage2_stuff/gmp/config.log:

configure:5926: checking compiler gcc -O2 -pedantic
Test compile:
configure:5940: gcc -O2 -pedantic  conftest.c >&5
/nvme/easybuild/software/binutils/2.40/bin/ld: cannot find -lgcc_s: No such file or directory
collect2: error: ld returned 1 exit status

@boegel
Copy link
Member

boegel commented Mar 8, 2024

@bedroge Could it be related to static linking? See riscv-collab/riscv-gnu-toolchain#970

@bedroge
Copy link
Contributor Author

bedroge commented Mar 8, 2024

@bedroge Could it be related to static linking? See riscv-collab/riscv-gnu-toolchain#970

Not sure. It's gcc itself (built in stage1) that's failing to find libgcc_s.so, even when compiling some very basic code without static linking. This doesn't find it either (it does in that issue you referred to):

/path/to/build/dir/GCC_stage1_eb/bin/gcc --print-file-name=libgcc_s.so
libgcc_s.so

This library is in the stage 1 installation (in the lib dir), and I can work around it by setting $LIBRARY_PATH to the same value as $LD_LIBRARY_PATH here:
https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/g/gcc.py#L617
Not sure why that's required here, and apparently not for other architectures.

@bedroge
Copy link
Contributor Author

bedroge commented Mar 10, 2024

This library is in the stage 1 installation (in the lib dir), and I can work around it by setting $LIBRARY_PATH to the same value as $LD_LIBRARY_PATH here: https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/g/gcc.py#L617 Not sure why that's required here, and apparently not for other architectures.

By setting $LIBRARY_PATH the installation did complete, but the sanity check failed with similar errors:

== 2024-03-08 19:36:02,598 build_log.py:171 ERROR EasyBuild crashed with an error (at easybuild/software/EasyBuild/4.9.0/lib/python3.10/site-packages/easybuild/base/exceptions.py:126 in __init__): Sanity check failed: no file found at 'lib64/libgomp-plugin-nvptx.so' or 'lib/libgomp-plugin-nvptx.so' or 'lib32/libgomp-plugin-nvptx.so' in /nvme/easybuild/software/GCCcore/12.3.0
sanity check command echo "int main(){} " | /nvme/easybuild/software/GCCcore/12.3.0/bin/gcc -x c -o/dev/null - exited with code 1 (output: /nvme/easybuild/software/binutils/2.40/bin/ld: cannot find -lgcc_s: No such file or directory
collect2: error: ld returned 1 exit status
)
sanity check command echo "int main(){} " | /nvme/easybuild/software/GCCcore/12.3.0/bin/gcc -x c -flto -fuse-linker-plugin -o/dev/null - exited with code 1 (output: /nvme/easybuild/software/binutils/2.40/bin/ld: cannot find -lgcc_s: No such file or directory
collect2: error: ld returned 1 exit status
)
sanity check command echo "int main(){} " | /nvme/easybuild/software/GCCcore/12.3.0/bin/g++ -x c++ -o/dev/null - exited with code 1 (output: /nvme/easybuild/software/binutils/2.40/bin/ld: cannot find -lstdc++: No such file or directory
/nvme/easybuild/software/binutils/2.40/bin/ld: cannot find -lgcc_s: No such file or directory
collect2: error: ld returned 1 exit status
)
sanity check command echo "int main(){} " | /nvme/easybuild/software/GCCcore/12.3.0/bin/g++ -x c++ -flto -fuse-linker-plugin -o/dev/null - exited with code 1 (output: /nvme/easybuild/software/binutils/2.40/bin/ld: cannot find -lstdc++: No such file or directory
/nvme/easybuild/software/binutils/2.40/bin/ld: cannot find -lgcc_s: No such file or directory
collect2: error: ld returned 1 exit status
) (at easybuild/software/EasyBuild/4.9.0/lib/python3.10/site-packages/easybuild/framework/easyblock.py:3661 in _sanity_check_step)

Both libstdc++.so and libgcc_s.so are in %(installdir)s/lib, though, so setting $LIBRARY_PATH in the module file will probably solve that again.
Regarding nvptx, I guess that should be disabled on RISC-V?

@bedroge bedroge marked this pull request as draft March 15, 2024 13:29
@bedroge bedroge marked this pull request as ready for review March 16, 2024 19:14
@bedroge
Copy link
Contributor Author

bedroge commented Mar 16, 2024

Test report by @bedroge
Using easyblocks from PR(s) easybuilders/easybuild-easyblocks#3256
SUCCESS
Build succeeded for 1 out of 1 (1 easyconfigs in total)
starfive - Linux Debian GNU/Linux n/a, RISC-V-64, UNKNOWN, Python 3.10.9
See https://gist.github.com/bedroge/9d8fbf60b231a61177866f69386719b4 for a full test report.

@boegel
Copy link
Member

boegel commented Mar 16, 2024

Test report by @boegel
Using easyblocks from PR(s) easybuilders/easybuild-easyblocks#3256
SUCCESS
Build succeeded for 8 out of 8 (5 easyconfigs in total)
node3515.doduo.os - Linux RHEL 8.8, x86_64, AMD EPYC 7552 48-Core Processor, Python 3.6.8
See https://gist.github.com/boegel/10e9383a704a33bbaa86ff4e5791cc7c for a full test report.

@bedroge
Copy link
Contributor Author

bedroge commented Mar 17, 2024

Test report by @bedroge
Using easyblocks from PR(s) easybuilders/easybuild-easyblocks#3256
SUCCESS
Build succeeded for 1 out of 1 (1 easyconfigs in total)
starfive - Linux Debian GNU/Linux n/a, RISC-V-64, UNKNOWN, Python 3.10.9
See https://gist.github.com/bedroge/63e1a0e5c4a31387a93c0b772cda7f03 for a full test report.

@boegel
Copy link
Member

boegel commented Mar 17, 2024

Going in, thanks @bedroge!

@boegel boegel merged commit 4b8d595 into easybuilders:develop Mar 17, 2024
@bedroge bedroge deleted the gcc_multiarch_riscv64 branch March 17, 2024 09:07
@boegel boegel changed the title add multiarch support for RISC-V to all GCCcore 12.x and 13.x easyconfigs add patch to fix multiarch support for RISC-V to all GCCcore 12.x and 13.x easyconfigs Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix EESSI Related to EESSI project riscv

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants