modify libavformat

iOS, iPad, iPhone, tvOS specific usage questions
wminghao
Blank Cone
Blank Cone
Posts: 18
Joined: 18 Mar 2014 00:26

modify libavformat

Postby wminghao » 10 Apr 2014 20:25

Hi,

I finally got VLC for iOS to build, now I am trying to modify the source code from libavformat to do some experiment. However, I don't know how the build script is building the libraries.

Here is my understanding. For example, target for iPhoneSimulator-x86_64

1. The libformat.a file is built from source code in ./MobileVLCKit/ImportedSources/vlc/contrib/tarballs/ffmpeg-HEAD.tar.gz
2. The gz files are unzipped and copied to each target directory. i.e., /MobileVLCKit/ImportedSources/vlc/contrib/iPhoneSimulator-x86_64/ffmpeg/libavformat
3. If I want to rebuild libformat.a, I should delete the files /MobileVLCKit/ImportedSources/vlc/contrib/iPhoneSimulator-x86_64/ffmpeg/libavformat/libavformat.a

However, it seems that deleting the .a file won't let the build script rebuild libavformat for iPhoneSimulator-x86_64.

How do I force libavformat to be rebuilt with my changes?

Thanks

Regards,
Howard

wminghao
Blank Cone
Blank Cone
Posts: 18
Joined: 18 Mar 2014 00:26

Re: modify libavformat

Postby wminghao » 11 Apr 2014 02:53

Dig a little more into the build scripts.

It seems that ./MobileVLCKit/ImportedSources/vlc/contrib/src/ffmpeg/rules.mak is doing the trick here.

It does 3 things.

1) download source code.
2) copy code to 5 different target platform. arm64/7/7s and iPhoneSimulator-i386/x86_64
2) for each platform, it configure, make & install.

Say, If I modify code in libavformat for iPhoneSimulator-x86_64, I need to copy it to all 5 platforms? What's more, the code is not recompiled even after I modify the code.

That's something weirld here.

wminghao
Blank Cone
Blank Cone
Posts: 18
Joined: 18 Mar 2014 00:26

Re: modify libavformat

Postby wminghao » 11 Apr 2014 19:54

Since nobody replied, here is what I tried.

1) I go to the following directory $ cd ./MobileVLCKit/ImportedSources/vlc/contrib/iPhoneSimulator-x86_64
2) run the following command $make .ffmpeg
cd ffmpeg && CC="xcrun clang" CXX="xcrun clang++" LD="xcrun ld" AR="xcrun ar" CCAS="xcrun clang -c" RANLIB="xcrun ranlib" STRIP="xcrun strip" PATH="/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64/bin:/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/extras/tools/build/bin:/usr/local/Cellar/ffmpeg/2.1.3/bin/:/opt/local/bin:/opt/local/sbin:/usr/local/git/bin/:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Applications/VLC.app/Contents/MacOS/:/usr/local/Cellar/ffmpeg/2.1.3/bin/:/opt/local/bin:/opt/subversion/bin:/Users/wminghao/Develop/android-sdk-mac_x86/platform-tools:/Developer/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86/bin:/Users/wminghao/Downloads/adt-bundle-mac-x86_64-20130522/sdk/platform-tools:/Users/wminghao/Downloads/adt-bundle-mac-x86_64-20130522/sdk/tools:/Users/wminghao/.rvm/bin" CPPFLAGS=" -arch x86_64 -miphoneos-version-min=5.1 -I/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64/include" CFLAGS=" -arch x86_64 -miphoneos-version-min=5.1 -I/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64/include -g" CXXFLAGS=" -arch x86_64 -miphoneos-version-min=5.1 -arch x86_64 -miphoneos-version-min=5.1 -I/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64/include -g -I/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64/include -g" LDFLAGS=" -arch x86_64 -miphoneos-version-min=5.1 -L/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64/lib" ./configure \
--extra-ldflags=" -arch x86_64 -miphoneos-version-min=5.1 -L/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64/lib" --cc="xcrun clang" --disable-doc --disable-encoder=vorbis --enable-libgsm --enable-libopenjpeg --disable-debug --disable-avdevice --disable-devices --disable-avfilter --disable-filters --disable-bsfs --disable-bzlib --disable-programs --disable-avresample --disable-encoders --disable-muxers --arch=x86_64 --target-os=darwin --cpu=core2 --enable-pic --enable-pthreads \
--prefix="/Users/wminghao/Develop/vlc-iOS/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/x86_64-apple-darwin11-x86_64" --enable-static --disable-shared
xcrun clang is unable to create an executable file.
If xcrun clang is a cross-compiler, use the --enable-cross-compile option.
Only do this if you know what cross compiling means.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
make: *** [.ffmpeg] Error 1

Still does not work for unknown reasons. Can anyone help?

Thanks

wminghao
Blank Cone
Blank Cone
Posts: 18
Joined: 18 Mar 2014 00:26

Re: modify libavformat

Postby wminghao » 11 Apr 2014 21:00

Tweaked again, found config.log, here is the error

ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/usr/lib/libSystem.dylib' for architecture x86_64

Seems like running make .ffmpeg is not carrying forward the sysroot path correctly.

Still don't know how to build contrib/ffmpeg library directly. Need help, please. :)

wminghao
Blank Cone
Blank Cone
Posts: 18
Joined: 18 Mar 2014 00:26

Re: modify libavformat

Postby wminghao » 15 Apr 2014 23:29

Since noone replied to me, it took me a while to figure it out. It's a bit tricky.

1. remove the .ffmpeg file to force rebuild
2. modify vlc/extras/package/ios/build.sh to remove the line "make fetch" which will NOT download anything from vlc github root
3. modify buildMobileVLCKit.sh to remove the line: git reset --hard ${TESTEDHASH} git am ../../patches/*.patch to NOT force update the build.sh.
4. package the source code and save it as vlc/contrib/tarballs/ffmpeg-HEAD.tar.gz
5. run the build sh ./buildMobileVLCKit.sh -d -s -v from VLCKit

That will make sure it's copying the right ffmpeg source(not the version from github), and compile and link properly.

bgu
New Cone
New Cone
Posts: 4
Joined: 21 Nov 2016 16:50

Re: modify libavformat

Postby bgu » 02 Jun 2017 17:18

hey i have the same problem i tried to do the 4 steps that you erote but it dosent work can you help me?

i am using android not iphone


Return to “VLC for iOS, iPadOS and Apple TV”

Who is online

Users browsing this forum: No registered users and 18 guests