When I am trying to make XCFramework from the famous command line, I am facing the below error:
#import "Headers/private_framework.h"
^
../private_framework.h:9:9: error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>
<unknown>:0: error: could not build Objective-C module 'private_framework'
** BUILD FAILED **
The following build commands failed:
CompileSwift normal arm64
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
My private framework project has react-native dependencies. I am on Xcode 12.4. I have already tried the below steps:
Deleted derived data and clean build.
Deintegrated pods and did pod install.
Using the latest cocoa pod version.
sudo Xcode-select --reset.
Related
For some reason whenever I try to update my dependencies through SPM I get build errors. Others on my team can fetch fine, for some reason I have a hexed machine. Same version of macOS, same version of XCode, same branch from git.
FYI
macOS Monterey 12.3.1
XCode 13.2.1
I'm downloading 13.3.1 as I type this.
Here are the steps I've used to try to fix this problem. I went full scorched earth since I'm desperate.
closed Xcode
cloned new repo from Git
deleted derived data
went into the workspace and cleared package.resolve
I've had problems where the package resolve was messed up from someone else's check-in
I've tried not clearing the package.resolve with the same result
cd into project directory in the terminal
fetched dependencies through command line xcodebuild -resolvePackageDependencies -scheme *schemeName* -project *project*.xcodeproj -configuration Debug
I've also done this through xcode but this often times gets stuck.
After I've done the following I'll open XCode and try to run and I'm met with the same errors.
Here's the build log:
Build target *InternalOBJCFramework* with configuration Debug
*removed*
Undefined symbols for architecture arm64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in *InternalOBJCFramework*.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Build target Socket with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Socket' from project 'Socket')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target KeychainAccess with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'KeychainAccess' from project 'KeychainAccess')
*removed*
error: jobFailedWithNonzeroExitCode(2, "")
Command CompileSwiftSources failed with a nonzero exit code
Build target BTree with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'BTree' from project 'BTree')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target Rswift with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Rswift' from project 'R.swift.Library')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target CombineExt with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'CombineExt' from project 'CombineExt')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target ReactiveSwift with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'ReactiveSwift' from project 'ReactiveSwift')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Build target XCGLogger with configuration Debug
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'XCGLogger' from project 'XCGLogger')
*removed*
Command CompileSwiftSources failed with a nonzero exit code
Let's use SPM they said, it'll be easier they said. 🤦🏻♂️
The problem happened with a dependency I'm pulling in that had it's package.swift file define itself as being dynamic.
// inside the package.swift file
platforms: [.iOS(.v13)],
products: [
.library(
// changing this to name: "PrivateLib" and removing type: .dynamic fixed the issue
name: "PrivateLib", type: .dynamic,
targets: ["PrivateLib"]
)
],
I am trying to setup a new Xcode project with cocoapod FirebaseUI. When I compile and run the project, I get this error:
Frameworks/AppAuth.framework: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code
This was because I had a ' in the App name.
I'm trying to create a POD but when I run pod lib lint or pod spec lint, I get the next output:
`XXXXXX/LoginService/LoginService.swift:10:8: error: no such module
'TwitterKit' import TwitterKit
^
** BUILD FAILED **
The following build commands failed: CompileSwift normal x86_64
XXXXXX/LoginService/LoginService.swift CompileSwiftSources normal
x86_64 com.apple.xcode.tools.swift.compiler (2 failures) ->
LoginService (0.1.0)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- ERROR | [iOS] xcodebuild: /Users/danielfernandez/Documents/tekton_projects/LoginService/LoginService/LoginService.swift:10:8:
error: no such module 'TwitterKit'`
I don't know why, because If I build my project there is no errors, I'm using the TwitterKit without any problem.
This is my first time trying to create a pod. I used cocoapods to install Twitter Kit and my Xcode Version is 8.3.3
This is my POD SPEC:
If I put the s.dependency, I get this error: The 'Pods-App' target has transitive dependencies that include static binaries
If I use --use-libraries I get this error: Pods written in Swift can only be integrated as frameworks; add use_frameworks!
This is my Podfile:
I am new to the Kitura and Xcode and facing some issues when adding test files.
It seems to be related to the #testing directive.
I have setup the same as shown on Kitura website.
When I invoke in the console swift build then swift test I get following error:
Compile Swift Module 'testTests' (1 sources)
Linking ./.build/debug/testPackageTests.xctest/Contents/MacOS/testPackageTests
Undefined symbols for architecture x86_64:
"__TFC4test3OkoCfT_S0_", referenced from:
__TFC9testTests8OkoTests8test_addfT_T_ in OkoTests.swift.o
"__TMaC4test3Oko", referenced from:
__TFC9testTests8OkoTests8test_addfT_T_ in OkoTests.swift.o
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/*user*/Projects/Kitura/test/.build/debug.yaml test
However when I comment out line #testable import test and type swift build then swift test then I get following error:
Compile Swift Module 'testTests' (1 sources)
/Users/*user*/Projects/Kitura/test/Tests/testTests/OkoTests.swift:6:17: error: use of unresolved identifier 'Oko'
let o = Oko()
^~~
<unknown>:0: warning: 'cacheParamsComputed' is deprecated
<unknown>:0: warning: 'cacheAlphaComputed' is deprecated
<unknown>:0: warning: 'keepCacheWindow' is deprecated
<unknown>:0: error: 'memoryless' is unavailable
Metal.MTLCommandBufferError:19:14: note: 'memoryless' has been explicitly marked unavailable here
case memoryless
^
<unknown>:0: error: build had 1 command failures
error: exit(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/*user*/Projects/Kitura/test/.build/debug.yaml test
When I try to test it from Xcode generated project instead (swift package generate-xcodeproj) then I get compile error:
Without Testing files, everything works properly.
Below I present project structure:
I believe the issue is that Swift is not able to compile unit tests for modules that contain a main.swift file (i.e., modules that are meant to be compiled into executables as opposed to libraries for use in other projects). I cloned your repo and was able to compile and run unit tests after 1) removing main.swift and 2) uncommenting the testable import statement.
With Swift DEVELOPMENT-SNAPSHOT-2016-02-08-a, I'm trying to build a project using swift build but as soon as I add the line import Foundation I get the error:
[I] ~/Dropbox/Projects/test
↪ swift build --clean; and swift build
Compiling Swift Module 'test' (1 sources)
<unknown>:0: error: cannot load underlying module for 'CoreGraphics'
<unknown>:0: note: did you forget to set an SDK using -sdk or SDKROOT?
<unknown>:0: note: use "xcrun -sdk macosx swiftc" to select the default OS X SDK installed with Xcode
<unknown>:0: error: build had 1 command failures
error: exit(1): ["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/bin/swift-build-tool", "-f", "/Users/me/Dropbox/Projects/test/.build/debug/test.o/llbuild.yaml"]
Running xcrun -sdk macosx results in "no such SDK: 'machos'" error:
↪ xcrun -sdk macosx swift build 0#10:34:03
<unknown>:0: warning: no such SDK: 'macosx'
<unknown>:0: warning: no such sysroot directory: 'macosx'
<unknown>:0: error: cannot load underlying module for 'Darwin'
error: exit(1): ["/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/bin/swiftc", "--driver-mode=swift", "-I", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/lib/swift/pm", "-L", "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a.xctoolchain/usr/lib/swift/pm", "-lPackageDescription", "-target", "x86_64-apple-macosx10.10", "/Users/me/Dropbox/Projects/test/Package.swift"]
This is with only main.swift, whose contents are:
import Foundation
print("Hello, world!")
No dependencies are defined in Packages.swift.
Really don't know what's going on here. This compiles fine on my Ubuntu 14.04 DigitalOcean VPS as well as within Xcode 7.3 Beta 5.
OS X 10.11.3
↪ swift --version 0#10:21:16
Apple Swift version 3.0-dev (LLVM a7663bb722, Clang 4ca3c7fa28, Swift 1c2f40e246)
Target: x86_64-apple-macosx10.9
Do you have the stable release of Xcode.app in your [/Applications] directory? If you just have Xcode-beta.app, that's likely what's causing this error. Try creating a symlink of Xcode-beta.app to Xcode.app:
$ ln -s /Applications/Xcode-beta.app /Applications/Xcode.app
(Kudos to anton for the answer).