Carthage update fail with exit code 1 when upgrade MacOs and Xcode - swift

After upgrade your OS and/or your Xcode.
When you run
$ carthage update --platform iOS --no-use-binaries
you would get an output like:
Fetching FooLibrary
A shell task (/usr/bin/env git fetch --prune --quiet https://github.com/foodeveloper/FooLibrary.git refs/tags/:refs/tags/ +refs/heads/:refs/heads/ (launched in /Users/yourUser/Library/Caches/foo.package/dependencies/FooLibrary)) failed with exit code 1

This issue happen with Carthage 0.33.0 and Xcode 11.
To solve this issue:
First: Open your new Xcode and select the last CLI to make sure that you are using the last CLI.
Command Line Tool - Error - xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH
Second: Please You could fix it by deleting the cache of Carthage:
rm -rf ~/Library/Caches/org.carthage.CarthageKit
source: https://github.com/ashleymills/Reachability.swift/issues/340

Related

Running Swift build in Terminal leading to "Platform Path" errors

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

Command Line Tool - Error - xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

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

How to install Swift package via package manager?

I am currently following the document from swift.org to play around with the new Swift Package Manager.
I cloned the demo project from Github and run the following command from terminal.
git clone https://github.com/apple/example-package-dealer.git
cd example-package-dealer
swift build
.build/debug/Dealer
While I run swift build, error arise.
<unknown>:0: error: no such file or directory: 'build'
Any idea?
I stuck for an hour. Sadly, it's just an epic fail that downloading the wrong swift package. If you want to use swift build, MAKE SURE you download the development version.
You did not add the newly installed swift to your PATH. The instructions for doing that are here.
On OS X:
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
On Linux:
export PATH=/path/to/Swift/usr/bin:"${PATH}"
Then to test it works:
swift build --version
I think it is a problem with the latest snapshot:
Ubuntu 14.04 Swift 2.2 Snapshot of January 11 contains swift-build in usr/bin
Ubuntu 14.04 Swift 2.2 Snapshot of January 25 doesn't contain swift-build in usr/bin
Besides, the January 25 release also seems to miss other files (libFoundation.so and libXCTest.so in usr/lib/swift/linux for instances).
Either there has been a structure change....or, simply, the latest snapshot had a problem ;)
While they fix the snapshot, simply take the older (January 11th) snapshot, and you should be fine.
I was facing the same issue and in my case, I recently updated my Xcode to 8.2.1 and swift 3.0 comes with it.
I was getting this log.
Ranvijay-Mac-mini:PerfectTemplate ranaranvijaysingh$ swift build
error: unable to invoke subcommand: /Library/Developer/CommandLineTools/usr/bin/swift-build (No such file or directory)
The path it was taking was incorrect. It was suppose to be:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
To change the path, run this command.
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH
And DONE.
Run : swift build again on your project and if you get this error.
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'
error: Invalid platform path
then you need to change the SDK path as well.
In my case, I had two .sdk at path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
MacOSX.sdk MacOSX10.12.sdk
To know what is your SDK path, run this command.
xcrun --sdk macosx --show-sdk-path
My case i got this.
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
To change it run this command.
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
and NOW DONE.
Try running swift build now.

Ionic emulate Ios fails to run The session does not open my app

Ionic emulate ios failed on Mac OS Yosemite. Their have some cases were the ios device emulated, but shortly after the terminal console shoots up the error message below.
** BUILD SUCCEEDED **
No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (code=146):
Invalid device state
An error was encountered processing the command (code=146):
Exception encountered connecting to CoreSimulatorBridge: Unable to connect to CoreSimulatorBridge
ENOENT, no such file or directory '/Users/yay/Library/Logs/CoreSimulator/2CAA2C39-7F22-4AF2-BBDE-86609188F37C/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/yay/code/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/yay/code/myApp/platforms/ios/cordova/console.log,--stdout,/Users/yay/code/myApp/platforms/ios/cordova/console.log,--exit
Error: /Users/yay/code/myApp/platforms/ios/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
The issue is because you used sudo to create and/or build the project.
Just input these commands (without the $ of course):
1) Remove with sudo
$ sudo ionic platform remove ios
2) Add iOS back without sudo
$ ionic platform add ios
3) Run iOS emulator
$ ionic emulate ios
Source: https://github.com/driftyco/ionic/issues/4052 (rajkotecha's comment)
Do NOT use sudo when creating or building the project.
Please see https://github.com/driftyco/ionic/issues/4052
I've encountered this issue before, and I believe you messed up with your permission. However, I managed to solve it by reinstall everything from scratch (NOT reformat OS). I suggest you may try to remove all your Xcode, ionic, cordova, and ios-sim content and reinstall again.
Delete your Xcode from your Mac OS.
Remove everything inside:
/usr/local/bin
/usr/local/include
/usr/local/lib/dtrace
/usr/local/share/man/man1
/usr/local/share/systemtap/tapset/
Delete the folder:
/usr/local/lib/node_modules
Once you done the instruction above, kindly use your spotlight to search for keywords such as node, cordova, ionic, etc... to see whether it is still exist or not. Please also ensure yourApp within your Users/username folder is deleted.
You may also try to use your terminal input:
npm -v
cordova -v
ionic -v
It will shows nothing/not found if you've deleted everything completely.
Now you can download and install Xcode from App Store, and wait for Xcode is fully installed in your Mac, then proceed to here to start again your ionic project.
Lastly, once you begin to create an ionic project, by right you no need to use any sudo commands anymore in creating or building this project.
Example:
ionic build ios
Instead of:
sudo ionic build ios
It should be working unless you are not the root user.
Happy coding and have a nice day! :D

build of MobileVLC for iOS fails

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