Compiling error of VLC project in iOS - ios

I am trying to compile the VLC project for iOS, following the instruction step by step.
git clone git://git.videolan.org/vlc-ports/ios.git
sh buildAspenProject.sh -s -k 7.0
And I get this compiling error:
cd builds/unix; /bin/sh ./configure '--without-png' '--prefix=/Users/change/Desktop/VLC_Library/ios/ImportedSources/vlc/contrib/i686-apple-darwin11-i386' '--build=i686-apple-darwin10' '--host=i686-apple-darwin11' '--target=i686-apple-darwin11' '--program-prefix=' '--enable-static' '--disable-shared' '--disable-dependency-tracking' '--with-pic'
configure: WARNING: unrecognized options: --disable-dependency-tracking
checking build system type... i686-apple-darwin10
checking host system type... i686-apple-darwin11
checking for i686-apple-darwin11-gcc... xcrun clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether xcrun clang accepts -g... yes
checking for xcrun clang option to accept ISO C89... none needed
checking how to run the C preprocessor... xcrun cc -E
checking for i686-apple-darwin10-gcc... no
checking for gcc... gcc
checking for gcc... (cached) gcc
checking for suffix of native executables... rm: conftest.dSYM: is a directory
ld: building for MacOSX, but linking against dylib built for iOS Simulator file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/usr/lib/libSystem.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure: error: native C compiler is not working
make[1]: *** [setup] Error 1
make: *** [.freetype2] Error 2
The environment:
XCode 5.0
MountainLion 10.8.4
iPhoneSimulator SDK 7.0
The invocation
$ ld -v
#(#)PROGRAM:ld PROJECT:ld64-224.1
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 armv6m armv7m armv7em
LTO support using: LLVM version 3.3svn, from Apple Clang 5.0 (build 500.2.75)
How do I fix this problem?
Appreciate if any suggestion or idea.

That got me further but got stumped by missing download URL for modplug-xmms.
VLC is insisting on downloading a copy of the source from
MODPLUG_GIT_HASH := 9b08cc646c3dc94dd446ab0671e3427dae8a83fc
MODPLUG_URL := http://sourceforge.net/code-snapshots/git/m/mo/modplug-xmms/git.git/modplug-xmms-git-$(MODPLUG_GIT_HASH).zip
which does not exist as of this time. (Server down?)
I did find of the copy of the source under
http://sourceforge.net/projects/modplug-xmms/files/latest/download/libmodplug-0.8.8.4.tar.gz
I downloaded it and installed it manually:
../ios/ImportedSources/vlc/contrib/iPhoneSimulator-i386/libmodplug

This is a known problem with Xcode 5 for which I don't have a fix yet.
To workaround, go to ImportedSources/vlc/contrib/iPhoneSimulator-i386 and run "make .freetype2". Afterwards, go back to the top directory and run the buildAspen script again.
Note that you'll need to do the same thing (with "iPhoneOS-armv7" and "iPhoneOS-armv7s" respectively) if you decide to compile for iOS devices at a later point.
I hope to fix this shortly. Enjoy hacking VLC for iOS!

Related

Build C Library from makefile for ios and not macos

I have a makefile that builds some C files and if I run it on an M1 mac the resulting library has the architecture arm64 which I thought it what is necessary for them to compile with an Xcode project for iOS. I discovered I can run the command otool -l libf2c.a | grep platform which should tell me what it was compiled for and in my case it returns platform1 which indicates macOS. Based on this, I think I need a value of platform2 for iOS.
The reason this is an issue is because in Xcode I get the error ld: building for iOS, but linking in object file built for macOS, file '/Users/e.../close.o' for architecture arm64.
Based on what I have been researching it seems iOS and macOS have the same architecture (arm64) but are a different 'platform'? But, I am not sure how the platform is determined. Is there some setting in my makefile I need to specify the platform? I am assuming that if I am able to get the platform to be iOS then Xcode will cooperate and be able to build the library I have generated.
The preferred way to compile for iOS via command line would probably be to use the xcrun command. This will allow you to specify the correct SDK for the platform you actually want to run on. For example:
prompt$ xcrun --sdk iphoneos --toolchain iphoneos clang -c test.c -o test.o -arch arm64
prompt$ otool -v -l test.o | grep platform
platform IOS
TL;DR: change your compiler invocation from plain clang to xcrun --sdk iphoneos --toolchain iphoneos clang.

symbol(s) not found for architecture x86_64 in libssl.a when building it for pjsip

I am trying to build PJSIP library for IOS simulator with openssl support.
I followed the instructions mentioned in this link
https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone
PJSIP website directs to Openssl wiki installation and instructions page for guidance.
so to build openssl for my iPhone simulator these were the commands which i gave.
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
KERNEL_BITS=64 ./Configure darwin64-x86_64-cc no-shared no-dso no-hw no-engine --prefix=$HOME/ssl
make depend
make
make install_sw
After this i am able to see that openssl seems to build without any errors or warnings in terminal in the folder path i mentioned in command.
so to double check ,i use this command on the libssl.a file
lipo -info libssl.a
Non-fat file: libssl.a is architecture: x86_64
I seem to be very happy after seeing that lib file is built successfully.
Now next step is link this with pjsip library build.
I follow the steps mentioned in pjsip website.
These are the commands which i fed into my terminal
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
ARCH="-arch x86_64" CFLAGS="-O2 -m64 -mios-simulator-version-min=5.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=5.0" ./configure-iphone --with-ssl=/Users/nexgetech01/ssl
make dep && make
As mentioned in pjsip website,i am able to see that my newly build openssl library has been successfully linked and tested by pjsip commands in terminal
checking for OpenSSL installations..
Using SSL prefix... /Users/nexgetech01/ssl
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... no
aconfigure: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!
aconfigure: WARNING: openssl/ssl.h: proceeding with the compiler's result
checking for openssl/ssl.h... yes
checking for ERR_load_BIO_strings in -lcrypto... yes
checking for SSL_CTX_new in -lssl... yes
OpenSSL library found, SSL support enabled
So everything seems too good and continue that process.But end of that compilation im stuck with this errors
Undefined symbols for architecture x86_64:
"_opendir$INODE64", referenced from:
_OPENSSL_DIR_read in libcrypto.a(o_dir.o)
"_readdir$INODE64", referenced from:
_OPENSSL_DIR_read in libcrypto.a(o_dir.o)
ld: symbol(s) not found for architecture x86_64
So to make sure that,i used the following command on terminal on my libcrypto.a
nm -A libcrypto.a |grep OPENSSL_DIR_rea
libcrypto.a:o_dir.o: 0000000000000000 T _OPENSSL_DIR_read
i can find that as undefined in my libcrypto.a.i dont know what i am missing while building the openssl library??Im stuck with building this openssl library for a week.Please direct me so i can sort this out.

dsymutil missing compiling GNU bash on iOS

I'm trying to compile GNU bash 4.3.30 on (and for) my iPad 2, iOS 8.4 using Clang, ld64, cctools, GNU make and the iOS 8.1 SDK. When processing bashversion, Clang is "unable to execute dsymutil", and reports that it "doesn't exist", exiting with error 1.
$ make
(...)
"/usr/bin/ld" -demangle -dynamic -arch armv7 -iphoneos_version_min 5.0.0 -syslibroot /var/mobile/iPhoneOS8.1.sdk -o bashversion -lcrt1.3.1.o -L./lib/termcap /var/tmp/bashversion-814fa1.o buildversion.o -lSystem
"dsymutil" -o bashversion.dSYM bashversion
clang: error: unable to execute command: Executable "dsymutil" doesn't exist!
clang: error: dsymutil command failed with exit code 1 (use -v to see invocation)
make: *** [bashversion] Error 1
$ echo $CC
clang --sysroot /var/mobile/iPhoneOS8.1.sdk -v
$ clang --version
clang version 3.5.0 (trunk)
Target: armv7-apple-darwin-14.0.0
Thread model: posix
$ ld -v
#(#)PROGRAM:ld PROJECT:ld64-
configured to support archs: i386 x86_64 armv4t armv5 armv6 armv7 armv7f armv7k armv8 arm64 arm64v8
$ which dsymutil
$ dsymutil
-sh: dsymutil: command not found
$ find / -name dsymutil
$
Apparently, my iPad has no dsymutil. So, where can I find one? Does it come with Xcode? Or is there any way to compile GNU bash 4.3.30 without it?
Dsymutil is a closed source tool, and is not available for iOS.
But that's not much of a problem, just create a symlink to /bin/true,
i.e.
ln -s /bin/true /usr/bin/dsymutil

Error compiling freetype2 library for arm7 with OSX gcc: `limits.h: No such file or directory

I am trying to compile the freetype2 library for arm7, using Xcode's command line tools in OSX. I am using the following parameterisation of the project's configure script:
Compiling FreeType for iPhone?
These errors were produced when running the script:
configure:3426: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -E conftest.c
In file included from conftest.c:10:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin10/4.2.1/include/limits.h:15:25: error: limits.h: No such file or directory
configure:3426: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -E -traditional-cpp conftest.c
conftest.c:12: error: assert.h: No such file or directory
configure:3426: /lib/cpp conftest.c
/Volumes/DATA/filestore/development/libs/c/freetype2/extract/2.5.3/builds/unix/configure: line 1600: /lib/cpp: No such file or directory
configure:3465: result: /lib/cpp
configure:3485: /lib/cpp conftest.c
/Volumes/DATA/filestore/development/libs/c/freetype2/extract/2.5.3/builds/unix/configure: line 1600: /lib/cpp: No such file or directory
I can see that the missing files actually do exist in the directories output in the error messages.
CFLAGS and LDFLAGS contain the following parameter, which should allow for the inclusion of system header files:
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/
The other odd thing that I noticed with these error messages, is that the architecture identifier in the directory structures is i686-apple-darwin10. The -arch armv7 compiler flag is being used, so why are i686-apple-darwin10 directories being inspected at all?
* UPDATED *
I also tried parameterising the configure script as per another example:
https://stackoverflow.com/a/12594507/1704014
The following error terminated its execution:
checking for suffix of native executables... ld: library not found for -lcrt1.10.6.o
collect2: ld returned 1 exit status
configure: error: native C compiler is not working
This also indicates that a different target architecture (OSX 10.6) is being built against, not arm7.
Any help much appreciated.
The problem in my OSX build environment was the Xcode command line tools installation. I reinstalled the latest distribution of the tools, and was able to compile successfully from then on.
To build the freetype2 library for arm7 and arm7s architectures, I found the following suggested commands useful:
https://stackoverflow.com/a/12594507/1704014

Failed to build gem native extension

End result is I'm trying to get Ruby on Rails installed on my OS 10.7.3, but having various issues.
Also, I have a freshly installed XCode 4.3 from the App Store.
When I fire up the terminal, and enter:
sudo gem install rails
and it writes out:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.5/ext/json/ext/parser/gem_make.out
In all of the fixes I'm finding says to install XCode, which I have and runs just fine. However, I did uninstall a previous version of XCode to install the latest version, so I'm wondering if there is any relation there.
EDIT 1:
I've followed Jasdeep suggestion and installed RVM. But once i run:
sudo rvm install 1.9.3
I get the following:
Fetching yaml-0.1.4.tar.gz to /Users/xxx/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/xxx/.rvm/src
Configuring yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/xxx/.rvm/usr" ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/yaml/configure.log
Compiling yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/yaml/make.log
Database file /Users/xxx/.rvm/config/packages does not exist.
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Installing Ruby from source to: /Users/xxx/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...
ruby-1.9.3-p0 - #fetching
ruby-1.9.3-p0 - #downloading ruby-1.9.3-p0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9330k 100 9330k 0 0 645k 0 0:00:14 0:00:14 --:--:-- 1260k
ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /Users/xxx/.rvm/src/ruby-1.9.3-p0
ruby-1.9.3-p0 - #extracted to /Users/xxx/.rvm/src/ruby-1.9.3-p0
ruby-1.9.3-p0 - #configuring
Error running ' ./configure --prefix=/Users/xxx/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/xxx/.rvm/usr ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/configure.log
There has been an error while running configure. Halting the installation.
So then I looked up what was in the log file, ..ruby-1.9.3-p0/yaml/configure.log:
[2012-03-03 22:49:50] ./configure --prefix="/Users/xxx/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/Users/xxx/.rvm/src/yaml-0.1.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
So now it appears the error is:
no acceptable C compiler found in $PATH
Edit 2:
I've followed matt's instructions and was able to get further once I got the command-line tools installed (since I have Xcode 4.3 now). However, I'm still getting an error:
Fetching yaml-0.1.4.tar.gz to /Users/xxx/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/xxx/.rvm/src
Configuring yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/xxx/.rvm/usr
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Installing Ruby from source to: /Users/xxx/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...
ruby-1.9.3-p0 - #fetching
ruby-1.9.3-p0 - #extracted to /Users/xxx/.rvm/src/ruby-1.9.3-p0 (already extracted)
ruby-1.9.3-p0 - #configuring
Error running ' ./configure --prefix=/Users/xxx/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/xxx/.rvm/usr ', please read /Users/xxx/.rvm/log/ruby-1.9.3-p0/configure.log
There has been an error while running configure. Halting the installation.
Below is the configure.log (sorry this post is getting so long, but hopefully it can help others too):
[2012-03-04 09:29:35] ./configure --prefix="/Users/xxx/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-apple-darwin11.3.0
checking host system type... x86_64-apple-darwin11.3.0
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for doxygen... false
checking for ANSI C header files... (cached) yes
checking for stdlib.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
configure: creating ./config.status
config.status: creating yaml-0.1.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating tests/Makefile
config.status: creating win32/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
The problem is that in Lion Xcode 4.3 doesn't by default install (or even include) the command-line tools such as gcc - and those are what are needed here. In the Downloads pane of Xcode's prefs, under Components, ask for the command-line tools. (See the readme: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Chapters/xcode_4_0.html#//apple_ref/doc/uid/TP40016147-SW35)
Actually I believe you didn't need to install Xcode at all, since in fact the command-line tool can now be downloaded and installed separately.
I already had Command-line tools installed (xCode as well)... and still had this (initial) error.
The problem was that xCode and the command line tools are no longer installing the gcc compiler. I don't know when they stopped shipping it, but I run mountain lion, and it's not here.
So what eventually solved my problem was installing gcc from scratch (https://github.com/kennethreitz/osx-gcc-installer).
Keep Smiling :)
If someone has the same problem for Ubuntu Linux, the solution was:
sudo apt-get install build-essential
sudo apt-get install libsqlite3-dev

Resources