Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

[IOS] Invalid Segment Alignment libmobileffmpeg.dylib does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. #45

Closed
tanersener opened this issue Nov 18, 2018 · 20 comments
Assignees
Labels
bug Something isn't working fixed

Comments

@tanersener
Copy link
Owner

share version build ok, but not upload

dylib error... my Xcode 10.1 version

2018-11-18 11 00 28

Originally posted by @thecsy in #18 (comment)

@tanersener
Copy link
Owner Author

@thecsy which MobileFFmpeg version do you use? Can you try using v2.1.1?

@thecsy
Copy link

thecsy commented Nov 18, 2018

yes, 2.1.1 , 3.0 all try..
same error

@tanersener
Copy link
Owner Author

@thecsy Can you confirm that Run/Test/Archive does not fail and this issue happens only on upload?

@tanersener
Copy link
Owner Author

Can you try using this test version mobile-ffmpeg-full-3.0-ios-shared-universal.zip, built with Xcode 9.x?

@thecsy
Copy link

thecsy commented Nov 19, 2018

Sorry, can't Xcode 9.4

mobile-ffmpeg-full-3.0-ios-shared-universal
run :OK , Archive : capture error

mobile-ffmpeg-full-3.0-ios-static-universal
run fail , conflict libconv

mobile-ffmpeg-full-2.1.1-ios-shared-universal
run :OK , Archive : capture error

@tanersener
Copy link
Owner Author

Hi @thecsy. There is a misunderstanding. Can you test this version on your Xcode 10.1.

mobile-ffmpeg-full-3.0-ios-shared-universal
run :OK , Archive : capture error

What is capture error, do you mean 'Invalid Segment Alignment' error?

@thecsy
Copy link

thecsy commented Nov 19, 2018

test is Xcode 10.1 version use

yes , Invalid Segment Alignment' error

share version is always Error (Segment Alignment)

@tanersener
Copy link
Owner Author

Universal binaries are already tested with test-app and Xcode 10.1. run & archive both are successful. Are you sure you don't have another error?

success

@thecsy
Copy link

thecsy commented Nov 29, 2018

please , Just one test. (appstore upload)
i can Arcive & build. however upload not work .

it's Build options to date

  • 3.0 2.1, 2.2 pod ( min version error )

2018-11-29 10 22 09

  • ios.sh build script universal version use ( alignment error )
  • binary 3.0 share , 2.2 share ( alignment error )
  • drop box link, version 3.0 share ( alignment error )

2018-11-29 10 39 35

what's try option remain?

@tanersener
Copy link
Owner Author

Can you try with this one? This is different than the previous link.

@thecsy
Copy link

thecsy commented Nov 29, 2018

thanks, new link...
but same error ( screen shot time see)

2018-11-30 12 56 17

you can upload?
I deleted the suspicious pod contents.( VLC pod remove )
But the results were the same.

@tanersener
Copy link
Owner Author

thanks, new link...
but same error ( screen shot time see)
you can upload?
I deleted the suspicious pod contents.( VLC pod remove )
But the results were the same.

It was built with Xcode 10.1, which is the latest version. How is that possible?

Sorry but I don't have any other suggestions.

@codaman
Copy link

codaman commented Dec 16, 2018

I copied this sentence from apple forum.

"The main problem is that you've built the framework to include binaries for both the simulator and devices. This isn't officially supported at all (because the iOS simulator is actually macOS platform, while devices are iOS platform). Your framework must contain only ARM architectures for iOS platform.

Try building the framework again with just the correct architectures and platform. It's possible all the other errors will go away too."

ffmpeg libraries is running also on intel architecture.

@codaman
Copy link

codaman commented Dec 16, 2018

ekran resmi 2018-12-17 02 39 37

may be we have to remove these intel architectures.

@codaman
Copy link

codaman commented Dec 17, 2018

I tried to remove unwanted architectures but no changes

echo "Target architectures: $ARCHS"

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

find "$APP_PATH" -name '*.dylib' -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"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp"

remove simulator's archs if location is not simulator's directory

case "${TARGET_BUILD_DIR}" in
*"iphonesimulator")
echo "No need to remove archs"
;;
*)
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH"
echo "i386 architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH"
echo "x86_64 architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "Intel 32-bit") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "Intel 32-bit" "$FRAMEWORK_EXECUTABLE_PATH"
echo "Intel 32-bit architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "Intel 64-bit") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "Intel 64-bit" "$FRAMEWORK_EXECUTABLE_PATH"
echo "Intel 64-bit architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
;;
esac

echo "Completed for executable $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

done

@codaman
Copy link

codaman commented Dec 17, 2018

yes finally I found the solution. Use static binary. there is a problems on framework and dynamic library. I successfully uploaded the store and tested on device.

@tanersener
Copy link
Owner Author

tanersener commented Dec 17, 2018

@codaman Yes, you really did it 👍 I was trying to find a solution for months and this does not support the minimum OS Version specified in the Info.plist message was so misleading. Thanks a lot my friend. You really saved my hours, days. I really appreciate that.

I'd like to ask if you can test the following solution for dynamic frameworks.

Can you add a new Run Script Phase after Embed Frameworks section and put the following lines inside? I'm expecting this to fix dynamic frameworks.

bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libswresample.framework/strip-frameworks.sh"
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libavfilter.framework/strip-frameworks.sh"
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libavformat.framework/strip-frameworks.sh"
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libavutil.framework/strip-frameworks.sh"
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libswscale.framework/strip-frameworks.sh"
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libavdevice.framework/strip-frameworks.sh"
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libavcodec.framework/strip-frameworks.sh"
bash "$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/mobileffmpeg.framework/strip-frameworks.sh"

phases

@codaman
Copy link

codaman commented Dec 17, 2018

@tanersener i didn't try it. I will try it

@tanersener
Copy link
Owner Author

@codaman thanks my friend, I managed to test it but it didn't work, so don't waste your time if you haven't tried yet. I already posted the solution for #18.

@tanersener
Copy link
Owner Author

Please use v4.2 which is built with Xcode 10.1 if you encounter this issue.

@tanersener tanersener added bug Something isn't working fixed and removed needs-analysis labels Jun 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants