https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69757
Bug ID: 69757 Summary: OpenBSD requires -fPIC to build. Product: gcc Version: 4.9.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: edd at theunixzoo dot co.uk Target Milestone: --- Hi, Having worked around #69744, I am able to build GCC-4.9.3 on OpenBSD-5.8/amd64 but not a full bootstrap. If you build like this: ../configure \ --prefix=${wrkdir}/gcc-inst \ --disable-libcilkrts \ --program-transform-name=s,^,z, \ --verbose \ --disable-libmudflap \ --disable-libgomp \ --disable-tls \ --enable-languages=c,c++ \ --with-system-zlib \ --disable-tls \ --enable-threads=posix \ --enable-wchar_t \ --disable-libstdcxx-pch \ --enable-cpp \ --enable-shared \ || exit $? $MYMAKE -j1 || exit $? $MYMAKE -j1 install || exit $? You get an error like this: checking if /home/vext01/research/warmup_experiment/work/gcc/sd_build/./gcc/xgcc -B/home/vext01/research/warmup_experiment/work/gcc/sd_build/./gcc/ -B/home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/bin/ -B/home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/lib/ -isystem /home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/include -isystem /home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/sys-include supports -c -o file.o... (cached) yes checking whether the /home/vext01/research/warmup_experiment/work/gcc/sd_build/./gcc/xgcc -B/home/vext01/research/warmup_experiment/work/gcc/sd_build/./gcc/ -B/home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/bin/ -B/home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/lib/ -isystem /home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/include -isystem /home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/sys-include linker (/home/vext01/research/warmup_experiment/work/gcc/sd_build/./gcc/collect-ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... openbsd5.8 ld.so checking how to hardcode library paths into programs... immediate checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. Makefile:15357: recipe for target 'configure-stage1-target-libstdc++-v3' failed gmake[2]: *** [configure-stage1-target-libstdc++-v3] Error 1 gmake[2]: Leaving directory '/home/vext01/research/warmup_experiment/work/gcc/sd_build' Makefile:20466: recipe for target 'stage1-bubble' failed gmake[1]: *** [stage1-bubble] Error 2 gmake[1]: Leaving directory '/home/vext01/research/warmup_experiment/work/gcc/sd_build' Makefile:895: recipe for target 'all' failed gmake: *** [all] Error 2 If you dig deep enough, you will find that this is because -fPIC is required (at-least on amd64 it seems -- not sure about other architectures). The lack of -fPIC causes the macros originally defined in config/no_executables.m4 to fail in strange ways, even flipping cross_compiling=yes. You can get the build further by adding CFLAGS=-fPIC to the configure environment. Then the first stage boostrap succeeds, but the second stage fails: checking for msgmerge... no checking for x86_64-unknown-openbsd5.8-gcc... /home/vext01/research/warmup_experiment/work/gcc/sd_build/./prev-gcc/xgcc -B/home/vext01/research/warmup_experiment/work/gcc/sd_build/./prev-gcc/ -B/home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/bin/ -B/home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/bin/ -B/home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/lib/ -isystem /home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/include -isystem /home/vext01/research/warmup_experiment/work/gcc-inst/x86_64-unknown-openbsd5.8/sys-include checking for C compiler default output file name... configure: error: in `/home/vext01/research/warmup_experiment/work/gcc/sd_build/intl': configure: error: C compiler cannot create executables See `config.log' for more details. Makefile:9183: recipe for target 'configure-stage2-intl' failed This is in-fact the same issue. -fPIC was not passed onto the second stage bootstrap. If you pass --disable-bootstrap, the build succeeds and installs OK. Sadly I have not yet been able to figure out how to pass down -fPIC to the later bootstrap stages. I've tried BOOT_CFLAGS=fPIC and --enable-pic without any joy. Thanks