As noted in this downstream bug: https://bugzilla.redhat.com/show_bug.cgi?id=1566178 libgccjit does not honor --with-gcc-major-version. Specifically, gcc/configure.ac does not use get_gcc_base_ver when generating gcc-driver-name.h, hence GCC_DRIVER_NAME contains the wrong value when --with-gcc-major-version is used. This leads to link errors as reported in that bug, when using the default embedded driver, and to the driver not being found when using: gcc_jit_context_set_bool_use_external_driver (ctxt, 1); Affects trunk and gcc-7-branch. I'm about to submit a candidate fix.
gcc_get_base_ver is meant for uses in Makefiles (which is why it uses $$), so it can't be easily used in a shell script.
Candidate patch: https://gcc.gnu.org/ml/gcc-patches/2018-04/msg00638.html
Author: jakub Date: Wed Apr 18 09:46:58 2018 New Revision: 259462 URL: https://gcc.gnu.org/viewcvs?rev=259462&root=gcc&view=rev Log: PR jit/85384 * acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression. * configure.ac (gcc-driver-name.h): Honor --with-gcc-major-version by using gcc_base_ver to generate a gcc_driver_version, and use it when generating GCC_DRIVER_NAME. * configure: Regenerate. * configure: Regenerate. Modified: trunk/config/ChangeLog trunk/config/acx.m4 trunk/fixincludes/ChangeLog trunk/fixincludes/configure trunk/gcc/ChangeLog trunk/gcc/configure trunk/gcc/configure.ac trunk/libada/ChangeLog trunk/libada/configure trunk/libatomic/ChangeLog trunk/libatomic/configure trunk/libcc1/ChangeLog trunk/libcc1/configure trunk/libffi/ChangeLog trunk/libffi/configure trunk/libgcc/ChangeLog trunk/libgcc/configure trunk/libgfortran/ChangeLog trunk/libgfortran/configure trunk/libgomp/ChangeLog trunk/libgomp/configure trunk/libhsail-rt/ChangeLog trunk/libhsail-rt/configure trunk/libitm/ChangeLog trunk/libitm/configure trunk/libmpx/ChangeLog trunk/libmpx/configure trunk/libobjc/ChangeLog trunk/libobjc/configure trunk/liboffloadmic/ChangeLog trunk/liboffloadmic/configure trunk/liboffloadmic/plugin/configure trunk/libquadmath/ChangeLog trunk/libquadmath/configure trunk/libsanitizer/ChangeLog trunk/libsanitizer/configure trunk/libssp/ChangeLog trunk/libssp/configure trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/configure trunk/libvtv/ChangeLog trunk/libvtv/configure trunk/lto-plugin/ChangeLog trunk/lto-plugin/configure
Richard prefered David's patch and we have some sed invocations that expect s/something.*// to match everything until end of line in gcc/Makefile.in, so if some sed versions don't do it, it would break other things. So, fixed for GCC8+ so far, should be backported to 7 at some point.
Author: jakub Date: Fri Jun 22 21:16:41 2018 New Revision: 261957 URL: https://gcc.gnu.org/viewcvs?rev=261957&root=gcc&view=rev Log: 2018-06-22 Jakub Jelinek <jakub@redhat.com> Backported from mainline 2018-04-18 David Malcolm <dmalcolm@redhat.com> PR jit/85384 * acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression. * configure.ac (gcc-driver-name.h): Honor --with-gcc-major-version by using gcc_base_ver to generate a gcc_driver_version, and use it when generating GCC_DRIVER_NAME. * configure: Regenerate. * configure: Regenerate. Modified: branches/gcc-7-branch/ChangeLog branches/gcc-7-branch/config/ChangeLog branches/gcc-7-branch/config/acx.m4 branches/gcc-7-branch/configure branches/gcc-7-branch/fixincludes/ChangeLog branches/gcc-7-branch/fixincludes/configure branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/configure branches/gcc-7-branch/gcc/configure.ac branches/gcc-7-branch/libada/ChangeLog branches/gcc-7-branch/libada/configure branches/gcc-7-branch/libatomic/ChangeLog branches/gcc-7-branch/libatomic/configure branches/gcc-7-branch/libcc1/ChangeLog branches/gcc-7-branch/libcc1/configure branches/gcc-7-branch/libcilkrts/ChangeLog branches/gcc-7-branch/libcilkrts/configure branches/gcc-7-branch/libffi/ChangeLog branches/gcc-7-branch/libffi/configure branches/gcc-7-branch/libgcc/ChangeLog branches/gcc-7-branch/libgcc/configure branches/gcc-7-branch/libgfortran/ChangeLog branches/gcc-7-branch/libgfortran/configure branches/gcc-7-branch/libgomp/ChangeLog branches/gcc-7-branch/libgomp/configure branches/gcc-7-branch/libhsail-rt/ChangeLog branches/gcc-7-branch/libhsail-rt/configure branches/gcc-7-branch/libitm/ChangeLog branches/gcc-7-branch/libitm/configure branches/gcc-7-branch/libmpx/ChangeLog branches/gcc-7-branch/libmpx/configure branches/gcc-7-branch/libobjc/ChangeLog branches/gcc-7-branch/libobjc/configure branches/gcc-7-branch/liboffloadmic/ChangeLog branches/gcc-7-branch/liboffloadmic/configure branches/gcc-7-branch/liboffloadmic/plugin/configure branches/gcc-7-branch/libquadmath/ChangeLog branches/gcc-7-branch/libquadmath/configure branches/gcc-7-branch/libsanitizer/ChangeLog branches/gcc-7-branch/libsanitizer/configure branches/gcc-7-branch/libssp/ChangeLog branches/gcc-7-branch/libssp/configure branches/gcc-7-branch/libstdc++-v3/ChangeLog branches/gcc-7-branch/libstdc++-v3/configure branches/gcc-7-branch/libvtv/ChangeLog branches/gcc-7-branch/libvtv/configure
Fixed for 7.4+.