Upgrade to XCode 16. Undefined symbol: nominal type descriptor for CoreGraphics.CGFloat

ld: symbol(s) not found for architecture arm64 clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Undefined symbol: nominal type descriptor for CoreGraphics.CGFloat

Undefined symbol: type metadata for CoreGraphics.CGFloat

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.BinaryFloatingPoint in CoreGraphics

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Encodable in CoreGraphics

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.FloatingPoint in CoreGraphics

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Hashable in CoreGraphics

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Comparable in CoreGraphics

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Equatable in CoreGraphics

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Decodable in CoreGraphics

Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.SignedNumeric in CoreGraphics

Answered by DTS Engineer in 804591022

Consider this tiny test program:

import Foundation

func main() {
    print(CGFloat.self)
}

main()

Build it and dump its symbols:

% nm -m Test763969 | grep CGFloat                 
    (undefined) weak external _$s12CoreGraphics7CGFloatVMn (from libswiftCoreGraphics)
    (undefined) weak external _$s12CoreGraphics7CGFloatVN (from libswiftCoreGraphics)

It’s importing a bunch of CGFloat-related stuff from libswiftCoreGraphics. Now demangle those symbols:

% nm -m Test763969 | grep CGFloat | swift demangle
    (undefined) weak external nominal type descriptor for CoreGraphics.CGFloat (from libswiftCoreGraphics)
    (undefined) weak external type metadata for CoreGraphics.CGFloat (from libswiftCoreGraphics)

Once of those symbols is the external nominal type descriptor for CGFloat. This is the source of the error you’re seeing. The Mach-O image you’re trying to link is referencing this symbol but no one has told the linker where to find it.

You can usually resolve problems like this by adding the correct stub library to your Link Binary With Libraries build phase. In that case it’d be libswiftCoreGraphics.tbd.

If that doesn’t help you should look at the transcript for the failed Link build step to see if there are any further hints there. See Command [something] failed with a nonzero exit code for info on how to get that.

Share and Enjoy

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

getting same error after xcode 16 update

Accepted Answer

Consider this tiny test program:

import Foundation

func main() {
    print(CGFloat.self)
}

main()

Build it and dump its symbols:

% nm -m Test763969 | grep CGFloat                 
    (undefined) weak external _$s12CoreGraphics7CGFloatVMn (from libswiftCoreGraphics)
    (undefined) weak external _$s12CoreGraphics7CGFloatVN (from libswiftCoreGraphics)

It’s importing a bunch of CGFloat-related stuff from libswiftCoreGraphics. Now demangle those symbols:

% nm -m Test763969 | grep CGFloat | swift demangle
    (undefined) weak external nominal type descriptor for CoreGraphics.CGFloat (from libswiftCoreGraphics)
    (undefined) weak external type metadata for CoreGraphics.CGFloat (from libswiftCoreGraphics)

Once of those symbols is the external nominal type descriptor for CGFloat. This is the source of the error you’re seeing. The Mach-O image you’re trying to link is referencing this symbol but no one has told the linker where to find it.

You can usually resolve problems like this by adding the correct stub library to your Link Binary With Libraries build phase. In that case it’d be libswiftCoreGraphics.tbd.

If that doesn’t help you should look at the transcript for the failed Link build step to see if there are any further hints there. See Command [something] failed with a nonzero exit code for info on how to get that.

Share and Enjoy

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

Superb works like a charm.Thanks

Upgrade to XCode 16. Undefined symbol: nominal type descriptor for CoreGraphics.CGFloat
 
 
Q