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...

Version 0, edited 4 years ago by smeingast (Stefan Meingast) (next)

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.