[Xcode 15] Unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in libLLVM.dylib

After upgrading my Xcode from 14.3 to 15.0, there is a compilation error "Unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in libLLVM.dylib". There is no solution found anywhere (Google, Stackoverflow, This forum).

The error message is not helpful to locate the root cause. I also tried to read through this page https://iphonedev.wiki/Mach-O_File_Format to know more about LLVM, MH_OBJECT. So far, i cannot find any good reference.

Replies

An Apple Library Primer has a bunch of info and links related to Mach-O.

Regarding this specific error, that’s complaining about the libLLVM.dylib file, right? If so, what file type is that? If you run the following, what do you see?

% file libLLVM.dylib

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@eskimo thanks for the suggestion, i ran the command % file libLLVM.dylib and it shows

libLLVM.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library stub x86_64] [arm64]
libLLVM.dylib (for architecture x86_64):     Mach-O 64-bit dynamically linked shared library stub x86_64
libLLVM.dylib (for architecture arm64):      Mach-O 64-bit dynamically linked shared library stub arm64

It looks everything is normal for that library. I suspected that some frameworks embedded in the project does not work on xcode 15 but the error messages do not have meaningful explanation on what happened behind the curtin.

It looks everything is normal for that library.

Yep.

I suspected that some frameworks embedded in the project does not work on xcode 15 but the error messages do not have meaningful explanation on what happened

That seems like a reasonable theory.

That command is definitely coming out of the linker. If you look at the build transcript, how is the linker being invoked?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hey There,

same problem for me when I try to compile a short fortran program with gfortran through macport.

ld: warning: ignoring duplicate libraries: '-lSystem', '-lgcc', '-lgcc_ext.10.5' ld: unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in '/usr/local/gfortran/lib/libgcc_ext.10.5.dylib' collect2: error: ld returned 1 exit status

I'm trying to recompile my ports but no way

I'll update you if I have some news

Ciao Francesco

Hi there,

so I solved my problem! the problem occurs if I use "gfortran" installed in my Mac updated with xcode 15 and Sonoma. I solved using gfortran-mp-13 command instead. I have several exec of gfortran installed, I think related to the gcc compiler versions that I installed. At the moment my options are gfortran, gfortran-mp-12 and gfortran-mp-13.

Ciao Francesco

@eskimo I've run into a similar problem but I am unable to upgrade to a different version of gfortran as my package is not compatible with new compilers. I've also recently upgraded to sonoma so I am unable to downgrade the xcode command line tools. Is there anything else I can do to resolve this problem? dhcp-194-201:dusty samrose$ make gfortran-8 -O3 -lgomp -fopenmp -o dusty dusty.f90 dusty.f90:503:22:

  subroutine Kernel(path,lpath,tau,Nmodel)
                  1

Warning: Interface mismatch in global procedure 'kernel' at (1): ALLOCATABLE mismatch in argument 'tau' [-Wargument-mismatch] -macosx_version_min has been renamed to -macos_version_min ld: warning: ignoring duplicate libraries: '-lSystem', '-lgcc', '-lgcc_ext.10.5', '-lgomp' ld: unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in '/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8/libgcc_ext.10.5.dylib' collect2: error: ld returned 1 exit status make: *** [all] Error 1