Xcode build Perfect failure -- COpenSSL not found - swift

Xcode: 8.0
Swift toolchain: 3.0 release
Perfect: .Package(url:"https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 2, minor: 0),
There is fine to run swift build in terminal.
But I'm run swift package generate-xcodeproj and open project with Xcode, Run it, then get error when build PerfectNet framework.
ld: library not found for -lCOpenSSL for architecture x86_64

You need to add the following line to your project's (not target) "Library Search Paths" setting: "$(PROJECT_DIR)/**" (including quotes).
Unfortunately, as for now, you need to do that each time you add a depedency and regenerate project as a result.

Update to Xcode 8.1, which fixes this particular issue when generating project files.

Related

Xcode 13.3 Build Failed because of Cycle in Dependencies between targets libsignal-protocol-swift

After updating to Xcode 13.3 facing Build failed issues with libsignal-protocol-swift library.
This is happening while building second time while after cleaning and building for first time it is working fine. Also, Xcode 13.2.1 has no such errors.
Xcode Error as below :
Cycle inside libsignal-protocol-swift iOS; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
Cycle details:
→ Target 'libsignal-protocol-swift iOS' has link command with output '/Users/ankitkhanna/Library/Developer/Xcode/DerivedData/BlueSecures-brawgzawheasvqbvhxxglfnlvdlw/Build/Products/Debug-iphoneos/SignalProtocol.framework/SignalProtocol'
○ Target 'libsignal-protocol-swift iOS' has compile command for Swift source files
○ Target 'libsignal-protocol-swift iOS' has copy command from '/Users/ankitkhanna/Documents/Project-Files/Desk-Factors-Project-Files/BlueChats-IOS-master/libsignal-protocol-swift-master/libsignal-protocol-swift/SignalProtocol.h' to '/Users/ankitkhanna/Library/Developer/Xcode/DerivedData/BlueSecures-brawgzawheasvqbvhxxglfnlvdlw/Build/Products/Debug-iphoneos/SignalProtocol.framework/Headers/SignalProtocol.h'
After struggling for sometime the solution was actually the same as mentioned in Xcode suggestions.
i.e. to Move the Headers in project Target -> Build Phases on top Compiled sources.
Drag and move Headers above Compile Sources fixed the error.
Please see the image for reference.
I've faced the same issue after updating to Xcode 13.3; however, in my case, I didn't have Headers in Build Phases.
I've followed these steps to solve it:
Precondition: Xcode must be closed.
Delete the DerivedData folder:
rm -rf ~/Library/Developer/Xcode/DerivedData
In the Terminal, type the following command:
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1

Cosmos: Update to Swift 4 reveals new issue: The following binaries use incompatible versions of Swift

After I updated my App to Swift 4 I get this error message:
error: The following binaries use incompatible versions of Swift:
/Users/Konrad/Library/Developer/Xcode/DerivedData/ExploreYourCity-btthjezgywzvnmduiurzwgwzrven/Build/Products/Debug-iphoneos/Cosmos/Cosmos.framework/Cosmos
/Users/Konrad/Library/Developer/Xcode/DerivedData/ExploreYourCity-btthjezgywzvnmduiurzwgwzrven/Build/Products/Debug-iphonesimulator/ExploreYourCity.app/ExploreYourCity
I can not find a solution to this misstake. Whats wrong?
Library setup method: CocoaPods
Version of the library. Example: 12.0.1.
Xcode version. Example:9.0.1.
OS version. Example: iOS 11.0.
*Swift Version: Swift 4.0.
1) Select Project in Project Navigator.
2) Go to General Tab.
3) Remove everything under Embedded Binaries.
4) Remove everything under Linked Frameworks and Libraries except Pods_*.framework
5) Clean, Build and Run.

Swift 3.1.1 compile error: unknown key 'SwiftImportAsNonGeneric'

Some time after upgrading to Xcode 9, I discovered that I was no longer able to build a Kitura-based project with the Swift 3.1.1 snapshot (which I have installed via swiftenv).
When I ran swift build, some time into the build I would get:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes:8:28: error: unknown key 'SwiftImportAsNonGeneric'
SwiftImportAsNonGeneric: true
^
<unknown>:0: error: could not build Objective-C module 'Foundation'
It seems that there is a dependency between Swift and Xcode, and Xcode 9 is no longer fully compatible with Swift 3.1.1 (or earlier) snapshots. I believe it may be because my project uses Foundation, and Foundation on Mac is provided as part of Xcode, whereas on Linux it is part of the Swift snapshot (via swift-corelibs-foundation).
I did find a solution to this problem: If I keep a copy of Xcode 8.3.3 around (eg. in /Applications/Xcode8.3.3.app) then I can use sudo xcode-select -s /Applications/Xcode<version>.app/Contents/Developer to select the appropriate one prior to building with SPM, and I can then build both Swift 3.1.1 and 4.0 projects on the same system.
However, this feels a bit clunky. Each time I build a project with the 'other' Swift version, I have to make sure I run xcode-select, or the build will fail. Is having multiple versions of Xcode the right solution in this case, or am I missing a trick with Xcode 9?
note that if, like me, you upgraded Xcode via the App Store, previous versions of Xcode are still available from https://developer.apple.com/download/more/

Cannot build any Swift project at all due to strange error about MacOSX10.11.sdk

I'm running macOS 10.12.3 with Xcode 8.3.
I cannot build any macOS Swift projects with it.
If I create a new Cocoa application Xcode project and set it to use Swift, when I try to compile it, I immediately get the following error in the "check dependencies" phase:
error: There is no SDK with the name or path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
I have no idea what's going wrong!
The only clue I have is that earlier I created a symlink with the path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk that pointed to MacOSX.sdk in order to fix an issue where an older build of Qt that required an SDK with that path. However, deleting the symlink has no effect.
I can build Swift projects that targeting other platforms like iOS. Just not macOS.
Help!
try running this command then reopening the project
(Xcode uses xtools in the command line to build its projects)
sudo xcode-select -switch /path/to/file/
(by default the path is)/Applications/Xcode.app/
look at this pic
saw it here yesterday

Unsupported compiler 'GCC 4.2' selected for architecture 'armv7'

Just installed new version XCode 4.2 onto my Mac. I tried compiling my project but got the following error:
Unsupported compiler 'GCC 4.2' selected for architecture 'armv7'
Tried selecting arm7 in drop down for architechture in project and target settings. (The list actually shows just arm 7) still no use.
Please help.
Thanks
you should actually select the LLVM compiler under "Compiler Version" instead of trying to set "Valid Architectures"
xcode build errors:
Unsupported compiler ‘GCC 4.2′ selected for architecture ‘i386′
Solution:
This can be caused by importing a project for a pre- iOS 5 SDK into a copy of xcode with iOS 5 SDK only.
To fix, click your
Project -> Build Settings.
Then under Build Options, there is an entry for Compiler for C/C++/Objective-C. Choose Apple LLVM compiler 3.0.
There is a chance this could effect other aspects of your binaries as you are using a new compiler, so YMMV. That being said, it’s so far caused no issues for me.
If you have multiple projects included within a single xCode project, go to editor>Validate project settings. This will set the compiler to LLVM 5.0 even if you don't see that option normally
Go to BuildSettings->BuildOptions->CompilerFor c/c++/Objective C and change that to LLVM GCC 4.2 from 'Unsupported Compiler GCC4.2'