|
47 | 47 | from easybuild.easyblocks.generic.configuremake import ConfigureMake
|
48 | 48 | from easybuild.framework.easyconfig import CUSTOM
|
49 | 49 | from easybuild.tools.build_log import EasyBuildError
|
50 |
| -from easybuild.tools.config import build_option |
51 |
| -from easybuild.tools.filetools import apply_regex_substitutions, adjust_permissions, change_dir, copy_file |
| 50 | +from easybuild.tools.config import build_option, IGNORE |
| 51 | +from easybuild.tools.filetools import apply_regex_substitutions, adjust_permissions, change_dir, copy_file, search_file |
52 | 52 | from easybuild.tools.filetools import mkdir, move_file, read_file, symlink, which, write_file
|
53 | 53 | from easybuild.tools.modules import MODULE_LOAD_ENV_HEADERS, get_software_root
|
54 | 54 | from easybuild.tools.run import run_shell_cmd
|
@@ -677,13 +677,32 @@ def configure_step(self):
|
677 | 677 | # enable plugin support
|
678 | 678 | self.configopts += " --enable-plugins "
|
679 | 679 |
|
| 680 | + # Determine if ld.gold is available, as being slowly faded out with binutils 2.44 and newer. |
| 681 | + # If binutils is loaded, check for ld.gold inside of that installation. |
| 682 | + # If not loaded, check in $PATH, as binutils might have been filtered. |
| 683 | + binutils_has_ld_gold = False |
| 684 | + binutils_root = get_software_root('binutils') |
| 685 | + if binutils_root: |
| 686 | + _, hits = search_file([binutils_root], 'ld.gold') |
| 687 | + if hits: |
| 688 | + binutils_has_ld_gold = True |
| 689 | + elif which('ld.gold', on_error=IGNORE): |
| 690 | + binutils_has_ld_gold = True |
| 691 | + |
680 | 692 | # use GOLD as default linker, except on RISC-V (since it's not supported there)
|
681 | 693 | if get_cpu_family() == RISCV:
|
682 | 694 | self.configopts += " --disable-gold --enable-ld=default"
|
683 | 695 | elif self.cfg['use_gold_linker']:
|
| 696 | + if not binutils_has_ld_gold: |
| 697 | + raise EasyBuildError("Tried to set ld.gold as default linker, but ld.gold is not available.") |
684 | 698 | self.configopts += " --enable-gold=default --enable-ld --with-plugin-ld=ld.gold"
|
685 | 699 | else:
|
686 |
| - self.configopts += " --enable-gold --enable-ld=default" |
| 700 | + if binutils_has_ld_gold: |
| 701 | + self.configopts += " --enable-gold" |
| 702 | + else: |
| 703 | + self.log.debug("Disabling ld.gold, as is was not found") |
| 704 | + self.configopts += " --disable-gold" |
| 705 | + self.configopts += " --enable-ld=default" |
687 | 706 |
|
688 | 707 | # enable bootstrap build for self-containment (unless for staged build)
|
689 | 708 | if not self.stagedbuild:
|
@@ -789,6 +808,10 @@ def build_step(self):
|
789 | 808 | if lib == "gmp":
|
790 | 809 | cmd = "./configure --prefix=%s " % stage2prefix
|
791 | 810 | cmd += "--with-pic --disable-shared --enable-cxx "
|
| 811 | + # Force C99 during configure to avoid newer C standard |
| 812 | + # being used. This avoids inconsistencies between the configure |
| 813 | + # result and the build, where we force C99 via a patch. |
| 814 | + cmd += "CFLAGS=-std=c99 " |
792 | 815 |
|
793 | 816 | # ensure generic build when 'generic' is set to True or when --optarch=GENERIC is used
|
794 | 817 | # non-generic build can be enforced with generic=False if --optarch=GENERIC is used
|
|
0 commit comments