0

I have an ubuntu 19 and I am trying to change the version of my gcc to 4.8.5 from 7.8 ( I suppose ). After I tried using this command

link in ${@:1}; do sudo ln -s -f "/usr/bin/${link}-${0}" "/usr/bin/${link}"; done' 4.8

which is from this link

How to choose the default gcc and g++ version?

after I tried to use gcc -v or gcc --version or even trying to compile anything with gcc I get the error

  Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 28, in <module>
    from CommandNotFound import CommandNotFound
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
    from CommandNotFound.db.db import SqliteDatabase
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
    import apt_pkg
ImportError: /opt/Xilinx/14.7/ISE_DS/common/lib/lin64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so)
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ImportError: /opt/Xilinx/14.7/ISE_DS/common/lib/lin64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so)

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 28, in <module>
    from CommandNotFound import CommandNotFound
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
    from CommandNotFound.db.db import SqliteDatabase
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
    import apt_pkg
ImportError: /opt/Xilinx/14.7/ISE_DS/common/lib/lin64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so)

what should I do to solve this and get gcc 4.8 as new version

3
  • Ubuntu 19? Ubuntu desktop and server releases us the format yy.mm, with only specialist release using yy format (eg. Ubuntu Core 18 for IoT appliances) but there were no specialist releases in 2019 (an odd year). Please clarify your release, added to which your gcc versions don't seem to match any releases (packages.ubuntu.com/…)
    – guiverc
    Feb 26, 2020 at 11:37
  • You can have as many gcc/g++ versions as you want, installed at the same time. Using, examples : gcc-4.8 file.c .... export CC=gcc-4.8 CXX=g++-4.8 && [other command] .... make CC=gcc-4.8. .... Alternatively you can setup links with /etc/aternatives/ ... ( sudo update-alternatives --config gcc .... etc. etc.) Feb 26, 2020 at 11:50
  • Do you have an LD_LIBRARY_PATH set somewhere (in your ~/.bashrc for example)? What is the output of echo $LD_LIBRARY_PATH? Feb 26, 2020 at 13:38

1 Answer 1

0

I would recommend you do a fresh install leaving only the gcc version that you need/want. Uninstall all g++ and gcc and do a fresh install. Purge them if necessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .