[MacPorts] #64896: gcc and gcc-devel run fails libSystem.B.dylib not found

MacPorts noreply at macports.org
Wed Mar 30 12:16:58 UTC 2022


#64896: gcc and gcc-devel run fails libSystem.B.dylib not found
-----------------------------+--------------------
  Reporter:  AlanTAMU        |      Owner:  (none)
      Type:  defect          |     Status:  new
  Priority:  Normal          |  Milestone:
 Component:  ports           |    Version:
Resolution:                  |   Keywords:
      Port:  ggc, gcc-devel  |
-----------------------------+--------------------

Comment (by fvaccari):

 Me too have this problem, and couldn't solve it up to now. Even the
 simplest FORTRAN code asking for a large array crashes at runtime. I'm
 actually the "effevi" who commented on

 [https://developer.apple.com/forums/thread/697494]

 but nobody followed up on that. It is puzzling me that I can compile and
 run that program on a Linux VM with just 8 GB of RAM.

 The original program that fails to execute on my new M1 Mac can be
 compiled and run with no issues un my old Intel Mac with 16 GB RAM, but
 fails on a new M1 Mac with 16 GB RAM. It fails also an another M1 Mac with
 64 GB RAM. But I can run it on a Linux VM with 8 GB RAM assigned, provided
 that I add there the option

 {{{
 -mcmodel=large
 }}}

 at compile time. Unfortunately that option leads to errors at compile time
 on any Mac (Intel or Apple Silicon) I've tried it on.

 It's actually the single program out of a couple of hundred programs of
 the package I'm working on that I can't execute on the M1 Mac.

 I'm adding here the link to the most detailed comment I've found on the
 matter

 [https://developer.apple.com/forums/thread/655588?answerId=665804022#665804022]

 that, as far as I can understand, seems to tell that the problem occurs
 when non-Apple linkers are involved, but doesn't offer a solution:

 ''"OTOH, if your third-party tools are using their own linker then you’ll
 have to determine whether that linker has been updated to use stub
 libraries. I can’t help you with that, alas."
 ''

 Hopefully someone smarter than me can get some clue from the detailed
 description available there...

 In the mean time I've experimented with with no luck using this stupid
 program:


 {{{
 program prog

 complex  ::   w40(300000000)
 w40=cmplx(0.0e0,0.0e0)

 print *,"OK"
 stop
 end
 }}}

 that compiled with no options on the Linux VM with 8 GB of RAM properly
 executes:


 {{{
 • ndsha at gao:ndsha/Rpath gfortran prog.f90
 • ndsha at gao:ndsha/Rpath ./a.out
  OK
 • ndsha at gao:ndsha/Rpath
 }}}

 Below a session of failed attempts at running it on the M1 Mac. I played
 with compile options, install_name_tool and one environment variable.
 Maybe someone can come out with more ideas on this while I go on with my
 experiments...

 Sure I'm going to contact that lone developer cited by Ken while I was
 typing my comment...

 Ciao

 Franco


 A plain compile:

 {{{
 • fv at vm1:Test/Rpath ls
 README   prog.f90

 • fv at vm1:Test/Rpath gfortran-mp-devel prog.f90

 • fv at vm1:Test/Rpath otool -L a.out
 a.out:
         @rpath/libgfortran.5.dylib (compatibility version 6.0.0, current
 version 6.0.0)
         @rpath/libquadmath.0.dylib (compatibility version 1.0.0, current
 version 1.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1311.0.0)

 • fv at vm1:Test/Rpath ./a.out
 dyld[88396]: dyld cache '/System/Library/dyld/dyld_shared_cache_arm64e'
 not loaded: syscall to map cache into shared region failed
 dyld[88396]: Library not loaded: /usr/lib/libSystem.B.dylib
   Referenced from: /Volumes/xHD/ndsha/Shared/Test/Rpath/a.out
   Reason: tried: '/usr/lib/libSystem.B.dylib' (no such file),
 '/usr/local/lib/libSystem.B.dylib' (no such file)
 [1]    88396 abort      ./a.out
 }}}

 With separate linking phase:

 {{{
 • fv at vm1:Test/Rpath gfortran-mp-devel -c prog.f90

 • fv at vm1:Test/Rpath gfortran-mp-devel  prog.o
 -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib

 • fv at vm1:Test/Rpath otool -L a.out
 a.out:
         @rpath/libgfortran.5.dylib (compatibility version 6.0.0, current
 version 6.0.0)
         @rpath/libquadmath.0.dylib (compatibility version 1.0.0, current
 version 1.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1311.0.0)

 • fv at vm1:Test/Rpath ./a.out
 dyld[88503]: dyld cache '/System/Library/dyld/dyld_shared_cache_arm64e'
 not loaded: syscall to map cache into shared region failed
 dyld[88503]: Library not loaded: /usr/lib/libSystem.B.dylib
   Referenced from: /Volumes/xHD/ndsha/Shared/Test/Rpath/a.out
   Reason: tried: '/usr/lib/libSystem.B.dylib' (no such file),
 '/usr/local/lib/libSystem.B.dylib' (no such file)

 [1]    88503 abort      ./a.out
 }}}

 Using install_name_tool, showing the path searched for the missing
 library:

 {{{
 • fv at vm1:Test/Rpath install_name_tool -change /usr/lib/libSystem.B.dylib
 @rpath/libSystem.B.dylib a.out
 • fv at vm1:Test/Rpath otool -L a.out
 a.out:
         @rpath/libgfortran.5.dylib (compatibility version 6.0.0, current
 version 6.0.0)
         @rpath/libquadmath.0.dylib (compatibility version 1.0.0, current
 version 1.0.0)
         @rpath/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1311.0.0)

 • fv at vm1:Test/Rpath ./a.out
 dyld[88527]: dyld cache '/System/Library/dyld/dyld_shared_cache_arm64e'
 not loaded: syscall to map cache into shared region failed
 dyld[88527]: Library not loaded: @rpath/libSystem.B.dylib
   Referenced from: /Volumes/xHD/ndsha/Shared/Test/Rpath/a.out
   Reason: tried: '/Volumes/xHD/ndsha/Shared/Test/Rpath/libSystem.B.dylib'
 (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-
 darwin21/12.0.1/libSystem.B.dylib' (no such file), '/opt/local/lib/gcc-
 devel/gcc/aarch64-apple-darwin21/12.0.1/../../../libSystem.B.dylib' (no
 such file), '/Volumes/xHD/ndsha/Shared/Test/Rpath/libSystem.B.dylib' (no
 such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-
 darwin21/12.0.1/libSystem.B.dylib' (no such file), '/opt/local/lib/gcc-
 devel/gcc/aarch64-apple-darwin21/12.0.1/../../../libSystem.B.dylib' (no
 such file), '/usr/local/lib/libSystem.B.dylib' (no such file),
 '/usr/lib/libSystem.B.dylib' (no such file)
 [1]    88527 abort      ./a.out
 }}}

 Setting a path-related variable, and listing the libSystem.B.dylib related
 files found there:

 {{{
 • fv at vm1:Test/Rpath export
 DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib

 • fv at vm1:Test/Rpath ll
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
 | grep libSystem\.B
 -rw-r--r--    1 root  wheel   303K Nov 17 06:30 libSystem.B.tbd
 -rw-r--r--    1 root  wheel   303K Nov 17 06:30 libSystem.B_asan.tbd
 lrwxr-xr-x    1 root  wheel    15B Feb  8 01:25 libSystem.tbd ->
 libSystem.B.tbd
 lrwxr-xr-x    1 root  wheel    20B Feb  8 01:25 libSystem_asan.tbd ->
 libSystem.B_asan.tbd

 • fv at vm1:Test/Rpath ./a.out
 dyld[88604]: dyld cache '/System/Library/dyld/dyld_shared_cache_arm64e'
 not loaded: syscall to map cache into shared region failed
 dyld[88604]: Library not loaded: @rpath/libSystem.B.dylib
   Referenced from: /Volumes/xHD/ndsha/Shared/Test/Rpath/a.out
   Reason: tried: '/Volumes/xHD/ndsha/Shared/Test/Rpath/libSystem.B.dylib'
 (no such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-
 darwin21/12.0.1/libSystem.B.dylib' (no such file), '/opt/local/lib/gcc-
 devel/gcc/aarch64-apple-darwin21/12.0.1/../../../libSystem.B.dylib' (no
 such file), '/Volumes/xHD/ndsha/Shared/Test/Rpath/libSystem.B.dylib' (no
 such file), '/opt/local/lib/gcc-devel/gcc/aarch64-apple-
 darwin21/12.0.1/libSystem.B.dylib' (no such file), '/opt/local/lib/gcc-
 devel/gcc/aarch64-apple-darwin21/12.0.1/../../../libSystem.B.dylib' (no
 such file),
 '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.B.dylib'
 (no such file)
 [1]    88604 abort      ./a.out
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/64896#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list