Nanfeng

Notes on software development, code, and curious ideas

Fix Cocos Creator libwebp.a Mach-O Member Not 8-Byte Aligned in Xcode

  • Xcode: 26.4 (17E192)
  • Cocos Creator: 3.7.2

After exporting an iOS project, it failed to compile with this error:

1
iOS.xcodeproj 64-bit mach-o member 'utils.o' not 8-byte aligned in '/Applications/Cocos/Creator/3.7.2/Cocos Creator.app/Contents/Resources/resources/3d/engine/native/external/iOS/libs/libwebp.a'

Nothing in the project had changed, so the failure was confusing at first. I later learned that the libwebp.a bundled with Cocos Creator 3.7.2 conflicts with the linker in newer Xcode versions. That reminded me that I had upgraded Xcode the previous Friday.

Tip: avoid upgrading development tools unnecessarily in the middle of a project. Toolchain updates can introduce subtle compatibility problems.

Rebuild the libwebp.a arm64 Library

I used the second repair approach from this Cocos forum discussion.

Open a terminal, enter the directory containing libwebp.a, and run:

1
2
lipo libwebp.a -thin arm64 -output libwebp_fixed.a
mv libwebp_fixed.a libwebp.a

Return to Xcode, clean the build cache, and rebuild the project. After this repair, my libwebp.a file was 321 KB and the project compiled successfully.

+