Opened 4 years ago

Closed 4 years ago

#61468 closed defect (invalid)

Selecting gcc as system default does not work on macOS 11.0 Big Sur

Reported by: smeingast (Stefan Meingast) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: gcc10 gcc_select

Description

I just built gcc10 successfully on Big Sur, but selecting it as system default does not work

port select --list gcc
sudo port select gcc mp-gcc10
hash gcc

successfully lists then

port select --list gcc
mp-gcc10 (active)

but

which gcc

still points to

/usr/bin/gcc

Any clue what I am doing wrong, this has always worked previously.

Change History (7)

comment:1 Changed 4 years ago by jmroot (Joshua Root)

Port: gcc_select added

Note that it's usually better to run type cmd rather than which cmd. Does /opt/local/bin/gcc exist? Is /opt/local/bin in your PATH?

comment:2 in reply to:  1 Changed 4 years ago by smeingast (Stefan Meingast)

Replying to jmroot:

Note that it's usually better to run type cmd rather than which cmd. Does /opt/local/bin/gcc exist? Is /opt/local/bin in your PATH?

Thanks for the hint. And yes, /opt/local/bin/gcc does exist (and works) and /opt/local/bin is in my PATH.

comment:3 Changed 4 years ago by smeingast (Stefan Meingast)

Ah, I just discovered that I have this same problem with other ports as well. For instance 'sudo port select --set python python38' doesn't do the trick either anymore...

edit: I tried it both with bash and zsh, if that matters. no luck.

edit2: In general, there seems to be some inconsistency with respect to the select command:

port select --summary
Name       Selected       Options
====       ========       =======
cython     cython38       cython38 none
gcc        mp-gcc10       mp-gcc10 none
ipython    py38-ipython   py38-ipython none
ipython3   py38-ipython   py38-ipython none
nosetests  nosetests38    nosetests38 none
pip        pip38          pip3-apple pip38 none
python     python38       python27-apple python38 python38-apple none
python3    python38       python38 python38-apple none

and then checking each with type:

cython is /opt/local/bin/cython
gcc is /usr/bin/gcc
ipython is /opt/local/bin/ipython
ipython3 is /opt/local/bin/ipython3
nosetests is /opt/local/bin/nosetests
pip is /opt/local/bin/pip
python is /usr/bin/python
python3 is /usr/bin/python3

As you can see, gcc, and the Python interpreters follow the wrong paths.

Last edited 4 years ago by smeingast (Stefan Meingast) (previous) (diff)

comment:4 Changed 4 years ago by jmroot (Joshua Root)

If the symlink is created in /opt/local/bin then port select has worked correctly. Whether that symlink is found when you type the command's name is a matter of shell behaviour.

comment:5 Changed 4 years ago by jmroot (Joshua Root)

Just to be completely sure, there's no other location where a gcc or python could be found in your PATH before /opt/local/bin?

comment:6 in reply to:  5 Changed 4 years ago by smeingast (Stefan Meingast)

Replying to jmroot:

Just to be completely sure, there's no other location where a gcc or python could be found in your PATH before /opt/local/bin?

AHH, gotcha, that was the hint I needed!! Indeed, the order individual directories were set up in PATH was different, so that /usr/bin/ was checked AFTER /opt/local/bin/. Why? Because I used .zshenv instead of .zprofile and for some reason .zshenv puts the included exports for PATH after those defined by the system, so PATH startet with /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/opt/local/bin:/opt/local/sbin. I now switched back to use .zprofile and the PATH is set up correctly again with /opt/local/bin (etc.) in front! Thanks so much, I learned something today!! :)

comment:7 Changed 4 years ago by cjones051073 (Chris Jones)

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.