Creating a static library using Swift with external cocoa pods dependencies - ios

I'm having trouble creating a swift static library which uses external cocoa pods libraries (SSZipArchive).
I'm getting the following error:
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]​
I have no clue why is this happening.

You cannot create static Swift libraries.
It was a 'bug' but then the Apple engineers decided to state this is intended behaviour. I needed to make static libraries myself and I am currently SOL on it.
Xcode does not support building static libraries that include Swift code.

#Aggressor is correct about the current state of affairs, but even if (when) Swift does allow the creation of static libraries, you must not do this. Third-party libraries must never be incorporated into a static library. This leads to all kinds of build conflicts later if the consumer also includes those libraries (or if another static library does). For more information (and links to even more information), see this ObjC version of the question. If Swift ever supports this, it will be the same issue. The final executable should link together all your libraries.

Related

Link to fat Static Library inside Swift Package

I’m trying to build a Swift Package that wraps a fat static library written in C: libndi_advanced_ios.a from NewTek's Apple Advanced NDI SDK.
I am having trouble linking the pre-compiled library (only headers files and .a binary package is available) to my Swift Package. I have done a lot of research and tried different solutions, but none of them worked. Here is a quick list:
Cannot bundle in an XCFramework because libndi_advanced_ios.a supports multiple platforms (arm_v7, i386, x86_64, arm64) and xcodebuild -create-xcframework return the error binaries with multiple platforms are not supported (this solution is discussed on Swift Forums too);
Using .linkedLibrary in targets as suggested on SPM Documentation (that is outdated) gives the warning system packages are deprecated; use system library targets instead, and I don’t even remember if it builds successfully;
Playing around with different flags and settings (like linkerSettings) has not been successful. Maybe I just missed the right combination.
I can link dozens of Stackoverflow's questions and other posts that didn’t help, but it will be useless (a, b, c).
At the moment I have this configuration:
With Package.swift that contains the following code:
let package = Package(
name: "swift-ndi",
platforms: [.iOS(.v12)],
products: [
.library(
name: "swift-ndi",
targets: ["swift-ndi"])
],
dependencies: [],
targets: [
.target(name: "CiOSNDI", path: "Libraries"),
.target(
name: "swift-ndi",
dependencies: ["CiOSNDI"]),
.testTarget(
name: "swift-ndiTests",
dependencies: ["swift-ndi"]),
]
)
You can find the whole project at alessionossa/swift-ndi.
The only result at the moment are some warnings and the module CiOSNDI do not build:
I tried also .systemLibrary(name: "CiOSNDI", path: "Libraries/"), with this configuration: alessionossa/swift-ndi/tree/systemLibrary; but I get these errors:
NOTE
NDI_include is actually an alias/symbolic link to /Library/NDI Advanced SDK for Apple/include, while NDI_iOS_lib points to /Library/NDI Advanced SDK for Apple/lib/iOS.
I always cleaned build folder after changes to Package.swift.
UPDATE 10/01/2022: libndi_advanced_ios.a requires libc++.tbd. That can be easy linked in an app in Build Phases -> Link Binary With Libraries, but I don’t know how to link in a Swift Package.
Binary targets need to specified with .binary_target. See the docs and example here.
An example of a static library wrapped in an .xcframework looks like this from the file command:
$ file GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framework/GoogleAppMeasurement
GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framework/GoogleAppMeasurement: Mach-O universal binary with 2 architectures: [arm_v7:current ar archive] [arm64]
GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framework/GoogleAppMeasurement (for architecture armv7): current ar archive
GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framework/GoogleAppMeasurement (for architecture arm64): current ar archive
One way to create the .xcframework file is to use Firebase's ZipBuilder that creates a .xcframework files from static libraries that are specified with a CocoaPods podspec file.
I also needed to add the NDI SDK as a Swift package dependency in my app.
I found a couple of approaches that worked:
You can create an XCFramework bundle by extracting a thin arm64 library from the universal library:
lipo "/Library/NDI SDK for Apple/lib/iOS/libndi_ios.a" -thin arm64 -output "$STAGING_DIRECTORY/libndi.a"
Then create an XCFramework bundle:
xcodebuild -create-xcframework -library "$STAGING_DIRECTORY/libndi.a" -headers "/Library/NDI SDK for Apple/include" -output "$STAGING_DIRECTORY/Clibndi.xcframework"
I ended up not using this approach because hosting the XCFramework as a downloadable binary release on GitHub required me to make my repo public (see this issue).
Instead I am using a system library target, in my Package.swift:
targets: [
.target(
name: "WrapperLibrary",
dependencies: ["Clibndi"],
linkerSettings: [
.linkedFramework("Accelerate"),
.linkedFramework("VideoToolbox"),
.linkedLibrary("c++")
]),
.systemLibrary(name: "Clibndi")
]
Then, I have WrapperLibrary/Sources/Clibndi/module.modulemap that looks like:
module Clibndi {
header "/Library/NDI SDK for Apple/include/Processing.NDI.Lib.h"
link "ndi_ios"
export *
}
Finally, my application target (part of an Xcode project, not a Swift package) depends on WrapperLibrary, and I had to add "/Library/NDI SDK for Apple/lib/iOS" (including the quotation marks) to "Library Search Paths" in the "Build Settings" tab.
As an alternative to modifying the application target build settings, you could add a pkg-config file to a directory in your pkg-config search paths. For example, /usr/local/lib/pkgconfig/libndi_ios.pc:
NDI_SDK_ROOT=/Library/NDI\ SDK\ for\ Apple
Name: NDI SDK for iOS
Description: The NDI SDK for iOS
Version: 5.1.1
Cflags: -I${NDI_SDK_ROOT}/include
Libs: -L${NDI_SDK_ROOT}/lib/iOS -lndi_ios
Then use .systemLibrary(name: "Clibndi", pkgconfig: "libndi_ios") in your package manifest. I found this less convenient for users than just adding the setting to my application target, however.
Ideally you could add the NDI SDK's dependency library and frameworks to the pkg-config file as well (Libs: -L${NDI_SDK_ROOT}/lib/iOS -lndi_ios -lc++ -framework Accelerate -framework VideoToolbox), but it appears there is a bug in Swift's pkg-config parsing of -framework arguments, so I filed a bug: SR-15933.

NativeScript iOS Build Fails Xcode - Error: Command Ld failed with a nonzero exit code

I've wasted a ton of time trying to build a NativeScript project for iOS. I've been developing a mobile NativeScript app for a while now but since I primarily use Windows I've only been able to test on Android until now. I finally got my Macbook out to try my NativeScript Angular app on an iOS device but I've had nothing but trouble.
I even tried starting a brand new helloworld project ns create myapptest and ns run ios --no-hmr I still get a failed build and the error reporting is not really helping. I've searched and tried so many things with no luck. Everything is updated to latest versions.
The Cli shows error Command xcodebuild failed with exit code 65. and Xcode 12 shows Command Ld failed with a nonzero exit code neither of which have been too helpful but it appears something goes wrong during the linking phase. I even tried Xcode 11.7 and Xcode 12.3-Beta and still get the same errors. I pasted the error output from Xcode 12 below and here is a pastebin link https://pastebin.com/Y2RpAmTE with the full log trace of ns build ios --release --log trace.
Oddly enough, I did get one project to run on an iOS device. It's a demo of the nativescript-barcodescanner from #EddyVerbruggen https://github.com/eddyverbruggen/nativescript-barcodescanner I was able to open the Xcode project file up and build/run it on a physical iOS device. I can't find the difference between that demo project and a fresh HelloWorld project from the CLi.
Can anyone please help? Thank you for your time, I really appreciate it!
To Reproduce:
ns create myapptest &&
ns run ios --no-hmr
Expected behavior:
App to build successfully for iOS Device and Simulator
Sample project:
Default NativeScript Cli HelloWorld Project
Error Output From Xcode:
Showing All Messages
Ld /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/myapptest.app/myapptest normal (in target 'myapptest' from project 'myapptest')
cd /Users/rob/Documents/ns/myapptest/platforms/ios
/Users/rob/Documents/ns/myapptest/platforms/ios/internal/nsld.sh -target arm64-apple-ios9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -L/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/ -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents -F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios -filelist /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64/myapptest.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -rpath -Xlinker #loader_path/Frameworks -Xlinker -rpath -Xlinker #executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64/myapptest_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -sectcreate __DATA __TNSMetadata /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-arm64.bin -framework NativeScript -framework TKLiveSync -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal -licucore -lz -lc++ -framework Foundation -framework UIKit -framework CoreGraphics -framework MobileCoreServices -framework Security -framework MDFInternationalization -framework MaterialComponents -framework TNSWidgets -framework Pods_myapptest -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64/myapptest_dependency_info.dat -o /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/myapptest.app/myapptest
./.build_env_vars.sh: line 445: declare: UID: readonly variable
NSLD: Swift bridging header '*-Swift.h' not found under '/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64'
Generating metadata...~/Documents/ns/myapptest/platforms/ios/internal/metadata-generator/bin ~/Documents/ns/myapptest/platforms/ios
Python version: 2.7.16 (default, Jun 5 2020, 22:59:21)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
Generating metadata for arm64
Metadata Generator Arguments:
./objc-metadata-generator -verbose -output-bin /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-arm64.bin -output-umbrella /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/umbrella-arm64.h -docset-path /Users/rob/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -miphoneos-version-min=9.0 -std=gnu99 -target arm64-apple-ios13.0-macabi -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/ -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents -F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios -DCOCOAPODS=1 -DDEBUG=1
Clang Arguments:
"-v", "-x", "objective-c", "-fno-objc-arc", "-fmodule-maps", "-ferror-limit=0", "-Wno-unknown-pragmas", "-Wno-ignored-attributes", "-Wno-nullability-completeness", "-Wno-expansion-to-defined", "-D__NATIVESCRIPT_METADATA_GENERATOR=1", "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk", "-miphoneos-version-min=9.0", "-std=gnu99", "-target", "arm64-apple-ios13.0-macabi", "-I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include", "-I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers", "-I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/internal", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos", "-F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents", "-F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios", "-DCOCOAPODS=1", "-DDEBUG=1",
Saving metadata generation's stderr stream to: /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-generation-stderr-arm64.txt
Error: Unable to generate metadata for arm64.
Metadata Generator Arguments:
./objc-metadata-generator -verbose -output-bin /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-arm64.bin -output-umbrella /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/umbrella-arm64.h -docset-path /Users/rob/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -miphoneos-version-min=9.0 -std=gnu99 -target arm64-apple-ios13.0-macabi -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/ -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents -F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios -DCOCOAPODS=1 -DDEBUG=1
clang version 8.0.1 (tags/RELEASE_801/final)
Target: arm64-apple-ios13.0-macabi
Thread model: posix
InstalledDir:
warning: overriding '-miphoneos-version-min=9.0' option with '--target=arm64-apple-ios13.0-macabi' [-Woverriding-t-option]
clang Invocation:
"clang-tool" "-cc1" "-triple" "arm64-apple-ios13.0.0-macabi" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "umbrella.h" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-sdk-version=14.2" "-target-cpu" "cyclone" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+sha2" "-target-feature" "+aes" "-target-abi" "darwinpcs" "-fallow-half-arguments-and-returns" "-dwarf-column-info" "-debugger-tuning=lldb" "-ggnu-pubnames" "-target-linker-version" "556.6" "-v" "-resource-dir" "lib/clang/8.0.1" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk" "-D" "__NATIVESCRIPT_METADATA_GENERATOR=1" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios" "-D" "COCOAPODS=1" "-D" "DEBUG=1" "-Wno-unknown-pragmas" "-Wno-ignored-attributes" "-Wno-nullability-completeness" "-Wno-expansion-to-defined" "-std=gnu99" "-fdebug-compilation-dir" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/metadata-generator/bin" "-ferror-limit" "0" "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fimplicit-module-maps" "-fregister-global-dtors-with-atexit" "-fobjc-runtime=ios-13.0.0" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" "-x" "objective-c" "umbrella.h"
ignoring nonexistent directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/Library/Frameworks"
ignoring duplicate directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos"
#include "..." search starts here:
#include <...> search starts here:
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers
/Users/rob/Documents/ns/myapptest/platforms/ios/internal
/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos (framework directory)
/Users/rob/Documents/ns/myapptest/platforms/ios/internal (framework directory)
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization (framework directory)
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents (framework directory)
/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios (framework directory)
lib/clang/8.0.1/include
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/System/Library/Frameworks (framework directory)
End of search list.
clang version 8.0.1 (tags/RELEASE_801/final)
Target: arm64-apple-ios13.0-macabi
Thread model: posix
InstalledDir:
warning: overriding '-miphoneos-version-min=9.0' option with '--target=arm64-apple-ios13.0-macabi' [-Woverriding-t-option]
clang Invocation:
"objc-metadata-generator" "-cc1" "-triple" "arm64-apple-ios13.0.0-macabi" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "umbrella.h" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-sdk-version=14.2" "-target-cpu" "cyclone" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+sha2" "-target-feature" "+aes" "-target-abi" "darwinpcs" "-fallow-half-arguments-and-returns" "-dwarf-column-info" "-debugger-tuning=lldb" "-ggnu-pubnames" "-target-linker-version" "556.6" "-v" "-resource-dir" "lib/clang/8.0.1" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/dispatch" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/libxml" "-idirafter" "lib/clang/8.0.1/include" "-idirafter" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/mach-o" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/unicode" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/objc" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/simd" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/CommonCrypto" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/AppleArchive" "-D" "__NATIVESCRIPT_METADATA_GENERATOR=1" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios" "-D" "COCOAPODS=1" "-D" "DEBUG=1" "-Wno-unknown-pragmas" "-Wno-ignored-attributes" "-Wno-nullability-completeness" "-Wno-expansion-to-defined" "-std=gnu99" "-fdebug-compilation-dir" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/metadata-generator/bin" "-ferror-limit" "0" "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fimplicit-module-maps" "-fregister-global-dtors-with-atexit" "-fobjc-runtime=ios-13.0.0" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" "-x" "objective-c" "umbrella.h"
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target x86_64-apple-darwin19.6.0
ignoring nonexistent directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/Library/Frameworks"
ignoring duplicate directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos"
ignoring duplicate directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include"
ignoring duplicate directory "lib/clang/8.0.1/include"
ignoring duplicate directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers
/Users/rob/Documents/ns/myapptest/platforms/ios/internal
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos (framework directory)
/Users/rob/Documents/ns/myapptest/platforms/ios/internal (framework directory)
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization (framework directory)
/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents (framework directory)
/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios (framework directory)
lib/clang/8.0.1/include
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/System/Library/Frameworks (framework directory)
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/dispatch
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/libxml
/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/#nativescript/core/platforms/ios/src
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/mach-o
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/unicode
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/objc
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/simd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/CommonCrypto
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/AppleArchive
End of search list.
Command Ld failed with a nonzero exit code
Also, please see full log trace of ns build ios --release --log trace at pastebin link: https://pastebin.com/Y2RpAmTE
I finally figured it out! I think it has something to do with using a Mac that is patched with dosdude1 patcher to run macOS Catalina on an unsupported mac. The way I got it to work was compiling the metadate generator myself by:
Download LLVM 8.0 http://releases.llvm.org/download.html#8.0.0
(direct download: https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz)
And be sure to have the folder containing llvm-config in PATH or make a symlink to in /usr/local/bin/
Download and install Cmake https://cmake.org/download/
(NOTE: If you are using dosdude1's patch to run macOS Catalina DO NOT use homebrew to install LLVM and Cmake, I've had trouble with homebrew installing software with uncompatible binaries which gives errors like zsh: illegal hardware instruction so be safe and use the above links to download.)
git clone https://github.com/NativeScript/ns-v8ios-runtime
cd ns-v8ios-runtime
./build_metadata_generator.sh
This will build objc-metadata-generator in ns-v8ios-runtime/metadata-generator/bin You will need to copy and paste this entire bin folder in the next steps.
Now go to your NativeScript project directory (I will call it demo-app)
cd demo-app
If you haven't already, prepare the project for iOS ns prepare ios
Now you are going to replace the non-working objc-metadata-generator with the one we just compiled a few steps ago. First we will delete the existing bin folder and then copy our newly complied bin folder in its place.
rm -R platforms/ios/internal/metadata-generator/bin
Now copy the bin folder we compiled from ns-v8ios-runtime/metadata-generator/bin and past it into you project, demo-app/platforms/ios/internal/metadata-generator/bin
ns run ios --no-hmr
Your project should work on iOS now! Hopefully this helps someone, it worked for me. Please note though that any time you ns platform remove ios you will need to replace the bin folder in your project with the one you compiled yourself. Good luck!

