0

While submitting my app on an Apple store, I am getting the following error.

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at '.....app/Frameworks/libstdc++.6.0.9.dylib' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

I am using Xcode 11.4. Do I need to update it? I included the following run script in build phases.

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

Thanks for your help :).

WasimSafdar
  • 1,044
  • 3
  • 16
  • 39
  • 1
    before you update Xcode, make sure what version is your iOS developer device, if any used. You may not be able to debug because you cant deliver to your own device because its newer OS than 11.4 supports. Then you MUST update Xcode or downgrade iOS. PS: but thats not your issue.. just a friendly hint as dev. – Ol Sen Jul 24 '20 at 22:24
  • I am using iOS 9.1 as a target device. Error is linked with 'libstdc++.6.0.9.dylib' lib. Maybe I need to use 'libstdc++.6.0.9.tbd' instead of it. In Embed option, it is showing 'Embed & Sign' with 'libstdc++.6.0.9.dylib' lib. I will check with Do not Embed option and update. – WasimSafdar Jul 25 '20 at 05:54

1 Answers1

0

Issue was with 'libstdc++.6.0.9.dylib' library. I was using an old framework that uses this library and because I was running my code on the simulator, therefore, I needed this library at runtime to run my code on a simulator that supports iOS 13. You do not need the support of this lib on the device. After removing the library from Embedded Frameworks, everything works fine now. For a more detailed answer, check this link.

https://github.com/gali8/Tesseract-OCR-iOS/issues/379

WasimSafdar
  • 1,044
  • 3
  • 16
  • 39