Changing default compiler on OpenSuSE

48 views
Skip to first unread message

seasoned_geek

unread,
Jun 30, 2024, 2:03:28 PMJun 30
to scintilla-interest
Posting this here because now it matters. By default OpenSuSE appears to install gcc-7 and cpp-7.
After you install version 11 of both via the package manager you still have a bit of work to do.

roland@localhost:~> su -
Password:
localhost:~ # update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 50
update-alternatives: using /usr/bin/gcc-11 to provide /usr/bin/gcc (gcc) in auto mode
localhost:~ # update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 20
localhost:~ # update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-11 50
update-alternatives: using /usr/bin/cpp-11 to provide /usr/bin/cpp (cpp) in auto mode
localhost:~ # update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-7 20
localhost:~ #
localhost:~ # update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-11   50        auto mode
  1            /usr/bin/gcc-11   50        manual mode
  2            /usr/bin/gcc-7    20        manual mode

Press <enter> to keep the current choice[*], or type selection number:
localhost:~ # update-alternatives --config cpp
There are 2 choices for the alternative cpp (providing /usr/bin/cpp).


  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/cpp-11   50        auto mode
  1            /usr/bin/cpp-11   50        manual mode
  2            /usr/bin/cpp-7    20        manual mode

Press <enter> to keep the current choice[*], or type selection number:
localhost:~ #


Should work on other Linux distros too. I don't know why they are still hanging back at 7 unless there is some kernel/core stuff that won't compile with newer compilers due to deprecation or later compilers forcing integer data types to be 2's complement. Real PITA for anyone working on a Unisys mainframe or doing low level device interfaces. 

seasoned_geek

unread,
Jun 30, 2024, 2:57:11 PMJun 30
to scintilla-interest
&^(*&^( forgot to do g++

roland@localhost:~/Original-code/scite/gtk> su -
Password:
localhost:~ # update-alternatives --config g++
\update-alternatives: error: no alternatives for g++
localhost:~ # which g++
/usr/bin/g++
localhost:~ # ls /usr/bin/g++*
/usr/bin/g++  /usr/bin/g++-11  /usr/bin/g++-7
localhost:~ # update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 50
update-alternatives: using /usr/bin/g++-11 to provide /usr/bin/g++ (g++) in auto mode
localhost:~ # update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 20
localhost:~ # update-alternatives --config g++
There are 2 choices for the alternative g++ (providing /usr/bin/g++).


  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/g++-11   50        auto mode
  1            /usr/bin/g++-11   50        manual mode
  2            /usr/bin/g++-7    20        manual mode


Press <enter> to keep the current choice[*], or type selection number:
localhost:~ #
Reply all
Reply to author
Forward
0 new messages