Is the Debian alternatives system up to switching GCC suites

If none of the more specific forums is the right place to ask

Is the Debian alternatives system up to switching GCC suites

Postby ab1jx » 2019-11-03 14:45

Several times in my life I've been in the position of having multiple gcc versions installed, which if I remember right weren't always switched by using the Debian Alternatives system. Which works moderately well sometimes but maybe this is asking too much of it. I didn't realize it has a master-slave relationship built in until recently.

I'm on my trusty Odroid N2 running Buster and I just installed gcc-linaro (into the prefix dir /usr/local/linaro) by building from sources. /usr/local/linaro/bin looks like this:
Code: Select all
total 68296
drwxr-xr-x 2 root root    4096 Nov  3 09:40 .
drwxr-xr-x 8 root root    4096 Nov  2 18:15 ..
-rwxr-xr-x 4 root root 5784152 Nov  2 18:10 aarch64-unknown-linux-gnu-c++
-rwxr-xr-x 4 root root 5784152 Nov  2 18:10 aarch64-unknown-linux-gnu-g++
-rwxr-xr-x 3 root root 5773288 Nov  2 18:13 aarch64-unknown-linux-gnu-gcc
-rwxr-xr-x 3 root root 5773288 Nov  2 18:13 aarch64-unknown-linux-gnu-gcc-7.4.1
-rwxr-xr-x 2 root root  158504 Nov  2 18:13 aarch64-unknown-linux-gnu-gcc-ar
-rwxr-xr-x 2 root root  158352 Nov  2 18:13 aarch64-unknown-linux-gnu-gcc-nm
-rwxr-xr-x 2 root root  158360 Nov  2 18:13 aarch64-unknown-linux-gnu-gcc-ranlib
-rwxr-xr-x 2 root root 5784608 Nov  2 18:10 aarch64-unknown-linux-gnu-gfortran
-rwxr-xr-x 4 root root 5784152 Nov  2 18:10 c++
-rwxr-xr-x 1 root root 5776208 Nov  2 18:13 cpp
-rwxr-xr-x 4 root root 5784152 Nov  2 18:10 g++
-rwxr-xr-x 3 root root 5773288 Nov  2 18:13 gcc
-rwxr-xr-x 2 root root  158504 Nov  2 18:13 gcc-ar
-rwxr-xr-x 2 root root  158352 Nov  2 18:13 gcc-nm
-rwxr-xr-x 2 root root  158360 Nov  2 18:13 gcc-ranlib
-rwxr-xr-x 1 root root 4439024 Nov  2 18:13 gcov
-rwxr-xr-x 1 root root 3236008 Nov  2 18:13 gcov-dump
-rwxr-xr-x 1 root root 3456424 Nov  2 18:13 gcov-tool
-rwxr-xr-x 2 root root 5784608 Nov  2 18:10 gfortran

(These are based on gcc7)

It has a fairly complete set of utilities, not to mention include files and libraries, which duplicate what's already in /usr/bin:
Code: Select all
lrwxrwxrwx  1 root root          5 Feb 25  2019 aarch64-linux-gnu-gcc -> gcc-8
-rwxr-xr-x  1 root root    1080904 Apr  6  2019 aarch64-linux-gnu-gcc-8
lrwxrwxrwx  1 root root          8 Feb 25  2019 aarch64-linux-gnu-gcc-ar -> gcc-ar-8
-rwxr-xr-x  1 root root      31200 Apr  6  2019 aarch64-linux-gnu-gcc-ar-8
lrwxrwxrwx  1 root root          8 Feb 25  2019 aarch64-linux-gnu-gcc-nm -> gcc-nm-8
-rwxr-xr-x  1 root root      31200 Apr  6  2019 aarch64-linux-gnu-gcc-nm-8
lrwxrwxrwx  1 root root         12 Feb 25  2019 aarch64-linux-gnu-gcc-ranlib -> gcc-ranlib-8
-rwxr-xr-x  1 root root      31200 Apr  6  2019 aarch64-linux-gnu-gcc-ranlib-8
-rwxr-xr-x  1 root root        428 Jun 12  2013 c89-gcc
-rwxr-xr-x  1 root root        454 Jun 12  2013 c99-gcc
lrwxrwxrwx  1 root root          5 Feb 25  2019 gcc -> gcc-8
lrwxrwxrwx  1 root root         23 Apr  6  2019 gcc-8 -> aarch64-linux-gnu-gcc-8
lrwxrwxrwx  1 root root          8 Feb 25  2019 gcc-ar -> gcc-ar-8
lrwxrwxrwx  1 root root         26 Apr  6  2019 gcc-ar-8 -> aarch64-linux-gnu-gcc-ar-8
lrwxrwxrwx  1 root root          8 Feb 25  2019 gcc-nm -> gcc-nm-8
lrwxrwxrwx  1 root root         26 Apr  6  2019 gcc-nm-8 -> aarch64-linux-gnu-gcc-nm-8
lrwxrwxrwx  1 root root         12 Feb 25  2019 gcc-ranlib -> gcc-ranlib-8
lrwxrwxrwx  1 root root         30 Apr  6  2019 gcc-ranlib-8 -> aarch64-linux-gnu-gcc-ranlib-8


Yet gcc isn't even in the alternatives system yet. Is it possible and worthwhile to set up gcc7 (Linaro) and gcc8 (stock) as masters in the Alternatives system with ar, nm, ranlib, etc. as slaves? So I could (maybe) switch the whole set to use the Linaro versions and then easily switch back? Or is this going farther than the designers of the alternatives system ever intended? It's a bunch of work to try to implement it, if it's not going to work I'd rather not bother.

I'm playing with Linaro because the ARM Compute Library https://arm-software.github.io/ComputeLibrary/latest/ expects it.

[edit]
Never mind I guess, the ARM stuff seems to be incomplete enough to be not worth bothering with. They expect you to spend thousands on official binary libraries, which for an end-user is absurd. Not sure if there's anything useful in there at all. I have 2 Malis and several ARM machines and I can't do anything much with them.
ab1jx
 
Posts: 31
Joined: 2016-01-23 21:28
Location: Heath, MA, USA

Return to General Questions

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable