Opened 7 years ago

Closed 7 years ago

#55413 closed defect (duplicate)

Uninstalling a selected port leaves broken symlinks

Reported by: lucbouge (Luc Bougé) Owned by:
Priority: Normal Milestone:
Component: base Version: 2.4.2
Keywords: select Cc:
Port:

Description

Dear MacPorts people,

I encountered a subtle installation bug recently. I used to use gcc49 for teaching because of its stability. I had my port select gcc set to mp-gcc49 so that calling g++was activating the right version of g++, that is, /opt/local/bin/g++-mp-49.

At some point, MacPorts stopped supporting this version, and /opt/local/bin/g++-mp-49 was erased. However, the symbolic selection link /opt/local/bin/g++ was left unchanged.

On calling g++, my shell was trying to open /opt/local/bin/g++, which was failing, and thus was resorting to the next g++ found in PATH, that is, /usr/bin/g++, which is Apple LLVM version 9.0.0.

As a consequence, I was silently executing Apple LLVM g++ instead of the Gnu g++, without being aware of it. This caused a number of problem in preparing my lab classes. It took me a long time before understanding the problem.

My suggestion would be to make sure to reset the port select association on erasing a currently selected version.

Best regards,

Luc.

Change History (3)

comment:1 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Component: portsbase
Port: gcc49 removed
Summary: Gcc49 not available any longer: silent bug with selectUninstalling a selected port leaves broken symlinks

sudo port select gcc mp-gcc49 should still work fine. Not sure why it stopped working on your system.

$ sudo port select gcc mp-gcc49
Selecting 'mp-gcc49' for 'gcc' succeeded. 'mp-gcc49' is now active.
$ ls -l /opt/local/bin/g++
lrwxr-xr-x  1 root  wheel  25 Nov 26 07:17 /opt/local/bin/g++ -> /opt/local/bin/g++-mp-4.9
$ g++ --version
g++ (MacPorts gcc49 4.9.4_2+universal) 4.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

But note that gcc49 is obsolete and is not supported on macOS High Sierra or later. Consider using a newer version, such as gcc5, gcc6, or the current stable version, gcc7.

Or perhaps that was the problem: Perhaps you have already upgraded to High Sierra and were for that reason unable to reinstall gcc49 after upgrading the OS, leaving your /opt/local/bin/g++ etc. symlinks broken.

I was surprised I couldn't find an existing ticket about that, though I've thought of the problem often. It would be great if MacPorts would either automatically "unselect" a port if you uninstall a port that is "selected", or else prevent the uninstallation of a port until the user manually "unselects" it, but currently neither of those occurs, and it is possible to uninstall a selected port, resulting in dangling symlinks.

comment:2 Changed 7 years ago by lucbouge (Luc Bougé)

Yes, sorry I did not mention it. It happened just after I upgraded to High Sierra. Port gcc49 disappeared in the course of the upgrade, and there were so many messages that I did not notice.

Of course, I will now go for the last gcc version. My point was just not being clearly warned about what happened.

Thanks for your instant answer,

Luc.

comment:3 Changed 7 years ago by jmroot (Joshua Root)

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