Xcode 15 beta build error: cfstring constant not pointer aligned on iOS 17

Showing Recent Errors Only Error parsing '/Users/icecee/taobao4iphone/Pods/APSecLocalStorage/APSecLocalStorage.framework/APSecLocalStorage[arm64][2](internal_SSKeychain.o)': cfstring constant not pointer aligned

Answered by DTS Engineer in 755628022

Xcode 15 beta includes a new linker, known as ld_prime. This has a bunch of benefits, not least being the support for mergeable libraries, per WWDC 2023 Session 10268 Meet mergeable libraries. However, any time you rewrite something that complex you inevitably run into the odd issue. Normally I’d suggest you file a bug about this, but we already have a bug report about this one (r. 110340167).

In the meantime, you should be able to work around it by reverting to the old linker. The linker has two options, -ld64 and -ld_prime, that override its default algorithm for choosing a back end.

Thanks for taking the time to test with Xcode 15 beta!

Share and Enjoy

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

same, any solution for now?

add -ld64 in other link flags

I have the exact same error when trying to build - "cfstring constant not pointer aligned"

Accepted Answer

Xcode 15 beta includes a new linker, known as ld_prime. This has a bunch of benefits, not least being the support for mergeable libraries, per WWDC 2023 Session 10268 Meet mergeable libraries. However, any time you rewrite something that complex you inevitably run into the odd issue. Normally I’d suggest you file a bug about this, but we already have a bug report about this one (r. 110340167).

In the meantime, you should be able to work around it by reverting to the old linker. The linker has two options, -ld64 and -ld_prime, that override its default algorithm for choosing a back end.

Thanks for taking the time to test with Xcode 15 beta!

Share and Enjoy

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

i got a new issue with Xcode 15 beta 6 (no issue with Xcode 15 beta 5):

duplicate symbol 'OBJC_IVAR$_PBACAppMobileIronReport_Builder.result' in: /Users/user/.../Frameworks/AppConnect.framework/Versions/A/AppConnect[arm64][73] appconnect.pb.o

and the work around's (-ld64) helped me.

I'm wondering ... when should I remove the work around? is there any link/article that i should subscribe to? Thanks

when should I remove the work around?

The best thing to do here is to file a bug. The bug system will then notify you if/when the fix makes it into a seed build of Xcode.

You can also monitor the Xcode release notes but my experience is that only the most pressing issues get an entry there.

Share and Enjoy

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

Seems to be behaving differently in the Release (Version 15.0 (15A240d)) too. While it's nice to have the -ld64 workaround, but does look like an unfixed bug or behaviour change.

Did anyone file a bug about this? If so, please post your bug number and I’ll see what’s new.

Share and Enjoy

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

Fixed the issue in Xcode 51 by adding -ld64 to other linker flag, but the flag is not working with Xcode 14 then, still looking for a permanent solution.

still looking for a permanent solution.

The permanent involves this being investigated by the linker team. That requires someone to file a bug and, AFAICT from this thread, no one has done that yet )-:

Please file a bug about this and post your bug number here.

but the flag is not working with Xcode 14 then

You can conditionalise that build setting based on your SDK. However, this isn’t a permanent solution because at some point the old linker implementation will go away.

Share and Enjoy

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

The backward compatibility solution for Xcode 14 is to add two user-defined settings

OLD_LINKER_FLAG_XCODE_1400 = -L/usr/lib/swift
OLD_LINKER_FLAG_XCODE = $(OLD_LINKER_FLAG_XCODE_$(XCODE_VERSION_MAJOR):default=-ld_classic)

The linker command for the OLD_LINKER_FLAG_XCODE_1400 might be adjusted if needed. It just needs to contains something since the empty line won't work.

Then, adjust OTHER_LDFLAGS like that:

OTHER_LDFLAGS = $(inherited) $(OLD_LINKER_FLAG_XCODE)

The result is that Xcode 15 and above will use -ld_classic flag and -L/usr/lib/swift for Xcode 14 preventing ld: library not found for -ld_classic error

I added "-ld_classic" that can run on my iphone13 ,but not work for Archive ipa, what is still appear "xxxx duplicate symbols for architecture arm64"

Xcode 15 beta build error: cfstring constant not pointer aligned on iOS 17
 
 
Q