Xcode16 linker error

I am building my project and it build failed on Xcode 16.0 Beta 2 use Default linker(I think it's -ld_new). Undefined symbols for architecture arm64: "__mh_execute_header".

But when using the -ld64 linker, this error will not be reported.

I am confused. Does -ld_new have any special handling for __mh_execute_header?

Thanks for any help!

Answered by DTS Engineer in 797075022

_mh_execute_header is a synthetic symbols inserted by the linker to mark the beginning of a Mach-O executable. There are a suite of these, one for each Mach-O image type, all defined in <mach-o/ldsyms.h>. That header has doc comments that explain their usage.

The most common cause of problems like this is with folks using the wrong symbol. _mh_execute_header is only relevant if you’re building an executable. If, for example, you’re building a dynamic library or framework, you must use _mh_dylib_header instead.

Share and Enjoy

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

Reproducible on Xcode 16.0 Beta 3 too ! Trying to embed unity as a library

_mh_execute_header is a synthetic symbols inserted by the linker to mark the beginning of a Mach-O executable. There are a suite of these, one for each Mach-O image type, all defined in <mach-o/ldsyms.h>. That header has doc comments that explain their usage.

The most common cause of problems like this is with folks using the wrong symbol. _mh_execute_header is only relevant if you’re building an executable. If, for example, you’re building a dynamic library or framework, you must use _mh_dylib_header instead.

Share and Enjoy

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

Xcode16 linker error
 
 
Q