Running Swift Build in Terminal Leading to "Platform Path" Errors

Running Swift build in Terminal leading to Platform Path errors

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.

How to install Swift package via package manager?

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.

error Failed to build iOS project. We ran xcodebuild command but it exited with error code 65

If you don't have cocoa pods installed you need to sudo gem install cocoapods

  1. run cd ios
  2. run pod install
  3. cd ..
  4. delete build folder
  5. run react-native run-ios

if the error persists,

  1. delete build folder again
  2. open the /ios folder in x-code
  3. navigate File -> Project Settings -> Build System -> change (Shared workspace settings and Per-User workspace settings): Build System -> Legacy Build System`

You should be good to go. I hope this helps.

Command CompileSwift failed with a nonzero exit code in Xcode 10

Currently my build is working.
Here you are the steps I tried until it finally worked:

  1. Search in the whole project the word CommonCrypto.
  2. If you have a Pod containing that header import, remove this Pod from the Podfile and perform a pod install.
  3. Clean and build the project.
  4. Add again the Pod to the Podfile and perform a pod install.
  5. Clean and build the project again using a real device if possible.

And If you don't have that Pod, maybe you can try by making the same steps with some old Pod that you may encounter in your project.

Added information: also If you have some code error inside a Pod, first you need to solve that code problem and then try to compile again the project.

I'm going to copy the changes made in my project.pbxproj. I know it's not very helpful but it's the only thing that have changed in the git difference commit:

Removed: BDC9821B1E9BD1B600ADE0EF /* (null) in Sources */ = {isa = PBXBuildFile; };
Added: BDC9821B1E9BD1B600ADE0EF /* BuildFile in Sources */ = {isa = PBXBuildFile; };

I hope this can help,

Regards.

Xcode 4 build succeeds, command line build fails?

Ok, so nearly 6 (billable) hours later, I've gotten the build to work correctly in Xcode and on the command line (and on the build server, the whole point of this exercise).

Along the way I would fix one problem just to cause another - I would apparently fix the linker/Ld problem, only to cause problems in compilation ("SomeClass undeclared (first use in this function)" or "SomeHeader.h: No such file or directory" errors were common).

It was one of those times that I adjusted nearly every setting I could find, so it's hard to say what exactly what wrong and what exactly fixed it.

Things I think might have helped are are as follows:

  • Converted build to use an Xcode workspace & scheme (instead of project & target)
  • Rearranged workspace to have the App project and static library as siblings (not as parent/child)
  • Changed Xcode and workspace settings to use build locations specified in targets
  • Change Build Products Path for App and Library to use ../build (both project files are contained in sibling subfolders of a master directory, so having them build into the same folder solved the original linker/Ld command problem, I think)
  • Edited the App scheme to explicitly build the Library target, and build it before the App target
  • In the Build Phases for the App target, explicitly add the Library under "Link Binary With Libraries"
  • Change the location type of the Library's .a file reference to "Relative to Build Products"
  • Added a "Copy Headers" build phase to the Library project, added the appropriate headers to the Public section
  • Changed the Public Headers Folder Path of the Library project to "/include"
  • Changed the Installation Directory of the Library to $(BUILT_PRODUCTS_DIR)
  • Changed the Library Search Paths and the User Header Search Paths of the App target to $(BUILT_PRODUCTS_DIR) (recursive)
  • Added a Clean command before the build on my Jenkins build server
  • Added explicit SDK and Arch arguments to the build command
  • Removed spaces from build configuration name

Final build command looks like this:

xcodebuild -workspace ClientName.xcworkspace -scheme AppName -configuration "ProdAdHoc" -sdk iphoneos -arch "armv6 armv7"

Some useful resources I used while debugging this issue:

  • http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
  • https://devforums.apple.com/thread/91711?start=25&tstart=0

Anyway, I hope I've peppered enough keywords above that anybody who has any similar build issues in the future stumbles upon this and finds it useful. I have no clue how a workflow I did many times in Xcode 3.x got so messed up when I moved to Xcode 4, here's hoping Apple is able to clean this up in future releases.

This was a heck of a learning experience for me, and going through all of this did seem to clear up issues with autocomplete I was having beforehand. I will say things could have been much worse; I could still be developing for SharePoint.

Getting error No such module using Xcode, but the framework is there

I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.



Related Topics



Leave a reply



Submit