Opened 5 weeks ago
Last modified 5 weeks ago
#62124 new defect
gcc9 @9.3.0_4 gfortran fails with "ld: library not found for -lSystem" in Big Sur
Reported by: | cquike | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.4 |
Keywords: | bigsur | Cc: | mascguy (Christopher Nielsen) |
Port: | gcc8 gcc9 |
Description
In a fresh installed Big Sur machine with a fresh installed macports the gfortran command fails to compile (link) a hello world Fortran program:
$ gfortran-mp-9 -o hello hello.f ld: library not found for -lSystem collect2: error: ld returned 1 exit status
I have also tried with gfortran-mp-8 with the same results. The same command in a macOS 10.15 machine doesn't give any error.
The versions installed are:
# port installed | grep gcc gcc8 @8.4.0_2 (active) gcc9 @9.3.0_4 (active) gcc_select @0.1_9 (active) libgcc @3.0_0 (active) libgcc8 @8.4.0_1 (active) libgcc9 @9.3.0_3 (active) libgcc10 @10.2.0_3 (active) # sw_vers ProductName: macOS ProductVersion: 11.1 BuildVersion: 20C69 #/usr/bin/xcodebuild -version Xcode 12.3 Build version 12C33
The hello.f example is the simplest Fortran program:
PROGRAM HELLO * The PRINT statement is like WRITE, * but prints to the standard output unit PRINT '(A)', 'Hello, world' STOP END
Attachments (1)
Change History (10)
comment:1 Changed 5 weeks ago by kencu (Ken)
comment:2 follow-up: 5 Changed 5 weeks ago by kencu (Ken)
99.999% chance it is the same problem we have with all the gccs -- the SDK moved by a decimal point, and so gcc is broken.
see this thread <https://lists.macports.org/pipermail/macports-dev/2021-January/042775.html>
We cannot as yet get agreement to build gcc against "MacOSX.sdk" on new systems, but -- we will.
comment:3 Changed 5 weeks ago by mascguy (Christopher Nielsen)
While not quite the same symptoms, could be a similar situation to issue:62070.
comment:4 Changed 5 weeks ago by mascguy (Christopher Nielsen)
Cc: | mascguy added |
---|
comment:5 Changed 5 weeks ago by jmroot (Joshua Root)
Replying to kencu:
We cannot as yet get agreement to build gcc against "MacOSX.sdk" on new systems, but -- we will.
The real bug there is of course that gcc insists on using the same SDK it was built against at runtime.
comment:6 Changed 5 weeks ago by kencu (Ken)
Iain and Jeremy had a different idea of what that option was supposed to mean. I don't believe Iain feels there is any bug there to be fixed.
Changed 5 weeks ago by cquike
Attachment: | gfortran2.out added |
---|
Output of "gfortran-mp-9 -v -Wl,-v -Wa,-v -o hello hello.f "
comment:7 Changed 5 weeks ago by cquike
I have attached the output of "gfortran-mp-9 -v -Wl,-v -Wa,-v -o hello hello.f". It indeed mentions /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk which is not present in my system:
# ls -l /Library/Developer/CommandLineTools/SDKs/ total 0 lrwxr-xr-x 1 root wheel 14 Jan 21 12:29 MacOSX.sdk -> MacOSX11.1.sdk drwxr-xr-x 8 root wheel 256 Jul 9 2020 MacOSX10.15.sdk drwxr-xr-x 7 root wheel 224 Nov 30 13:33 MacOSX11.1.sdk
comment:8 Changed 5 weeks ago by kencu (Ken)
so the simplest thing to do is make a symlink from MacOSX11.0.sdk to MacOSX11.1.sdk and that gets you fixed for right now.
To fix this correctly, remove that symlink if you make it, and rebuild gcc from source on your local machine, like this:
sudo port -v -s install gcc9
and btw, gcc10 is available if that might be better. It probably also needs an SDK rebuild, sorry.
we are trying to get to a compromise on how we'll fix this properly, hopefully without too much more time going by.
comment:9 Changed 5 weeks ago by cquike
The symlink workaround is working.
Looking forward for proper fix.
Thanks you for the help!
please do this:
and perhaps also: