I have an Xcode project (Xcode 6.3.1) with the following library search paths set:
"$(SRCROOT)/Libraries/ScaleformLib/${CURRENT_ARCH}/clang/${CONFIGURATION}_NoRTTI"
"$(SRCROOT)/Libraries/ScaleformLib/${CURRENT_ARCH}/clang/"
When building I get linker errors, which seem to be due to the CURRENT_ARCH variable not expanding correctly (paths shortened/removed for clarity):
Ld Unity-iPhone.build/Objects-normal/armv7/mud normal armv7
cd builds/iOSSubmission
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
clang++ -arch armv7 -isysroot
-L/builds/iOSSubmission/Libraries/ScaleformLib/arm64/clang/Release_NoRTTI
-L/builds/iOSSubmission/Libraries/ScaleformLib/arm64/clang
I'm unsure why arm64 is being inserted into the search paths when it seems like it should be armv7? What am I missing?
Thanks!
Original answer was wrong but this one works.
So for us, it came down to header search path for a .dylib. We needed libxml2 so we had header search path set to
/usr/include/libxml2
This isn't SDK dependent (shouldn't the dylib actually link to the SDK we're using?) so we changed it to:
$(SDKROOT)/usr/include/libxml2
And everything was fine.
Related
I'm trying to compile a very small amount of C source into a library that I can use in XCode for an iOS application.
The files are a single .c file and three header files. I'm very new to C, and no matter what I try I can't seem to get them to compile into a library that supports iOS architectures.
The files depend on the openssl library, and I've got that installed and working fine.
I just need to know the process of compiling these four files into a single library. I've found a plethora of information on the subject online, but I can't decipher which parts are necessary for what I'm trying to do.
I've tried the following:
gcc -fPIC -c main.c
gcc -shared -o mylib.so main.o -lcrypto -lssl
which seems to compile it for x86_64, (I've not tested the resulting file, just checked it's arch).
I've also tried
./configure --disable-shared --enable-utf8 --host=arm-apple-darwin CFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk" CXXFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk" LDFLAGS="-L." CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"
which only gives me errors
checking for arm-apple-darwin-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/nathanf/compilec':
configure: error: C compiler cannot create executables
I've been scouring the internet for the last few days trying to figure this out, but it's so convoluted to cross compile just a few files and I'm frustrated so I came here for some input.
Any help would be greatly appreciated.
Does anyone know the correct flags to pass to make in order to cross compile LuaJIT for the iOS Simulator? I managed to get it running on a device, but I am having trouble building for the simulator, I can't find a working example anywhere on the webs.
Thanks!!
Inside LuaJIT checkout (I'm using v2.1 branch):
IXCODE=`xcode-select -p`
ISDK=$IXCODE/Platforms/iPhoneSimulator.platform/Developer
ISDKVER=iPhoneSimulator8.1.sdk
ISDKP=/usr/bin/
ISDKF="-arch i386 -isysroot $ISDK/SDKs/$ISDKVER"
make clean
make HOST_CFLAGS="-arch i386" HOST_LDFLAGS="-arch i386" TARGET=x86 CROSS=$ISDKP TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
This is the error message I am getting:
ld: building for MacOSX, but linking against dylib built for iOS Simulator file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk/usr/lib/libSystem.dylib' for architecture i386
Building for armv7 works:
IXCODE=`xcode-select -p`
ISDK=$IXCODE/Platforms/iPhoneOS.platform/Developer
ISDKVER=iPhoneOS8.1.sdk
ISDKP=/usr/bin/
ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
make clean
make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
add -mios-simulator-version-min=8.1 to your TARGET_FLAGS
ISDKF="-arch i386 -isysroot $ISDK/SDKs/$ISDKVER"
should be
ISDKF="-arch i386 -mios-simulator-version-min=8.1 -isysroot $ISDK/SDKs/$ISDKVER"
you may also have to set the
BUILDMODE="static"
and you may need to set ios-simulator-version-min to match the simulator sdk version. 8.2 is for Xcode 6.2.
I am trying to create a Objective C static library for iOS. When I try to compile it gives following warnings.
Libtool /Users/******/Library/Developer/Xcode/DerivedData/MyLib-eyucoczochpovhcqduwoieknpyer/Build/Intermediates/MyLib.build/Debug-iphoneos/MyLib.build/Objects-normal/armv7/libMyLib.a normal armv7
cd /Users/******/Desktop/MyLib
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only armv7 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -L/Users/******/Library/Developer/Xcode/DerivedData/MyLib-eyucoczochpovhcqduwoieknpyer/Build/Products/Debug-iphoneos -filelist /Users/******/Library/Developer/Xcode/DerivedData/MyLib-eyucoczochpovhcqduwoieknpyer/Build/Intermediates/MyLib.build/Debug-iphoneos/MyLib.build/Objects-normal/armv7/MyLib.LinkFileList -ObjC -framework Foundation -o /Users/shafraz/Library/Developer/Xcode/DerivedData/MyLib-eyucoczochpovhcqduwoieknpyer/Build/Intermediates/MyLib.build/Debug-iphoneos/MyLib.build/Objects-normal/armv7/libMyLib.a
I am getting similar errors for armv7s, arm64 also
(null): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for library: /Users/******/Library/Developer/Xcode/DerivedData/MyLib-eyucoczochpovhcqduwoieknpyer/Build/Products/Debug-iphoneos/libMyLib.a for architecture: armv7 the table of contents is empty (no object file members in the library define global symbols)
I am getting similar errors for armv7s, arm64 also
This worming shown only after removing MyLib.m and class declaration in MyLib.h file.
How can I fix this?
This generally happens if your static library contains nothing but categories or informal protocols. The linker is warning you that you don't seem to have any classes to link.
In my case, I realized that the library I wrote ended up being a header only library. That implies I don't even need to compile a library, just include the headers in "Header Search Paths" in "Build settings".
I was working on a project and all were going well until I decide to clean my project.
The following errors appears only when I run my app on simulator (working fine on a real device) :
Libtool /Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Products/Debug-iphonesimulator/libShareKit.a normal i386
cd "/Users/Yaman/Documents/iOS - App à vendre/Homeless/Submodules/ShareKit"
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Products/Debug-iphonesimulator -filelist "/Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Intermediates/ShareKit.build/Debug-iphonesimulator/Static Library.build/Objects-normal/i386/ShareKit.LinkFileList" -ObjC -all_load -lCopy -lDelicious -lDiigo -lEmail "-lEvernote SDK" -lEvernote -lFacebook "-lFlickr SDK" -lFlickr -lFoursquareV2 "-lGoogle Reader" -lInstagram -lInstapaper -lJSONKit -lKippt -lLinkedIn -lLogout -lOAuth "-lOpen in Safari" -lPinboard -lPrint -lReachability "-lRead It Later" "-lSave to Album" -lShareKitCore "-lSina Weibo" -lSSKeyChain "-lText Message" -lTumblr -lTwitter -lVKontakte -o /Users/Yaman/Library/Developer/Xcode/DerivedData/Homeless-gujyzhsiwenufvedlinbbtrizcpd/Build/Products/Debug-iphonesimulator/libShareKit.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified, -all_load invalid
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lReachability
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lReachability is not an object file (not allowed in a library)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1
I got these errors when running command xcodebuild directly from a terminal :
** BUILD FAILED **
The following build commands failed:
Libtool "build/ShareKit.build/Release-iphoneos/Static Library.build/Objects-normal/armv7/libShareKit.a" normal armv7
Libtool "build/ShareKit.build/Release-iphoneos/Static Library.build/Objects-normal/armv7s/libShareKit.a" normal armv7s
(2 failures)
Someone can figure out what's happened here ?
I just got this error. The project works very well, you add a new lib and BAM, build failed.
I my case, Xcode5 had added some special \" around my header search paths values.
Like that :
\"$(SRCROOT)/myproject/Libraries/lib\"
Quite impossible to find out, but when spending hours to find where is the problem, I finally tried to change to
$(SRCROOT)/myproject/Libraries/lib
And the build success came back... thanks Xcode!
The first error note says that compiling ShareKit failed, because Reachability is missing. I'd propose that you check your compiling environment has latest (or compatible) version of the library.
That's why libShareKit.a mentioned in last error note is missing and compiling your app failed. Try to compiling ShareKit alone and when it's done, try again the whole app.
I attempt to Create a Xcode-WorkSpace,there are there projects in it. Now the first Project is a static library base on ZBar Code Reader.I already download the source code ,now I drag the finder named "src" into my first project. When I bulid it,here is the problem:
Libtool /Users/asset/Library/Developer/Xcode/DerivedData/huishow1-efdjffeirjufbndvocvtzkrzkwss/Build/Products/Debug-iphonesimulator/libZBarTest.a normal i386
cd /Users/asset/iPhone_Tmp/ZBarTest
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool -static -arch_only i386 -syslibroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/asset/Library/Developer/Xcode/DerivedData/huishow1-efdjffeirjufbndvocvtzkrzkwss/Build/Products/Debug-iphonesimulator -L/Users/asset/iPhone_Tmp/ZBarTest/SDK -L/Users/asset/iPhone_Tmp/ZBarTest/SDK3 -filelist /Users/asset/Library/Developer/Xcode/DerivedData/huishow1-efdjffeirjufbndvocvtzkrzkwss/Build/Intermediates/ZBarTest.build/Debug-iphonesimulator/ZBarTest.build/Objects-normal/i386/ZBarTest.LinkFileList -lxml2 -ObjC -framework Foundation -lzbar -o /Users/asset/Library/Developer/Xcode/DerivedData/huishow1-efdjffeirjufbndvocvtzkrzkwss/Build/Products/Debug-iphonesimulator/libZBarTest.a
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool failed with exit code 1
Who can help me?
Sounds like a missing dependency. I'm not familiar with the ZBar code reader but I'd imagine it declares dependencies on some system frameworks that you haven't yet included in your app? Look in the docs for ZBar to determine which frameworks you need to link to when including it. Typically when you get these types of libtool errors when you don't include a framework or other dependency.