LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Broke gcc while attempting to upgrade it (https://www.linuxquestions.org/questions/slackware-14/broke-gcc-while-attempting-to-upgrade-it-4175675760/)

jjuanez 05-23-2020 12:09 PM

Broke gcc while attempting to upgrade it
 
Hi,
I needed to upgrade the kernel in order to install my wireless drivers.
However, the gcc that ships with 14.2 was seemingly too old due to retpoline support. I tried to update gcc by installing a newer slackware package with installpkg command. The process seemingly ended successfully.

However now when attempting to run make I receive error message /usr/bin/gcc: No such file or directory.

I checked usr/bin and the symbolic link is there and the target it points to is there as well. However, when I try to run the target it points to directly I also get the "no such file or directory" error.

I tried installing bin-utils slackware package and it did not help. I'm probably making a silly mistake here somewhere sigh.

Any assistance appreciated. thanks

bassmadrigal 05-23-2020 01:07 PM

You should not be installing upgraded packages with installpkg. This leaves the original package installed and will overwrite some of the files.

Also, you should not be picking and choosing updates, because those packages are built after all previous patches are installed, so it may rely on newer software.

You download all the packages from the patches/ directory on your favorite mirror and use upgradepkg to upgrade all of them. If you want to simplify the upgrade process, look into using slackpkg

jjuanez 05-23-2020 01:45 PM

Thank you! At first I was using installpkg with files brought in by USB because I could not even get the ethernet connection to work (hence the kernel recompilation attempts). With a knoppix USB I was (eventually) able to load the wifi drivers and in turn fix gcc with slackpkg remove and reinstall.

drumz 05-25-2020 04:07 PM

One way of having an additional gcc version is to install the new version into either /usr/local or /opt. I have GCC 6.3.0 installed into /opt for MATLAB.

I based my build script off the official Slackware SlackBuild in the source tree. Download gcc-6.3.0.tar.bz2 and extract it. Then create a build directory and put do_build.sh in it:
Code:

#!/bin/sh

srcdir=../gcc-6.3.0
destdir=/opt/gcc-6.3.0

SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
LIB_ARCH=amd64

TARGET=x86_64-slackware-linux

NUMJOBS=" -j 8 "

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
"$srcdir/configure" \
  --prefix=$destdir \
  --libdir=$destdir/lib$LIBDIRSUFFIX \
  --enable-bootstrap \
  --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ \
  --enable-threads=posix \
  --enable-checking=release \
  --enable-objc-gc \
  --with-system-zlib \
  --enable-libstdcxx-dual-abi \
  --with-default-libstdcxx-abi=gcc4-compatible \
  --with-python-dir=/lib$LIBDIRSUFFIX/python2.7/site-packages \
  --disable-libunwind-exceptions \
  --enable-__cxa_atexit \
  --enable-libssp \
  --enable-lto \
  --disable-install-libiberty \
  --with-gnu-ld \
  --verbose \
  --with-arch-directory=$LIB_ARCH \
  --disable-gtktest \
  --disable-multilib \
  --target=${TARGET} \
  --build=${TARGET} \
  --host=${TARGET} || exit 1

make $NUMJOBS bootstrap;
( cd gcc || exit
  make $NUMJOBS gnatlib GNATLIBCFLAGS="$SLKCFLAGS"

  CFLAGS="$SLKCFLAGS" \
          CXXFLAGS="$SLKCFLAGS" \
          make $NUMJOBS gnattools
)
make info

make install || exit 1

Now to use it just put /opt/gcc-6.3.0/bin at the beginning of your PATH (that's what my MATLAB startup script does).

You'll probably have to fiddle with the build options for different versions of GCC.


All times are GMT -5. The time now is 12:11 PM.