I built a project to iPhone and debugging it in Xcode 4.3.2 works fine. However, I want to debug it in command line, so I run:
xcodebuild -target NAMEOFTARGET -sdk SDKPATH -configuration Release
it should be the same as in Xcode, but I'm getting some errors and it does not compile! Maybe someone could help...
-Prefix-cfqwmqlvdeltqcceqguoaugscmoq/Igor2305-Prefix.pch.d
error: can't exec '/opt/local/bin/gcc-apple-4.2' (No such file or directory)
Command /opt/local/bin/gcc-apple-4.2 failed with exit code 71
** BUILD FAILED **
The following build commands failed:
ProcessPCH /var/folders/d7/sx0vvl0537l4x7md9b35m7br0000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Igor2305-Prefix-fwljjtsqayhghvfeivuxdyjuvt/Igor2305-Prefix.pch.pth Igor2305/Igor2305-Prefix.pch normal armv6 objective-c com.apple.compilers.llvm.clang.1_0.compiler
ProcessPCH /var/folders/d7/sx0vvl057l4x7md9b35m7br00gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Igor2305-Prefi-cfqwmqlvdeltqceqguoaugscmoq/Igor2305-Prefix.pch.pth Igor2305/Igor2305-Prefix.pch normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
It's looking for GCC in /opt/ and not finding it. That's not a standard installation location for the GCC bundled with Xcode. The following command will tell you where Xcode is looking for its developer tools:
xcode-select -print-path
To change it, run:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
That path is for the standard Xcode installation location as installed through the App Store. If you've installed it elsewhere, you'll have to alter the path accordingly.
Related
I recently reformatted my Mac. Today I tried building a swift executable via Terminal to start a server-side swift project. Here are the commands I've used:
swift package init --type executable
swift build
Upon running swift build, I got the following errors:
xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
I'm running Xcode 8.3.1.
Thanks in advance!
Try fixing the SDK path (yours appears incorrect):
$ xcrun --show-sdk-path --sdk macosx
You might have this result:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Switch the default SDK location by invoking:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
If that doesn't work then take a look inside the (normal) SDK path:
$ ls -lat /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
You should see the SDK's within that directory; if not you'll need to download them.
Select a version of Xcode which can run the swift build command by running, for instance:
sudo xcode-select -switch /Applications/Xcode-8.3.3.app
Where Xcode-8.3.3 is the name of your Xcode application
I am getting this error while building the SwiftJSON framework to the Some Xcode project through Carthage Dependency Manager.
Sivaramaiahs-Mac-mini:GZipDemoApp vsoftMacmini5$ carthage update
--platform iOS
*** Fetching GzipSwift
*** Fetching SwiftyJSON
*** Checking out GzipSwift at "3.1.1"
*** Downloading SwiftyJSON.framework binary at "3.1.3"
*** xcodebuild output can be found in /var/folders/7m/y0r2mdhn0f16zz1nlt34ypzr0000gn/T/carthage-xcodebuild.apLXCc.log
A shell task (/usr/bin/xcrun xcodebuild -project
/Users/vsoftMacmini5/Desktop/GZipDemoApp/Carthage/Checkouts/GzipSwift/Gzip.xcodeproj
CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list)
failed with exit code 72:
xcrun: error: unable to find utility "xcodebuild", not a developer
tool or in PATH
I solved that problem by setting the Command Line Tools in Xcode. Go to:
Xcode > Preferences > Locations
And select the command line tool from the dropdown. If you have only one version of Xcode installed, there should be only one option. If you have several versions of Xcode, then you must choose the one you need.
Update (added image for reference)
The simplest fix is from CLI:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
(this should be path to your Xcode.app)
By the way this can happen even if you have only one version of Xcode . It happens when you instal homebrew before the first Xcode installation (which makes sense because you may want to install Xcode through mas install 497799835 and mas needs homebrew).
Following command worked for me
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
I'm trying to compile VLC player for iOS.
I've cloned git from repo, a tried to run "buildMobileVLC.sh" (using this wiki documentation)
$ git clone git://git.videolan.org/MobileVLC.git
$ cd MobileVLC
$ ./buildMobileVLC.sh
But as the result I have in terminal next:
SDKROOT not specified, assuming /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
*** /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk does not exist, please install required SDK, or set SDKROOT manually. ***
Even this
./buildMobileVLC.sh -k iphoneos5.0
can't help to solve the problem
P.S. When I try:
./buildMobileVLC.sh -h
It says
-k Specify which sdk to use (see 'xcodebuild -showsdks', current: iphoneos5.0)
What am I doing wrong? And should I install iPhone SDK 5.1, if "yes", then how?
UPD:
I changed
SDK_VERSION=5.0
in file "build.sh" in /Users//MobileVLC/ImportedSources/vlc/extras/package/ios
The error disappeared but the new error in Terminal is:
./libavutil/arm/asm.S:180:cannot use register index with PC-relative addressing -- `ldr r4,[pc,r4]'
./libavutil/arm/asm.S:180:cannot use register index with PC-relative addressing -- `ldr lr,[pc,lr]'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libavcodec/arm/ac3dsp_armv6.o] Error 1
make: *** [.ffmpeg] Error 2
Yes you should install the iOS SDK, you can get it by installing Xcode from the Appstore.
Error is telling you that the SDK can not be found, after you install Xcode the SDK will be installed.
With the new Xcode the SDK is in the Xcode bundle, /Applications/Xcode.app/Contents/Developer
As suggest you could set the SDKROOT to this path if it can't find the SDK.
It appears that the mobile build for VLC is broken: http://forum.videolan.org/viewtopic.php?f=12&t=103322
I have such a problem.
I used Xcode 3.2.5 earlier then I have installed 4.1 Xcode into Developer folder, so my Xcode 3.2.5 was automatically removed to Xcode 3.2.5 folder. So I was a happy iOs developer with 2 Xcodes. But then I decided to install Xcode 4.2( into Developer folder too). First time no any Xcode could be launched. After reboot everything became ok. Except this:
CodeSign build/Debug-iphoneos/MyTest.app
cd /Users/alexslabinsky/Desktop/MyTest
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv _CODESIGN_ALLOCATE_ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
/usr/bin/codesign -f -s "iPhone Developer: Alex Slabinsky (NUMBERS_here)" --resource-rules=/Users/alexslabinsky/Desktop/MyTest/build/Debug-iphoneos/MyTest.app/ResourceRules.plist --entitlements /Users/alexslabinsky/Desktop/MyTest/build/MyTest.build/Debug-iphoneos/MyTest.build/MyTest.xcent /Users/alexslabinsky/Desktop/MyTest/build/Debug-iphoneos/MyTest.app
/Users/alexslabinsky/Desktop/MyTest/build/Debug-iphoneos/MyTest.app: object file format invalid or unsuitable
Command /usr/bin/codesign failed with exit code 1
I tried almost all what could find here and by Google.com but nothing helps. Please, help me. Thanks.
I've personally had upgrade issues several times in relation to using XCode 4.x, where the only thing that solved my problems was to completely uninstall the existing Dev Tools, reboot, and then install the new ones. Uninstall is done via:
sudo <Xcode>/Library/uninstall-devtools --mode=all
I select "Build to Archive" in XCode 4.2, and the following error appears:
Validate "/Users/merlin/Motivapps/DerivedData/GoalWorkshop2-gzesusxljzqjkmbznfkkmylstlca/ArchiveIntermediates/GoalWorkshop2/InstallationBuildProductsLocation/Applications/Goal Wshop.app"
cd /Users/merlin/Motivapps/GoalWorkshop2
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv PRODUCT_TYPE com.apple.product-type.application
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation "/Users/merlin/Motivapps/DerivedData/GoalWorkshop2-gzesusxljzqjkmbznfkkmylstlca/ArchiveIntermediates/GoalWorkshop2/InstallationBuildProductsLocation/Applications/Goal Wshop.app"
2011-06-10 17:10:48.879 Validation[15683:607] *** Warning: Defaulting to the standard codesign tool
warning: There is no codesign_wrapper executable. Please reinstall the Xcode developer tools. (-19058)
Unable to validate your application. - (null)
The same configuration worked well with previous XCode, and I just double checked - code sign certificates are valid. Suggestions?
Just change your selected Xcode version like this:
$ xcode-select -print-path
/Xcode42
$ sudo xcode-select -switch /Xcode402
Password:
$ xcode-select -print-path
/Xcode402
The only solution I found was to remove XCode 4.2beta from the system, and reinstall the previous version - it helped. Beta versions are not meant to build release builds I guess.