site  contact  subhomenews

gcc now works with older CPUs

May 21, 2023 — BarryK

Three people reported that when they tried to compile with gcc, they got "illegal instruction". So, have to do something about it.

No problem for me; I compile on computers with Intel i3 and Ryzen 5 CPU. Today booted up Easy on a much older computer, with an earlier-gen i5 CPU, with the devx SFS loaded, when ran "gcc --help" got that "illegal instruction". Hmmm.

Here is the blog post how gcc was compiled:

https://bkhome.org/news/202212/gcc-problem-in-kirkstone-series.html

Today made some changes, shown in bold:

# cd build
# ../configure --build=x86_64-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin \
--sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc \
--sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include \
--oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man \
--disable-silent-rules --with-libtool-sysroot=/ --with-gnu-ld --enable-shared \
--enable-languages=c,c++ --enable-threads=posix --disable-multilib --enable-default-pie \
--enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch \
--program-prefix=x86_64-poky-linux- --without-local-prefix --disable-install-libiberty \
--enable-lto --disable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap \
--with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no \
--with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl \
--with-build-sysroot=/ --disable-static --enable-nls --with-glibc-version=2.35 \
--enable-initfini-array --enable-__cxa_atexit --with-arch=nocona --with-tune=nocona
# make CFLAGS=-march=nocona CXXFLAGS=-march=nocona CFLAGS_FOR_TARGET=-march=nocona CXXFLAGS_FOR_TARGET=-march=nocona BOOT_CFLAGS=-march=nocona BOOT_CXXFLAGS=-march=nocona
# make install

Not sure which one of those did the trick, but it now works. Don't think that "--with-tune=nocona" is required. The problem is with the gcc executable itself, so those variables look like the needed fix.

Created a PET, installed in the other computer with the old i5 CPU, this time it works, and even compiled a program to verify.  

Tags: easy