Carthage build failed .(For two Xcode)

475 views Asked by At

Currently I have two Xcode version 10.2 and 11.1.

One Carthage update, build is failing with following error.

I have checked Carthage logged . It is showing following error.

I have tried different commands as follows

carthage update --platform iOS --no-use-binaries

carthage update --platform iOS --verbose

I am not able to build the project successfully getting following error.

Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler

All helps are appreciated.

1

There are 1 answers

2
pbodsk On BEST ANSWER

You mention that you have two versions of Xcode installed, so my guess is that you/Carthage are trying to build using the "wrong" version of Xcode.

You can see which version of Xcode is being used for command line tools (which is what Carthage uses for building) in (at least) two ways

Command Line

Typing this command in the terminal:

xcode-select -p

Will give you the location of the Xcode version currently being used. For instance:

/Applications/Xcode.app/Contents/Developer

if your command line tools are set to use the default Xcode

To change to a different version of Xcode you can use this command

sudo xcode-select -s path-to-xcode-you-would-like-to-use/Contents/Developer

In Xcode

Open Preferences and select the "Locations" tab.

enter image description here

Here you can see and change which version of Xcode is being used for command line tools under "Command Line Tools".

Try changing the version and see if that doesn't help you.