xCode project not locating c++ std libraries on macOS Catalina 10.15.5

I have an xCode Swift 5 project using Metal which has two targets, the main app, and a static library target which builds a third party C library. When I compile the project, error messages (see below) indicate that xCode is searching iPhone SDK for system C headers, which it doesn't find, and doesn't find them anywhere. How can I fix this? please :)
The static library target builds a third party C library, and has an Obj-c public h/m file (AGBGPUType.h, AGBGPUType.m).
This library header is referenced in a bridging header file (Common.h) in a Swift/Metal project.
All of the internal library header files and relevant source are included within the Swift/Metal project - this is not a workspace, it is a single project with two targets.
The scheme to build the app target is setup to compile the library first, then the app, the device I'm building with is an iPhone Xs Max running iOS 13.5.
I've set up the C library's public Obj-c (.h & .m) to log to the console and create a reference to a font library - which would mean it can access the third party C library code in a functional way.
The library obj-c file is:
#import "AGBGPUType.h"
#import "ft2build.h"
#include FT_FREETYPE_H
#include FT_STROKER_H
#implementation AGBGPUType
FT_Library _fontLibrary;
FT_Face _face;
FT_GlyphSlot _glyph;
FT_Stroker _stroker;
-(void) simple {
int giddy = 5000;
NSLog(#"From main library objc AGBGPUType.m %d", giddy);
if(FT_Init_FreeType(&_fontLibrary)) {
NSLog(#"Could not init Freetype library");
}
}
#end
and the bridging header file within the Swift/Metal application has:
#ifndef Common_h
#define Common_h
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#import <simd/simd.h>
#import "AGBGPUType/AGBGPUType.h"
...
#endif
The following errors are generated when the application is built:
CompileMetalFile /Users/username/Documents/xCode/IncuFlic/IncuFlic/Shaders.metal (in target 'IncuFlic' from project 'IncuFlic')
cd /Users/username/Documents/xCode/IncuFlic
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal -c -target air64-apple-ios13.5 -gline-tables-only -MO -I/Users/username/Library/Developer/Xcode/DerivedData/IncuFlic-fxtjxtzaumyrcuhiwrtiajlsnzak/Build/Products/Debug-iphoneos/include -F/Users/username/Library/Developer/Xcode/DerivedData/IncuFlic-fxtjxtzaumyrcuhiwrtiajlsnzak/Build/Products/Debug-iphoneos -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk -ffast-math -serialize-diagnostics /Users/username/Library/Developer/Xcode/DerivedData/IncuFlic-fxtjxtzaumyrcuhiwrtiajlsnzak/Build/Intermediates.noindex/IncuFlic.build/Debug-iphoneos/IncuFlic.build/Metal/Shaders.dia -o /Users/username/Library/Developer/Xcode/DerivedData/IncuFlic-fxtjxtzaumyrcuhiwrtiajlsnzak/Build/Intermediates.noindex/IncuFlic.build/Debug-iphoneos/IncuFlic.build/Metal/Shaders.air -index-store-path /Users/username/Library/Developer/Xcode/DerivedData/IncuFlic-fxtjxtzaumyrcuhiwrtiajlsnzak/Index/DataStore "" -MMD -MT dependencies -MF /Users/username/Library/Developer/Xcode/DerivedData/IncuFlic-fxtjxtzaumyrcuhiwrtiajlsnzak/Build/Intermediates.noindex/IncuFlic.build/Debug-iphoneos/IncuFlic.build/Metal/Shaders.dat /Users/username/Documents/xCode/IncuFlic/IncuFlic/Shaders.metal
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Shaders.metal:35:
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Common.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/stdio.h:64:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_stdio.h:68:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
##error Unsupported architecture##
^
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Shaders.metal:35:
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Common.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/stdio.h:64:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_stdio.h:71:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_types.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
##error architecture not supported##
^
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Shaders.metal:35:
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Common.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/stdio.h:64:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_stdio.h:71:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_types.h:27:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
typedef __int64_t __darwin_blkcnt_t; /* total blocks */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_blksize_t; /* preferred block size */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_dev_t; /* dev_t */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_gid_t; /* [???] process and group IDs */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_id_t; /* [XSI] pid_t, uid_t, or gid_t*/
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'; did you mean 'uint64_t'?
typedef __uint64_t __darwin_ino64_t; /* [???] Used for 64 bit inodes */
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/ios/lib/clang/3902.67/include/metal/metal_types:48:25: note: 'uint64_t' declared here
typedef __UINT64_TYPE__ uint64_t;
^
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Shaders.metal:35:
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Common.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/stdio.h:64:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_stdio.h:71:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_types.h:27:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'
typedef __uint16_t __darwin_mode_t; /* [???] Some file attributes */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'
typedef __int64_t __darwin_off_t; /* [???] Used for file sizes */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_pid_t; /* [???] process and group IDs */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_sigset_t; /* [???] signal set */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_uid_t; /* [???] user IDs */
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */
^
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Shaders.metal:35:
In file included from /Users/username/Documents/xCode/IncuFlic/IncuFlic/Common.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/stdio.h:64:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_stdio.h:71:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/_types.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_types.h:80:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_pthread/_pthread_types.h:58:25: error: pointer type must have explicit address space qualifier
void (*__routine)(void *); // Routine to call
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_pthread/_pthread_types.h:59:7: error: pointer type must have explicit address space qualifier
void *__arg; // Argument to pass
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk/usr/include/sys/_pthread/_pthread_types.h:60:38: error: pointer type must have explicit address space qualifier
struct __darwin_pthread_handler_rec *__next;
Additional Environment Details
My path
sudo nano /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
The currently active developer dir
xcode-select -p
/Applications/Xcode.app/Contents/Developer
The GCC compiler gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
The C preprocessor cpp -v
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.15.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=10.15.4 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 556.6 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I /usr/include -I/usr/local/include -internal-isystem
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include -internal-externc-isystem
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-objc-signed-char-bool-implicit-int-conversion -Wno-extra-semi-stmt -Wno-quoted-include-in-framework-header -fdebug-compilation-dir /Users/annstramer -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.15.0 -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -traditional-cpp -o - -x c -
clang -cc1 version 11.0.3 (clang-1103.0.32.62) default target x86_64-apple-darwin19.5.0
ignoring nonexistent directory "/usr/include"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
include "..." search starts here:
include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
From reading several articles, including Broken c++ std libraries on macOS High Sierra 10.13 and How can I find all Clang versions installed on my Mac?, possibly xCode is not finding headers of C installation. The error messages indicate that xCode is looking for files in the iPhone13.5 sdk, but terminal commands seem to confirm a version of C isn't included with that sdk.
There exists a C installation in the xCode developer directory.
When the library is included as a prebuilt archive in an Obj-c project or a Swift project, the project compiles without errors, C headers are found, logs the message to the console and create the reference to the font library. Golden - but doesn't work at all from bridging header in Swift/Metal project. There are several structs in that bridging header which work perfectly in other areas of Swift/Metal code.
A (brute force) clean installation of xCode didn't solve the problem, nor did installing the command line tools, both of these after installing the recent Catalina upgrade over a relatively recent clean install of Catalina, and then just today installing a command line tools upgrade.
My questions:
Am I correct that xCode is not locating a C installation?
cpp -v finds xCode's C installation, why doesn't xCode during compile?
Please, what is the correct professional way to solve this problem?
Thanks in advance for your insights.
Here is an excellent explanation as an overview for this issue, from Cecelia Humlelu.
https://www.youtube.com/watch?v=NvURClY2Xzk
I found this explanation of how to integrate the C library exceedingly direct also, and contemporary to xCode 11: https://www.youtube.com/watch?v=WQI02KR9kQw
I was convoluting the integration of the C library into the Swift project by building the C library within an ObjC library target, and then using ObjC to access the library.
Since Swift can directly consume C, I deleted the Obj-C library target, built the C library from the command line, and dropped the archive and headers into the project (see 2nd video link). The first 6 minutes of Cecelia's video are key to understanding why these changes worked, and the C/Swift segment that starts at 6:45 clearly outlines what I followed. To the letter.
In this project, the bridging header is imported in the metal shader. I was importing the C library within the bridging header, using an Obj-C header file. Deleting this Obj-C header, and writing C functions appeared to work at first.
However, when it came down to using the core functionality of the library, there was another problem. This library involves processing strings, and to pass a string from a Swift function call into a C function call, pointer parameters had to be added to the C function calls that use the library code. Address space qualifiers are required for running code on the GPU. Since the C functions were being imported in a bridging header through Metal, the compiler requires the code to designate address space identifiers. The problem is that C does not have a construct for designating the address space of the pointer parameters, so importing these function declarations in the bridging header was not possible. Please note: there are some C declarations that would not require address space qualifiers, the discussion is out of scope for this question.
There is only one bridging header allowed per target in an xCode project, but there is another way to import header files. I created a modulemap for the library header file, and added it to the Import Paths setting of Swift Compiler Search Paths in the project build settings. Because this library uses complex macros to expose functionality, a C or Obj-C wrapper is still needed to use the library from Swift, but the library is fully integrated and accessible from CPU code.
In the working solution, Swift recognizes the header files in the modulemap as globally defined, so they can be called from any Swift file in the project, the library header files are no longer referenced in the target's bridging header.
I followed the video to the letter in it's guidance about creating a modulemap for the C library.
Here's the Obj-C source file declaration:
#import <LibraryWrapperCode.h>
#import <MetalKit/MetalKit.h>
#include "ft2build.h"
#include FT_FREETYPE_H
#implementation LibraryWrapperCode {
FT_Library _fontLibrary;
FT_Face _face;
FT_GlyphSlot _glyph;
}
The modulemap:
module GPUTextCWrapper {
header "../GPUText/libraryWrapperCode.h"
export *
}
The C library is imported from any Swift file:
import GPUTextCWrapper
It is still somewhat unclear to me what I was doing that generated the error messages documented in this question, but I think I was importing the library in such a way that the compiler found it twice, and the second time, tried to recompile the library. I will update this answer again if I find a more direct explanation.

Unable to merge Unity 5 into our iOS application

We have a large and complicated application and we are looking to upgrade our 3d engine to Unity 5.0. But I am having trouble integrating Unity.
I been trying to follow these tutorials but constant errors keep poping up whatever I do.
http://www.the-nerd.be/2014/09/08/sandbox-unity-app-in-existing-ios-app/
http://www.makethegame.net/unity/add-unity3d-to-native-ios-app-with-unity-5-and-vuforia-4-x/
http://www.markuszancolo.at/2014/05/integrating-unity-into-a-native-ios-app/
If I just add the "Libraries" and the "Classes" folders into my project, I get an odd amount errors. It gets confused with other c code in the project(really doesn't like msgpack) and tries to import the wrong files (ILCPP files). If I remove all offending code from the project I still have a list of errors with the native cstring class.
CompileC
/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.o
Classes/Other/main.mm normal armv7 objective-c++
com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/jess/Projects/GIT/CricHQ-iPhone
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-x objective-c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++11 -stdlib=libc++ -fobjc-arc -fmodules -fmodules-cache-path=/Users/jess/Library/Developer/Xcode/DerivedData/ModuleCache
-fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/jess/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation
-fmodules-validate-once-per-build-session -Wno-trigraphs -fpascal-strings -O0 -Werror=incompatible-pointer-types -Wmissing-field-initializers -Wmissing-prototypes -Wno-return-type -Wimplicit-atomic-properties -Wno-receiver-is-weak -Warc-repeated-use-of-weak -Wexplicit-ownership-type -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wexit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wint-conversion -Wno-bool-conversion -Wenum-conversion -Wassign-enum -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-selector -Wstrict-selector-match -Wno-undeclared-selector -Wdeprecated-implementations -Wc++11-extensions -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
-fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-conversion -miphoneos-version-min=7.0 -I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/CricHQ\
Next.hmap
-I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Products/Debug-iphoneos/include
-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
-I/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/libxml2
-I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Classes
-I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Libraries/bdwgc/include
-I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Libraries/libil2cpp/include
-I/Users/jess/Projects/GIT/CricHQ-iPhone/../CricHQ-3d/iOS-export/Classes/Native
-I/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/CricEngine/source -I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/DerivedSources/armv7
-I/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/DerivedSources
-F/Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Products/Debug-iphoneos
-F/Users/jess/Projects/GIT/CricHQ-iPhone -mno-thumb -DINIT_SCRIPTING_BACKEND=1 -include /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch
-MMD -MT dependencies -MF /Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.d
--serialize-diagnostics /Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.dia
-c /Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/main.mm -o /Users/jess/Library/Developer/Xcode/DerivedData/CricHQ-bsrxghpplcwahnadlgmwxmzwbxff/Build/Intermediates/CricHQ.build/Debug-iphoneos/CricHQ.build/Objects-normal/armv7/main-5D1DD4E92C87F57A.o
In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:70:9:
error: no member named 'memcpy' in the global namespace; did you mean
'wmemcpy'? using ::memcpy;
~~^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:152:10:
note: 'wmemcpy' declared here wchar_t *wmemcpy(wchar_t * __restrict,
const wchar_t * __restrict, size_t);
^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:71:9:
error: no member named 'memmove' in the global namespace; did you mean
'wmemmove'? using ::memmove;
~~^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:153:10:
note: 'wmemmove' declared here wchar_t *wmemmove(wchar_t *, const
wchar_t *, size_t);
^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:72:9:
error: no member named 'strcpy' in the global namespace using
::strcpy;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:73:9:
error: no member named 'strncpy' in the global namespace using
::strncpy;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:74:9:
error: no member named 'strcat' in the global namespace using
::strcat;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:75:9:
error: no member named 'strncat' in the global namespace using
::strncat;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:76:9:
error: no member named 'memcmp' in the global namespace; did you mean
'wmemcmp'? using ::memcmp;
~~^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:151:5:
note: 'wmemcmp' declared here int wmemcmp(const wchar_t *, const
wchar_t *, size_t);
^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:77:9:
error: no member named 'strcmp' in the global namespace using
::strcmp;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:78:9:
error: no member named 'strncmp' in the global namespace using
::strncmp;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:79:9:
error: no member named 'strcoll' in the global namespace; did you mean
'strtoll'? using ::strcoll;
~~^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:13:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/assert.h:44:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/stdlib.h:169:3:
note: 'strtoll' declared here
strtoll(const char *, char **, int);
^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:80:9:
error: no member named 'strxfrm' in the global namespace using
::strxfrm;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:82:9:
error: no member named 'memchr' in the global namespace; did you mean
'wmemchr'? using ::memchr;
~~^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:435:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:90:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/include/wchar.h:150:10:
note: 'wmemchr' declared here wchar_t *wmemchr(const wchar_t ,
wchar_t, size_t);
^ In file included from :353: In file included from :4: In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Classes/Other/CricHQ_Prefix.pch:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:18:
In file included from
/Users/jess/Projects/GIT/CricHQ-iPhone/Libraries/../../CricHQ-3d/iOS-export/Libraries/libil2cpp/include/os/Locale.h:4:
In file included from
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:436:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:84:9:
error: no member named 'strchr' in the global namespace using
::strchr;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:86:9:
error: no member named 'strcspn' in the global namespace using
::strcspn;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:88:9:
error: no member named 'strpbrk' in the global namespace using
::strpbrk;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:90:9:
error: no member named 'strrchr' in the global namespace using
::strrchr;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:92:9:
error: no member named 'strspn' in the global namespace using
::strspn;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:94:9:
error: no member named 'strstr' in the global namespace using
::strstr;
~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:98:87:
error: no member named 'strchr' in the global namespace; did you mean
simply 'strchr'? inline _LIBCPP_INLINE_VISIBILITY char strchr(
char* __s, int __c) {return ::strchr(__s, __c);}
^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:98:46:
note: 'strchr' declared here inline _LIBCPP_INLINE_VISIBILITY
char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
Screenshot:
Anyone know of a solution? Any help in this matter would be great as I'm totally stuck on what I should try next.
Edit: A plain project worked, so that is a start. Sounds like one of libraries is interfering maybe. The code base is large so need help narrowing the issue down.
Edit 2: Updated to Unity 5.1, xcode 7 beta, clean, deleted the DerivedData folder and still no change.
Once I added "-ferror-limit=1000" then I saw 999+ errors instead of 30.
Common errors:
"Declaration conflicts with target of using declaration already in scope".
"Call to 'X' is ambiguous" (cos, exp, ceil)
"Could not build module 'X'" (Foundation, Darwin)
"No member named 'X" in namespace" (memset, memcpy, memmove)
"Use of undeclared identifier 'x'" (strdup)
"Expected ';' after top level declarator"
Edit 3:
I solve the errors by setting "Always Search User Paths" to "No" in the XCode project settings.
But I'm having a few other issues.
Unity is still using CPU when I pause it. Is there anyway to solve this? I am calling Unity's "applicationDidBecomeActive" method. I also tried just calling "UnityPause".
Calling Unity's "GetAppController()" in my own code causes this error:
Undefined symbols for architecture armv7:
"_GetAppController", referenced from:
-[Test3d viewDidDisappear:] in Test3d.o
ld: symbol(s) not found for architecture armv7
I dont have enough reputation here to comment, so i write it as an answer:
After 3 Edits i am not sure what problems are still left...
GetAppController is an inline function in UnityAppController.h If it isnt linked to you project, you probably didnt include the file (but instead only declared GetAppController() somewhere yourself).
The other errors looks like you have conflicts with the basic c-libs. Is your other code using the c++ std lib? and if yes, which one? Which one is stated in Your BuildSettings under "C++ Standard Library"? It should be libc++
The "Solution" to switch "Always Search User Paths" to "No" sounds even more like a problem with other included projects.
Most of my answers are in the question. The core solution was setting "Always Search User Paths" to "No" in the XCode project settings.
As for the last edit, I believe they are bugs. I don't use GetAppController, instead I have my own method. I have reported the CPU issue, it isn't a major problem as it is only ~3% on phones and ipads.
I've this problem too recently trying to integrate my Unity 5 project into an existing iOS project.
How I managed to integrate is
1) Drag Class and Libraries files from your Unity project into your iOS project. Same like the tutorial from the-nerd. Uncheck copy items, and select create group radio box.
2) Update your Header Search Path and Library Search Path under Build Settings. The folders should point to your Unity project folder.
Header Search Path -> Unity's Classes folder
Library Search Path -> Unity's Library folder
This part is really important, it made me solve those errors.
3) Under Build Phases, remember to create a run script and make sure the script points to the correct path in Unity's Data folder.
rm -rf "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data"
cp -Rf "$PROJECT_DIR/../CHANGE THIS TO YOU PATH/Data" "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Data"
4) Compare the Build Settings from the Unity's project and your current iOS project. Make sure you select the correct C++ and C compiler. Your iOS project should match the one of Unity. Also the Linker Flag have to be in the correct order.
-weak_framework
CoreMotion
-weak-lSystem
That is all I did to make my iOS project compile with the Unity project I have. I hope it helps.

