Xcodebuild script error: *.h file not found - ios

I have this error pop-up with the new xcode version ( mine is Version 12.4 (12D4e) ).
So the problem is this, I have added a framework to the Frameworks and Binaries section, and inside xcode everything is great, I can build, test, profile, archive, and run my SDK on iOS and iOS simulator, but when I want to build it with Makefile and xcodebuild, it fails and spits out this error:
/Users/user/Desktop/sdk-ios/SDK/SDK/Pinning.m:10:9: fatal error: 'TrustKit/TrustKit.h' file not found
The framework in question is added as a xcframework.
below this error, is this:
CompileC /Users/user/Library/Developer/Xcode/DerivedData/SDK-agtufexqywklahgqpkyokhljwrbm/Build/Intermediates.noindex/SDK.build/Release-iphonesimulator/SDK\ Framework.build/Objects-normal/x86_64/Pinning.o /Users/user/Desktop/sdk-ios/SDK/SDK/Pinning.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
As I said, inside XCode everything works fine, and the Framework header files are found and linked, and I've tested it, everything works when running.
Any suggestions on what to do or where to look? I've read almost everything and the information is getting scarce.
Regards,
Laurynas.

So I've added to the Header Search Paths the path where frameworks are and made that path recursive and this fixed my issue.

Related

Compile Swift source files failed

I am currently trying to run a 0.61 version React Native project to iPhone11 simulator through Xcode 13.4.1 .
But Build failed, when Compile Swift source files, Precompile Bridging Header.
Please have a look at error log as below.
PrecompileSwiftBridgingHeader normal arm64...
...App-Bridging-Header.pch
Debug-iphonesimulator/Charts/Charts.modulemap' not found
Charts/Charts.modulemap' not found
RNCharts.modulemap' not found
SwiftyJSON.modulemap' not found
According to the suggestion of https://stackoverflow.com/a/50080796/7284349.
I tried delete bridging header path from the Build setting > Swift Compiler - General > Objective c bridging header. But no work.
while here's the interesting thing, execute react-native run-ios in the terminal, app can launch successfully on simulator, shown as a blank screen. At least build success, no errors. Such a strange thing!

iOS firebase Mach-O Linker Error without cocapods

I'm trying to import Firebase into my iOS app. I followed this tutorial for doing this manually with Objective-C (as opposed to using CocoaPods).
http://www.mokacoding.com/blog/setting-up-firebase-without-cocoapods/
When I try to build my project, I get the following errors:
"Apple Mach-O Linker Error"
"Linker command failed with exit code 1 (use -v to see invocation)"
I'm familiar with the Linux CLI (less so with Macs), but I don't understand how to apply the -v flag to XCode's build process to get more info.
I've been Googling this for the last 3 hours, but every answer I find seems to be directed at users who weren't using an XCode workspace with CocoaPods.
I don't have CocoaPods installed, so I don't think this is my issue. Despite that I have converted my project and properly imported it into an XCode workspace, this still didn't solve my problem.
My app is a Swift project, and I have imported the modulemap, firebase.h, and googleServices.plist files.
I've also made my Header and Library search paths recursive for the entire project folder in an attempt to fix this.
Here's my project navigation. Although at this point I suspect it's some kind of build setting that isn't correct.
Some selected answers I've tried to apply without success:
Apple Mach -O Linker command failed
In Xcode how do I create a new workspace and add 1 project to it so that I can see the project and its files?
Framework not found GoogleToolboxForMac
Adding system header search path to Xcode
https://github.com/firebase/firebase-ios-sdk/issues/258
Apple Mach-O Linker & Ditto Error - Xcode 8
https://github.com/invertase/react-native-firebase/issues/198
https://forum.ionicframework.com/t/ios-xcode-8-apple-mach-o-linker-ld-error-group-in-xcode/89903
Upgrading to xcode 9.2 fixes this. It appears to be an issue with earlier versions not properly handling linking.
Which is misleading b/c the firebase documentation indicates it's compatible with xcode 8. But I think that's assuming you use cocoapods. If you don't, and instead try to link the obj-c frameworks you need xcode 9+
Once I knew how to examine the more verbose linking error, googling for x86_64 led me to some helpful answers.
This and other answers helped me investigate upgrading.
ld: framework not found Stripe for architecture x86_64

Build iOS app from command line brings errors

I have a project, that builds perfectly from xCode 7, but fails from bash. I'm pretty new to command line using for this purposes, so not sure, what additional info I should provide. It just runs through tons of source files and fails in CompileC section.
It brings single message:
The following build commands failed:
CompileC path to buildObjects-normal/armv7/PGDataManager.o path to source PGDataManager.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
It's something with this specific source, I suppose, but I wonder why it works perfectly from xCode? Also, I've checked this PGDataManager and everything looks fine.
If I can provide additional info - please ask me.
I succeeded in this after some researches. Here are my steps, if anybody approach similar issues:
at first I disabled "Find Implicit Dependencies" in settings and tried to build it from xCode again. a lot of mistakes with headers appeared, I fixed them
I used workspace, instead of xcodeproj
setting ARCHS seems unnecessary

Compiler error after adding a new Configuration in project

I encountered an issue after setting up a new value for Configuration when building (after reading the following post: Different App Icons for your iOS Beta, Dev, and Release builds). The error message is as follows:
ld: file not found:
/Users/.../Library/Developer/Xcode/DerivedData/SomeAppName-.../Build/Products/Debug-iphoneos/SomeAppName.app/SomeAppName
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I'm not sure how to fix it, checked and double checked with the article and I did follow everything as explained.
Edit: The error appears to be from the Tests target
Managed to find the answer: https://stackoverflow.com/a/29887473/2124535
I solved it in Xcode 6 very easy like this:
Select your project in the project navigator.
Select the YourProjectTests under targets
Under General tab change the Host Application from the drop down
Build and run.
This problem happened to me because I renamed my project and the tests could't find it anymore. - Yowza7
Removing the Tests target did not help for me.
I posted a solution that did work here: Created new XCode Configuration and Scheme - linker is suddenly failing
It basically involves telling Xcode to look for the libraries created using the Release configuration.

Unable to build iOS project using command line but fine via Xcode interface

I have an Xcode project. When in Xcode interactively, I am able to run/build/archive using the Ad_Hoc_Distribution configuration but when I run:
/usr/bin/xcodebuild -configuration Ad_Hoc_Distribution clean build
inside my project, I get an error:
/Users/esg/Documents/app-ios/testapp/testapp/AppDelegate.h:14:9: fatal error: 'RestKit/RestKit.h' file not found
#import <RestKit/RestKit.h>
^
1 error generated.
What would cause this to fail from the command line when it works via the interface?
My team has encountered this same issue. After upgrading from Xcode 4.3.2 to 4.4.1, files that used to be found correctly no longer do.
By comparing the output of xcodebuild vs. Xcode's own build logs, and then comparing vs. our Xcode 4.3.2 build logs, we discovered that xcodebuild and Xcode IDE do not build with the same header dependencies anymore. When xcodebuild runs a 4.4.1 build, it uses an incorrect base directory for include files, which does not include the entire current path leading to the .xcodeproj directory. The last two directory nodes in the folder path appear to be truncated.
But building from Xcode IDE worked fine.
We worked around this problem by adding the correct header paths, as Xcode reports it, as an additional header dependency:
$(SRCROOT) is what seems to be interpreted incorrectly when xcodebuild is employed. It should contain the two subdirectories I inserted in the second line.
I can only conclude that there is a ripe and spicy new bug in the xcode/xcodebuild interaction, but you can fix your header dependencies to at least get things compiling.
See my own issue regarding this.
xcodebuild header files not found in ReskIt
I resolved it by changing nothing, but by adding a workspace and a scheme and used it to build. All the header settings were the same as it is being set for Xcode GUI to build.

Resources