For users having trouble building cordova/phonegap apps to send to Facebook for review of permissions using the following command:
xcodebuild arch i386 sdk iphonesimulator7.1
and getting errors like:
file not found #import ...
Here's the solution:
Follow these instructions:
https://developers.facebook.com/docs/ios/creating-ios-simulator-build-for-review
Use this command to build your app
xcodebuild -project HelloWorld.xcodeproj -arch i386 -target HelloWorld -configuration Debug -sdk iphonesimulator clean build VALID_ARCHS=i386 CONFIGURATION_BUILD_DIR=/Users/pedro/Documents/Cordova/HelloWorld/platforms/ios/build
If you want to read more about it, I found the solution here:
https://groups.google.com/forum/#!topic/oclint-users/GD1a242k_X0
Related
In iOS Framework project, we have Obj C and Swift code, we build a .framework and distribute through our code repo for other app projects to integrate.
The build we generate is an universal framework, so that it works on device as well as simulator.
Recently in Xcode 12 iOS 14, the build generation failed as we use lipo to combine the frameworks for simulator and device architectures as shown here iOS 14, lipo error while creating library for both device and simulator, as suggested in the answer, excluded the arm64 arch from simulator build then the lipo cmd worked and Framework got built, following is the build command(s) we use
simulator:
MySDK -target MySDK ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}/DependentBuilds" EXCLUDED_ARCHS="arm64"
device:
MySDK -target MySDK ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}/DependentBuilds"
Now when this .framework is integrated with other app project(MyProject) using cocoapods. Upon building the project with below command gives following errors
xcodebuild install -scheme MyProject -workspace MyProject.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 8'
Errors
** INSTALL FAILED **
The following build commands failed:
CompileSwift normal x86_64
CompileSwift normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
CompileSwift normal x86_64
/Users/path/to/MyProject/Pods/MySDK/MySDK.framework/Modules/MySDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:21:96: error: 'someStruct' is not a member type of 'MySDK'
#objc public func someMethod(some: args) -> Swift.void)
Note: The project with MySDK(Framework) integrated works fine we run on a device or simulator through Xcode, but when the above command is run it is giving these errors
Hello hello community!
So here is my issue, welll not really an issue but the following Run Script compiles my static library and it works great! my only issue is that it doesnt compile it for the simulator and i get a x86_64 error. I know that i could just edit this code to make it compatible can someone tell me what i need to do??
# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# Step 1. Build Device and Simulator versions
xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}"
BUILD_ROOT="${BUILD_ROOT}" xcodebuild -target ${PROJECT_NAME} -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"
# Last touch. copy the header files. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}"
In referencing to a "build a framework" project done here. I was able to find that i can add additional builds just by adding an additional "-arch" parameter. and just make the xcodebuild command
xcodebuild -target ${PROJECT_NAME} -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 -arch x86_86 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
and it solved my problem! just in case anyone had a slow moment like i did. lol
Recently I'm trying to use Jenkins for Oclint statically analyzing objective-c sources.
So I followed the guide on the Oclint.org, especially this page oclint_guide_with_Jenkins
And then, I run the build job on the Jenkins.
But the job was always failed with below logs.
(Extra logs were just about svn check-out)
+ oclint-json-compilation-database -- -report-type pmd -o oclint.xml -rc=LONG_LINE=120
Error: compile_commands.json not found at current location.
Can anyone show me the way to solve this problem? :)
You need to generate the compile_commands.json , I am not sure if xcodebuild can do that , but you can use Facebook's xctool : https://github.com/facebook/xctool which is a wrapper over xcodebuild and provides different reporters.
You can use Homebrew to install xctool as well, once install use the following commands to generate compile_commands.json and then run the oclint command.
If you have a workspace file :
xctool -scheme $scheme -workspace $workspaceFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -reporter json-compilation-database:compile_commands.json build
If you have project file :
xctool -scheme $scheme -project $projectFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -reporter json-compilation-database:compile_commands.json build
Issues between xcodebuild and Jenkins prompted me to try xcodebuild on a vanilla Empty Application template where it still fails:
>> xcodebuild -target FizzBuzz -sdk iphonesimulator7.0 -arch i386
The following build commands failed:
ProcessPCH /var/folders/64/<someHash>/C/com.apple.DeveloperTools/5.0-5A1413/\
Xcode/SharedPrecompiledHeaders/FizzBuzz-Prefix-<someHash>/FizzBuzz-Prefix.pch.pch
FizzBuzz/FizzBuzz-Prefix.pch
normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
>> xcodebuild -version
Xcode 5.0
Build version 5A1413
What is the proper incantation of xcodebuild?
These 3 were the key issues for me:
xcodebuild was still relying on gcc-4.7 (Command Line Tools installed or not). Check $CC and unset $CC to let clang do its job.
Use the -scheme option with xcodebuild ...
... and ONLY_ACTIVE_ARCH=NO.
I have an xcode Objective-C iPhone static library project. When I build it in xcode I get no errors or warnings. But when I build it using xcodebuild from the command line I get:
"/Developer/usr/bin/gcc" -v -dM -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk -E -arch armv6 -o - -x objective-c /dev/null
gcc-4.2: error trying to exec '/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1': execvp: No such file or directory
I cannot find anything that helps me to understand what the issue is, any ideas?
And yes the /Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 file does exist :-)
For some reason what seemed to fix this for me is actually passing in the architectures to be used.
For instance, this command fails:
/Developer-SDK4/usr/bin/xcodebuild -target ProjectName -configuration Release build PLATFORM_NAME=iphonesimulator BUILDSDK=/Developer-SDK4
But this one works:
/Developer-SDK4/usr/bin/xcodebuild -target ProjectName -configuration Release build PLATFORM_NAME=iphonesimulator BUILDSDK=/Developer-SDK4 ARCHS=i386
Note, this only failed for me when building against the simulator. Building against the device seemed to work just fine.