Build iOS app from command line brings errors - ios

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

Related

Xcodebuild script error: *.h file not found

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.

Building iOS app using Xcode works, but building the same app with xcodebuild command fails

Both new flutter and new react-native projects fail to build because the xcodebuild tool fails. They, however, succeed when I build the projects manually inside Xcode.
Apparently, the reason is because xcodebuild adds additional flag during the build, that, is:
export OTHER_CPLUSPLUSFLAGS=" -fmodule-map-file="/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap""
The result is that the build is failing because it cannot find the said module map, with the following error:
<unknown>:0: error: module map file '/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap' not found
The said module map is from a previous project (called WW2) which I moved. But the problem is that even newly-created projects are affected.
I wasted two days to solve this, even reading through the documentation about xcode build settings, but to no avail. What I'm trying to do is to find the source of this additional flag or configuration. I even used grep to find a file containing the particular flag, but it's not yet finished scanning my system.
So the problem is somehow the $PODS_ROOT variable is set to /Users/aa/code/WW2/ios/Pods, probably due to a canceled npm build. I only needed to restart the terminal and the problem is solved.
As a side note, I should have used the search function in the finder as it's much faster because it uses an index unlike grep.

codenameone, error when build ios apps with google maps extension

I tried to build condenameone project with googlemaps extension but it failed.
this is the error log :
The following build commands failed:
CompileC build/Build/Intermediates/ArchiveIntermediates/DanoneCodi/IntermediateBuildFilesPath/DanoneCodi.build/Release-iphoneos/DanoneCodi.build/Objects-normal/armv7/com_codename1_googlemaps_InternalNativeMapsImpl.o DanoneCodi-src/com_codename1_googlemaps_InternalNativeMapsImpl.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Failed xcodebuild step
How to fix this?
further question, if I want to decided to remvoe the googlemaps extensions, how to do it?
That's a partial log, we need the full log to help.
A common problem is developers including the cn1lib but not actually using it which fails as a callback collides with the optimizer that strips away unused parts.

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.

xcodebuild failure clang:error no such file or directory:

Having a problem when building with xcodebuild. My project/app builds fine with the Xcode - gui. It simply isn't finding/building the libcryptopp library which is part of the build process.
The error is:
clang: error: no such file or directory: '/Users/builder/repo/ioskpay/xcode-cryptopp/cryptopp/build/Release-iphoneos/libcryptopp.a'
This particular file should be derived from another project inside the main app - xcodebuild simply isn't correctly pointing at the right file folder which should be:
~/Library/Developer/Xcode/DerivedData
Any ideas?
To fix this, go to your project settings, go to Targets and select your main project target. Then go to Build phases. Under Target dependencies add the static library project.
This way, when you compile the main project, the static library subproject gets compiled before the main project and your static library will be available.
I had the same problem, but for a resource file .m
I opened target -> build phases -> Compile sources
and I found the file the compiler was tell it can't find duplicated: one with strange icon and the other with a normal icon. I simply removed the one with strange icon and it worked. ( I added the file multiple times and I had a merge conflict before that which made something wrong in the project file)
For your case I think you need to remove the lib from target dependencies list and add it again. This may work for you.
In Xcode Version 9.2 (9C40b) this happened when I drug a bunch of files into the project, some of which were duplicate. Rather than simply not adding the duplicates, it added them again and only the name, not the path.
In Target > Build Phases > Compile Sources each of the duplicates showed with no "...in" after them. Each one caused the clang error.
After removing all of the duplicates that Xcode collected, the project compiled and ran.
It makes you use the Project Navigator instead of managing your source files in the Finder. Then the Project Navigator can't replace duplicates like any decent file management system (ahem Finder). 🤨
My xCode info is:
I faced similar errors during xcode building projects (native swift, flutter, react native, native script) in which I got error messages related to clang compilar. Errors like:
clang-4.0: error: no such file or directory: '/Users/xxxxxxxx/Library/Developer/Xcode/DerivedData/xxxxxxxxxxxxxxx/Index/Data Store'
clang-4.0: error: cannot specify -o when generating multiple output files
others
Despite of errors related with DerivedData for native apps can be fixed by deleting the directory and, eventually, restart xCode and even restart the machine... in this case, you will see that after deleting the directory and start building process again, the error comes back.
Then, is the moment of checking the clang installation by running clang --version. The normal output will be something like:
as you can see the InstalledDir is incorrect for xCode. In my case, some days ago I needed to install Anaconda app (R, Python, etc) and, now, I remember that I had to install some dependencies and one of them was clang and its installation was altered.
To fix this problem (in my case that I will not need anaconda any more): (edited)
1.- Delete anaconda and all its dependencies (I recommend to use App Cleaner).
2.- Re-install xCode
After reinstalling xCode, if you type again clang --version, you'll get this:
More info at: https://github.com/flutter/flutter/issues/32457#issuecomment-496161092
Hopefully, this info helps some else.
Best
Ok so by simply adding the correct -target -configuration and -scheme parameters I got this to run correctly. However due to my running this in Jenkins for autobuild purposes it still doesn't work as I'd like - getting stuck in exactly the same place. It's odd because I have the exact same code being built in another job that isn't having this problem. There is no rhyme or reason for it at this point. I will keep shooting rubber bands at it and update when I have an answer...
Sometimes Xcode performs weird.
You have to find that static library project e.g.. "filename.a" under 'Link Binary With Libraries' in Build Phase and then remove it and add it again.
I had the same problem while I was archiving my target. I removed the library and the build succeeded.
For me it was because I had removed a package or pod. I ran pod install and it fixed it
Look for the missing file in the Xcode project i.e the files may be deleted or miss placed.
add the missing files to the xcode, then everything will work fine.
Run this command :
$ conda deactivate

Resources