Dyld cache '/System/Library/dyld/dyld_shared_cache_arm64e' failed to load

HI!

I've compiled a command line utility written in plain C on macOS Monterey on macBook m1 pro. The compilation command is just following:

clang -std=gnu11 -Wall -o my_run_ht run_ht.c ht.c

It compiles fine but when I try running it, it is aborted with the following message:

dyld[8385]: dyld cache '/System/Library/dyld/dyld_shared_cache_arm64e' not loaded: syscall to map cache into shared region failed
dyld[8385]: Library not loaded: /usr/lib/libSystem.B.dylib
  Referenced from: /Users/sasha/Src/my/ht/run_ht
  Reason: tried: '/usr/lib/libSystem.B.dylib' (no such file), '/usr/local/lib/libSystem.B.dylib' (no such file)

What is more strange that I can compile and run other command line utilities. So I'm quite puzzled and have no idea what is the reason for that and how to fix it.

Could anybody please help me with this?

Thanks in advance.

Replies

Found it, it was my fault, of course – I had a very large static arrays.

  • Same problem with gfortran, see my "Answer" below...

Add a Comment

I'm getting the same error message executing a FORTRAN program compiled with gfortran-mp-devel installed with MacPorts, and definitely that program has a large static array. It happens on any AppleSilicon Mac I had a chance to try (Mac mini M1 with 16 GB of RAM, MacBookPro with M1 Max and 64 GB RAM, all with Monterey OS.).

But that program compiles and executes properly on any Intel Mac with any gfortran version I tried, and does so on Linux hardware as well. I could even use it on a Linux Virtual Machine with just 8 GB of RAM assigned, compiling it with option -mcmodel=large.

Unfortunately, trying -mcmodel=large on a M1 Mac (but also on Intel Mac) doesn't produce an executable. Just a ton of error messages at compile (or link?) time like this

/var/folders/72/b_3786ns6ld1z4n6k6cfsx7w0000gn/T//ccTHZMDC.s:11:15: error: invalid variant 'BLEAH'
adrp    x0, lC0@BLEAH

where BLEAH is pointed as the error. But there's nothing named BLEAH in my program. Any suggestion on how to solve this issue?

Thanks!

  • I had the same error compiling a fortran program with gfortran on my M1 macbook pro. I fixed it by using the compiler flag -mcmodel=small instead of -mcmodel=large

Add a Comment

I am getting the same error message running a Fortran90 program with large static arrays. It compiles OK using gfortran but then crashes immediately when I try executing it. I just upgraded to a M1 Pro laptop. I did not have problems running the program with my previous Mac laptop. Bizarrely, I have noticed that sometimes the program will work OK and sometime I get this failure message, depending upon the folder (directory) from which I am launching the program. Needless to say, this is very frustrating!

I am also running into this issue, running normal swift code.

I get the same error. Has anyone found a way to fix it without eliminating the static arrays?