Apple Mach-O Linker Errors after restarting mac - ios

I was prompted to restart the computer after a few updates were installed and since then my app keeps failing to build. It was working fine prior to restarting the computer. I don't believe xcode was one of the updates. I am currently running Xcode Version 4.6.3 (4H1503).
Apple Mach-O Linker errors:
(null): "_main", referenced from:
(null): Linker command failed with exit code 1 (use -v to see invocation)
I have tried removing all frameworks and adding them back.
Any idea what is causing the app to fail to build now?

After spending many hours trying to figure out what happened I finally discovered that somehow with the installation of the updates and restarting the computer many files were no longer listed in the Compile Sources section.
I have no idea why it happened.
To solve the issue I just had to add the files back.
If you're like me and have no clue what files actually are suppose to be there I just added all files available and then Xcode raised a warning stating which files it could not understand. I just went and removed any file that xcode didn't like in the Compiled Sources section.
Yes I know this a very crude way of handling it, but my project is working again now and that makes me happy. :-)

Related

Undefined symbols for architecture x86_64: "_RCTSetLogFunction" in React Native when compiling iOS

I'm revamping an old app written in react-native (which had no changes from ~2018) to its latest versions. I migrated from react-native 0.59 to the latest 0.64
To do so, I got help from the react-native migration help tool.
I also had to update my dependencies to work with auto-link and cocoa pods. I'm fairly new to mobile and react native (my background is on web with plain react), so there might be something obvious that I'm missing.
But, while android compiles and works successfully on my Mac, I can't make the compilation to work with iOS.
As the title says, I'm getting the following error:
Undefined symbols for architecture x86_64:
"_RCTSetLogFunction", referenced from:
-[MetronomeWalletTests testRendersWelcomeScreen] in MetronomeWalletTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is happening in the test project, not in the main project (or however it is called).
Things I've tried
I enabled dead code stripping as this issue suggests in both the main and the test project, for debug and release, in the "targets" section.
I also tried disabling that same setting, as this issue suggests
I tried cleaning and rebuilding
I tried adding Javascript.framework to the linked libraries
If I understand correctly, this error takes place in the phase "Link {projectName}Tests (x86_64)"
None of these have worked. I've run out of ideas.
Environment:
Mac pro with Big Sur 11.3.1 (I'm also new to Mac in general, so let me know if anything might be missing)
RN version: 0.64.2
Xcode version: 12.5.1
I get this error building both from the console and from xcode
It looks like this issue has been fixed for newly scaffolded projects. I was also facing this issue when upgrading an existing React Native project from 0.59.10 to 0.65, with the caveat that it was only happening when building in Release mode (e.g. when archiving the project in Xcode).
The solution for me is outlined in this PR - the gist is to wrap any usage of RCTSetLogFunction inside an #ifdef DEBUG block, to prevent it being run in Release mode.
I realise this might not answer the original question but I thought I'd post it here in case its helpful to anyone else.

When publishing a project (swift 4.2) in the AppStore, an error occurs when linking the libPrinterSDK library.a

All kind time of day. The project on Swift uses the SDK for blueTouth printer Mini Thermal Printer POS-5805DD. The libPrinterSDK library (included with the printer) has been added to the root of the project.a and the PrinterSDK header file.h, header-file is connected via bridge, when you run the project on a real device-everything works correctly, no errors occur. But when you try to build a project to upload to the AppStore, at the very end when linovke libprintersdk library.a an error appears:
ld: bitcode bundle could not be generated because
'/Users/ivan/Documents/MyProject/PrinterSDK/libPrinterSDK.a
(GCDAsyncSocket.o)' was built without full bitcode. All object files
and libraries for bitcode must be generated from Xcode Archive or
Install build file
'/Users/ivan/Documents/MyProject/PrinterSDK/libPrinterSDK.a' for
architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If there is any experience of building a project with libPrinterSDK files.a and PrinterSDK.h, I would really appreciate any help. Thanks.
Im not sure your project has turn Enable Bitcode off yet, if not, try to set No like this image below and Archive project again.
If it doesn't work, you can refer here

Bitrise, Xcode9 (beta6): bitcode bundle could not be generated

One of the frameworks I use fails to get built with Bitrise with Xcode9beta stack. I must point out that this is Bitrise-specific issue. Or either, Bitrise/Eureka issue. Eureka is a particular instance of third-party framework.
Project is built well on the local machine, no bitcode-related issues whatsoever. But whenever I run CI, I get that typical log:
❌ ld: bitcode bundle could not be generated because '.../Frameworks/Eureka.framework/Eureka' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '.../Frameworks/Eureka.framework/Eureka' for architecture armv7
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
I followed these guidelines:
iOS library to BitCode
Flag is set.
I have also tried similar settings for head project/target, to no avail.
Any suggestions?
Seems to be a dependency (version) issue:
... was built without full bitcode. All frameworks and dylibs for bitcode must be generated ...
Might be enough to just upgrade the eureka dependency.
Another thing is that Xcode 9 (GM) is also available now, that alone might help.
Edit: a third option; you might have to disable Bitcode in the Xcode / xcodebuild command, as the default changed in Xcode 9 for some configs. See e.g. https://discuss.bitrise.io/t/xcode-archive-significantly-slower-on-xcode-9-0-x-stack-compared-to-xcode-8-3-x-stack/2708/2?u=viktorbenei
Without more log / info unfortunately it's quite hard to say with certainty.
If neither would help, you can also create an issue report at https://discuss.bitrise.io/c/issues/build-issues and the bitrise team will look into it ;)

xcode 7.2 (cordova) clang: error: linker command failed with exit code (how to troubleshoot)

I am trying to troubleshoot this annoying error.
I have a cordova project which was working fine up until changed the name of the app (took out spaces) in the XCode general panel. After that (it seemed to work fine) I removed and reinstalled a plugin (LocalNotifications). Then I started getting all kinds of errors in the build process - libraries not found and other errors I don't recall immediately.
Then:
I removed the ios platform via CLI and added it again.
I manually moved all the SDKs back into Frameworks, etc.
I deleted derived data
I cleaned the xcode project quit xcode and relaunched
After all that (twice) I am consistently getting the error in build:
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I noticed it always happens after a certain plugin is loaded. I was trying to figure out where XCode is finding the duplicate method (symbol) by looking at the error log. When I go into build phases and reorder the linked libraries that doesn't seem to influence the order in which they're compiled in the build process.
My questions are:
how do I narrow down where the duplicate symbol is ?
does it matter the order of the linked libraries in Build Phases?
could my renaming of the app be a factor here?
I seem to recall this happening before and I found there was some duplicate files left over from uninstalling plugins. However I have removed and added the IOS platform so that should rule out any duplicates?

iOS Xcode compile error: unable to execute command: Segmentation fault: 11

I have a project which compiled perfectly in the past, but after the last Xcode update (6.3.2) I get a compile error whenever I try to run it directly on a device. Building and Running it in the simulator works fine. The Archive function works fine as well. But no matter what device I connect or what iOS version the device is running, I always get the same compile error:
Stack dump:
0. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIFilter.h:221:39: current parser token 'NS_REQUIRES_NIL_TERMINATION'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: arm-apple-darwin14.3.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/p5/2yjs4f055hb0vvgl12yvj38r0000gq/T/SmallAdsSystem-a86b3e.m
clang: note: diagnostic msg: /var/folders/p5/2yjs4f055hb0vvgl12yvj38r0000gq/T/SmallAdsSystem-a86b3e.cache
clang: note: diagnostic msg: /var/folders/p5/2yjs4f055hb0vvgl12yvj38r0000gq/T/SmallAdsSystem-a86b3e.sh
clang: note: diagnostic msg:
********************
It shows me random files that I'm supposed to submit to the bug report.
I haven't made any code changes from a working version to the version causing the current problems and I even reverted to an earlier version which is live and running in the Appstore but still the same error.
I have deleted xcode and installed again trough the app store
I tried making changes to my code to maybe pinpoint any problems but since the source file of the problem changes every time, I don't really think anymore that it has anything to do with my code.
This is driving me mad.
Any help is much appreciated
I tried to add the paypal framework to my iOS Project (Using Xcode 7.2 and Objective-C language), When building it is not giving any error, but when I try to archive the Project and trying to make the IPA, I am getting that Error
unable to execute command: Segmentation fault: 11
Screenshot:
After huge trying I have disabled the Bitcode in Project's Target->Build Settings->Enable Bitcode. Now the build can be achieved. Please check the following screenshot.
I found a fix for my problem:
I'm using a virtual machine and opened the project directly in the shared folder. I moved the project to the documents and now it works!
unable to execute command: Segmentation fault: 11.
I was able to turn off the bitcode and able to achieve the ipa.
An in depth of what bitcode means can be seen here
We've just realized that segfault was caused by invalid unicode characters in our sources.
If you are using a virtual machine, then copy the files inside the virtual machine, don't import from your shared files, and it will work.
I had the exact same problem.
In my case I looked at the offending file and played around with it. I was able to resolve the error by commenting out a giant NSDictionary declaration:
NSDictionary* glyphNameToUnicode = [[NSDictionary alloc] initWithObjectsAndKeys:
#"A", #"A",
#"\u00C6", #"AE",
#"\u01FC", #"AEacute",
#"\u01E2", #"AEmacron",
This thing had probably 300 lines maybe more. Instead I moved the declaration into a file and loaded the dictionary from the file. Not sure if that helps, but in my case those files were not random...
Its deff a bug with xcode though...
Pods are provided xcode/.... path for installation from git and i installed xcode 7.3.1 and its named like xcode3 so i face this type of error but when i renamed it to xcode then this error is solved for me.
So In summary, First of all please check your xcode name in application section.
If it is not xcode then please rename it to xcode and try to run your app.
Apparently it was a bug in my Xcode version. Had to revert to an old one and everything worked again. With the newest update everything was working ok again.
In order to solve a problem (a known bug closed as a duplicate as of this writing) that caused apps built under 10.12 (macOS Sierra) to fail to launch under 10.9 (even when they'd done so without trouble previously), I'd installed 10.11 and Xcode 7.3.1 under a VMWare instance. Xcode (due to laziness on my part) was copied to the Desktop.
After reading SmarterSusheel's answer regarding a renamed Xcode, it dawned on me it may be path-related, so I moved Xcode to /Applications and tried again. Problem (mostly) solved. I say "mostly" because I also had to copy my project folder into the VMWare instance since it seemed to have issues building under the shared folder as well.
Setting Link-Time Optimization to NO in both Debug and Release mode is what resolved the problem for me.
I was facing similar issue:
clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
Simply updating from Xcode 7.2 to 7.3.1 has resolved the issue!
I only had problem for i386 architecture when building for iPhone 4s simulator running 9.3
When disabling bitcode didn't work (suggested above), i tried to look at the source code. I didn't find any ascii related stuff (suggested by others), so I tried to comment out method by method until I found the offending line. For me the error was caused by this:
let keyboardSize = ((info![UIKeyboardFrameBeginUserInfoKey] as AnyObject).cgRectValue.size)
Changed it into:
let keyboardSize = (info![UIKeyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue.size
Quit and reopen the Xcode worked for me !
make sure you clean the build folder after reopening the Xcode !
I was facing similar issue:
clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
then i was change my Provisioning profile.

Resources