Page 1 of 1

iOS8/Swift and MobileVLCKit build fails

Posted: 21 Aug 2015 11:04
by jeanlolo
Hello,

I'm struggling a bit to build my project with MobileVLCKit and cocoapods.
Without adding any VLCKit code, I get errors when building the app, on simulator or device.

Pod file:

Code: Select all

platform :ios, '8.0' target 'VLCKitTest' do pod 'MobileVLCKit' end
This is the error I get

Code: Select all

Undefined symbols for architecture arm64: "std::runtime_error::runtime_error(std::string const&)", referenced from: libebml::CRTError::CRTError(std::string const&, int) in MobileVLCKit(StdIOCallback.o) "std::ostream& std::ostream::_M_insert<void const*>(void const*)", referenced from: libebml::IOCallback::writeFully(void const*, unsigned long) in MobileVLCKit(IOCallback.o) libebml::IOCallback::readFully(void*, unsigned long) in MobileVLCKit(IOCallback.o) [...]
My deployment target is 8.0.
I have set my "Build Active Architecture Only" to YES in Debug.

Thanks a lot for your help!

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 21 Aug 2015 12:02
by fkuehne
You don't link against libc++.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 21 Aug 2015 14:25
by jeanlolo
My C++ Standard Library setting is set to libc++

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 21 Aug 2015 14:27
by fkuehne
Yes, but you don't link against it. Add it as a "framework" to your linking step.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 21 Aug 2015 15:41
by jeanlolo
Hello Felix,

thanks for your answers. Unfortunately it still doesn't work.
Here are my settings:

Image

Image

I just figured that in my Other Linker Flags, I had "-l stdc++" because I'm using Core Plot. Could it be the cause of the problem?

Image

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 21 Aug 2015 15:44
by fkuehne
Yes, you should decide for 1 c++ stdlib. Mixing 2 can lead to evil things such as this one.

Of course, you can also recompile MobileVLCKit to deploy the GNU stdlib. This is still supported in current releases (it will go away this fall).

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 24 Aug 2015 10:01
by jeanlolo
To be sure I created a new blank project:
- I delete the Tests target
- I add the podfile to the project
- I execute "pod install"
- I close my project, and open the the new workspace

Here if I build I get the "Undefined symbols for architecture" error.

So I check the flags in the xcconfig file and cocoapods automatically adds: -l"stdc++"
The C++ Standard library is set to libstdc++ by default, so I add "libstdc++" in Link Binary with Libraries.

Then I compile again and it fails.

I tried several other combination using libc++, removing the flag...but nothing works.

What did I forget?

Thanks for your help!

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 24 Aug 2015 10:29
by fkuehne
Do you get the same undefined symbols when linking either libstdc++ or libc++ or different ones? Note that MobileVLCKit requires a lot more frameworks from the OS to link against, which will also lead to undefined symbol errors if you don't.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 24 Aug 2015 10:52
by jeanlolo
I have in both cases:

Code: Select all

Undefined symbols for architecture x86_64: "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::find(wchar_t const*, unsigned long, unsigned long) const", referenced from: TagLib::String::find(TagLib::String const&, int) const in MobileVLCKit(tstring.cpp.o) TagLib::String::split(TagLib::String const&) const in MobileVLCKit(tstring.cpp.o) "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::rfind(wchar_t const*, unsigned long, unsigned long) const", referenced from: TagLib::String::rfind(TagLib::String const&, int) const in MobileVLCKit(tstring.cpp.o) "std::string::find(char const*, unsigned long, unsigned long) const", referenced from:
I guess that cocoapods automatically adds them when compiling:
-framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreText -framework MobileVLCKit -framework OpenGLES -framework QuartzCore -framework Security

I added them nonetheless in the Build Phases but it did not change the results of the compilation.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 24 Aug 2015 14:43
by jeanlolo
After searching a bit I succeeded in compiling the blank objective C project with a 6.1 deployment target, unfortunately I need to make it work on iOS8 with swift.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 24 Aug 2015 17:39
by fkuehne
I'd like you to try a special binary I'd cook until tomorrow morning CEST if you are interested, which should solve this issue and will support 8.0 or later, but nothing less.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 24 Aug 2015 17:44
by jeanlolo
With great pleasure!
Thank you Felix.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 27 Aug 2015 14:22
by jeanlolo
Hello Felix,

do you have any news on that cook?

Thanks

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 28 Aug 2015 11:30
by fkuehne
Thanks for the reminder - I knew that I forgot something :D

There you go: http://files.feepk.net/_/bvna5xE

Note that in addition to the previous static framework, we also support dynamic frameworks now.

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 28 Aug 2015 15:48
by jeanlolo
It works!
Thank you so much for all your help Felix, you rock!

Re: iOS8/Swift and MobileVLCKit build fails

Posted: 28 Aug 2015 17:36
by fkuehne
Great to hear, enjoy! Feel free to drop me a line when your app is in production. We are always curious where our code ends up :)