Xcodebuild command failed - ios

Error:error module map file not found
Error:failed to emit precompile header (brdgeheader path with some random number)
Build command failed :-
PrecompileSwiftBridgingHeader normal armv7
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
I have tried lots of things change try headersearchpath, mapmodule path change and lots of thing but none of these work.

The error shows something about swift bridging header. Have you add the bridging header file in your project and define it on Build Settings at Swift Compiler section?

As per your logs :0: error: failed to emit precompiled header
error is coming from precompiled header so this value should be YES from the build systems.
Build Settings-> search for precompiled header and set it to YES.
Check your bridging header path $(SRCROOT)/MyPrefixHeaderFile.pch
It should be $(SRCROOT)/FolderName/MyPrefixHeaderFile.pch

Related

error: using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code

I have switched to Xcode12 for one of my static library apps. I am trying to make XCFramework distribution. After running build command,
xcodebuild archive -scheme "MySDK" -sdk iphoneos -archivePath “./archives/ios.xcarchive” -SKIP_INSTALL=NO
I am getting below error when I switched Build Settings -> Build Libraries for Distribution to YES,
<unknown>:0: error: using bridging headers with module interfaces is unsupported
Command CompileSwiftSources failed with a nonzero exit code
** ARCHIVE FAILED **
The following build commands failed:
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
CompileSwiftSources normal armv7s com.apple.xcode.tools.swift.compiler
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(3 failures)
This answer works but unfortunately creating .xcframework requires to set the option distribution YES.
How to resolve this issue?
Apple seems to be deprecating bridging headers in favor of modules, but their documentation regarding how to include C headers is missing. The information is instead found in the more detailed clang docs.
Try removing the bridging header from the project settings and instead create a module.modulemap file:
module MySdk {
header "MySdk-Bridging-Header.h"
export *
}
This has caveats, such as needing to import MySdk in your swift code and understanding that C functions will be exposed, but it got me over the hump.
One trick I discovered by trial and error is to include this modulemap file and C headers in the framework's Headers folder. This allows any app consuming the framework to automatically detect MySdk as a module.

duplicate symbol '_lprofMergeValueProfData'

I'm developing a framework "CurrentFramework" with a dependency "Dependency1", it works fine with running the example project, building the framework and testing.
but when i want to gather code coverage for the framework the following error occurs:
duplicate symbol '_lprofMergeValueProfData' in:
/directory/Documents/CurrentFrameworkProject/Pods/Dependency1/Dependency1.framework/Dependency1
/directory/Library/Developer/Xcode/DerivedData/CurrentFramework-hhnbyyjwzomjgjasdrewahvxlmyq/Build/Products/Debug-iphonesimulator/CurrentFramework.framework/CurrentFramework
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried doing this with 3 other frameworks importing "Dependency1", only 1 of them can get the code coverage data without error.
Some people suggested to check if i imported a ".m" instead of a ".h" somewhere but i don't think thats the case(i checked all the files)
This might not be the best answer, but here's some workaround i've done.
Make a file to store excluded symbol (_lprofMergeValueProfData). In this example i name it hidden_list.
hidden_list
Put the file on project root directory.
In your Xcode Project, Go to your Target and search Unexported Symbols File in Build Settings. add your file name containing list to exclude (hidden_list).
excluded_symbols
Run your project again, the error should be gone.

why am i getting this linker error while creating archive of my project in xcode 7.2.1

I am trying to create archive of my project and everytime i am getting this error:
ld: can't open output file for writing: /Users/ranbeerhora/Documents/KicksendRepo/KickSend/trunk/KicksendiOSSwift /Build/Intermediates/ArchiveIntermediates/KickSend/IntermediateBuildFilesPath/KickSend.build/Release-iphoneos/KickSend.build/Objects-normal/arm64/KickSend, errno=21 for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
i have tried different things but none of the solution works.
I got the answer.I was not giving path of the objective-c bridging header file in the build setting, when i gave the file path it worked.
Explanation:
xcode was not able to open output file for writing because it was not able to access that file since the path was not given when i gave the path xcode found the file and i was able to create the archive.

Xcode 7 build failed: ld: library not found for -lGoogleAnalyticsServices

Every time when I open my app with Xcode I get this error:
ld: library not found for -lGoogleAnalyticsServices
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Then I need to unmark the target on the libGoogleAnalyticsServices.a file and mark it on again. After the uncheck/check of the target the app runs normally...
I get 2 other warning when this happens:
ld: warning: directory not found for option '-L/Users/vision/Documents/Apps/Mijn Cijfers/Mijn'
ld: warning: directory not found for option '-LCijfers'
Now this looks like Xcode can't read spaces and looks for a new directory called Cijfers. My app is called: Mijn Cijfers, but I never had this problem before with spaces in my project name.
Every time when I check/uncheck the target of libGoogleAnalyticsServices.a the Library Search Path is adding new rows:
I think both cases has to do something with the warnings and errors that I get. It's really annoying to remove the Library Search Paths and check/uncheck the target to let my app run normally. -.-
Does anyone know a solution to solve this odd bug?
You need to delete all these path except the "$inherited" and then add Google Analytics library path (Drag the folder where you saved the library).
If you follow this then you don't need to recheck/uncheck the library path.
If you have just created pod file by running $ pod init command in terminal,
then just close project and Open projectName.xcworkspace instead of projectName.xcodeproj
which will not throw error -lxyzLibray eg. -lJSONModel not found.
Now compile and debug again It will work.

Apple LLVM 5.0 error when building

Upon creating a new project I named it o-golfer ( same as my project name )
Then I modified the Identity name to Application
Now when building it again, I get the Apple LLVM 5.0 error, as the cached precompiled header is trying to find again
Is there a way to clear and rebuild this cached header ?
I already tried to clean and build again the project ... same error
clang: error: no such file or directory: '/Users/yves/Developpement/iOS7/OPTIMAL/o-golfer/o-golfer/o-golfer-Prefix.pch'
Here is the error log :
ProcessPCH /Users/yves/Library/Developer/Xcode/DerivedData/o-golfer-cbxwkyokboekvvbscnyxjekgcqyf/Build/Intermediates/PrecompiledHeaders/o-golfer-Prefix-dnguhwlesygrvffouxoeiklsfygm/o-golfer-Prefix.pch.pch o-golfer/o-golfer-Prefix.pch normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/yves/Developpement/iOS7/OPTIMAL/o-golfer
setenv LANG en_US.US-ASCII
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/
...
clang: error: no such file or directory: '/Users/yves/Developpement/iOS7/OPTIMAL/o-golfer/o-golfer/o-golfer-Prefix.pch'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Make sure the "Prefix Header" build setting (to get to this, click on your project file in the navigator on the left, then go into the "Build Settings" tab) is set to the correct file name.
I had the same problem, make sure you change the prefix header in your project target and in your "app_name" target and "app_tests" target as well, as one of these being different will still throw the error. Hope this helps ;)

Resources