Can't link MacOS frameworks with CMake

I'm trying to build a subproject with cmake (it's not an xcode project or even an app for iphone, the result is cross-platform console executable, which #includes some inherited from C++ abstract classes, written in objective-c++)
I'm using this guide to link mac os frameworks: http://www.vtk.org/Wiki/CMake:HowToUseExistingOSXFrameworks
and this macro:
macro(ADD_FRAMEWORK fwname appname)
find_library(FRAMEWORK_${fwname}
NAMES ${fwname}
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
PATH_SUFFIXES Frameworks
NO_DEFAULT_PATH)
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
MESSAGE(ERROR ": Framework ${fwname} not found")
else()
TARGET_LINK_LIBRARIES(${appname} ${FRAMEWORK_${fwname}})
MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
endif()
endmacro(ADD_FRAMEWORK)
This is the important part in CMakeLists.txt
project(myprojectname)
........
add_executable(mytarget src/mytarget.cpp)
add_framework(CoreMedia mytarget)
add_framework(CoreVideo mytarget)
add_framework(AVFoundation mytarget)
add_framework(Foundation mytarget)
........
And that's what i have when trying to build:
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/CoreMedia.framework". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/CoreVideo.framework". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/AVFoundation.framework". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework". Targets may link only to libraries. CMake is dropping the item.
It actually finds all these frameworks, but can't link, which produces a lot of linker errors. I'm pretty sure that that's the reason because i made a testproj using XCode and it has the same errors till i linked all the needed frameworks.
When i just use
FIND_LIBRARY(COREMEDIA_LIB CoreMedia)
...
then COREMEDIA_LIB is set to NOTFOUND - what's going on? :/
I googled a lot but nothing :( Feeling pretty much lost there.
Got the thing: you have to link NOT the frameworkname.framework folder in the TARGET_LINK_LIBRARIES, but the fwname.framework/fwname file! Now it works that way.
The changed macro is this:
macro(ADD_FRAMEWORK fwname appname)
find_library(FRAMEWORK_${fwname}
NAMES ${fwname}
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
PATH_SUFFIXES Frameworks
NO_DEFAULT_PATH)
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
MESSAGE(ERROR ": Framework ${fwname} not found")
else()
TARGET_LINK_LIBRARIES(${appname} "${FRAMEWORK_${fwname}}/${fwname}")
MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
endif()
endmacro(ADD_FRAMEWORK)
Hope it will be useful for someone...

Resources