Xcode 10 Error: linker command failed with exit code 1 - swift

I just updated my Xcode to Xcode 10 and now my project will not run and I get the error:
ld: library not found for -lstdc++.6
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I do not know what this means and how to fix it. I tried googling everywhere for the answer and came up with nothing. How can I fix this?

Open the projectname.xcworkspace if you are using cocoapods not the projectname.xcodeproj.
Alternatively, using terminal
$ open projectname.xcworkspace
Hope this helps.

I had this problem today in C++ using a newly upgraded Xcode 10 in a project that does not use pods, unlike the other answers.
When I clicked on the linker error there were no details given. This stumped me for a while and then I realised you can right-click the linker error and click "reveal in log".
In my case it was just a function that I had renamed-but-not-updated-all-the-references-to-it causing a linker error, but the real problem was that the linker error details were not being shown when the error occurred.

go to your project directory in the terminal
Type:
pod deintegrate
pod install

In your project, open the Project Navigator, and expand the Frameworks folder. You will see the file -lstdc++.6 highlighted in red, delete it, rebuild your project and you're good to go.

You can open the RN..xcworkspace, and expand the Frameworks folder. You will see the file highlighted in red, delete it,
Learn the build and rebuild the project,
This problem will be resolved. goog cluck!

please use cocoapods for dependency management, if you already using it then remove all pods and add it again / update all pods
https://stackoverflow.com/a/52050043/9978212

Related

"${PODS_ROOT}/SwiftLint/swiftlint" causes "Command PhaseScriptExecution failed with a nonzero exit code" with Xcode 10

Updating from Xcode 10.0 beta 2 to Xcode 10.0 beta 3 I now get this error at build time for an iOS project:
sourcekit: [1:connection-event-handler:10499: 0.0000] Connection interruptsourcekit: [1:updateSemanticEditorDelay:10499: 0.0007] disabling semantic editor for 10 secondssourcekit: [1:pingService:10499: 0.0007] pinging servicesourcekitten: connection to SourceKitService restored!
Connection interrupted
Never call this for file that sourcekitd fails.: file File+Cache.swift, line 127
/Users/Coeur/Library/Developer/Xcode/DerivedData/My-App-eloayqptodupvfhbyegtkncnhcpu/Build/Intermediates.noindex/My-App.build/UAT-iphonesimulator/My-App-Debug.build/Script-379156A71D62F5C100574D04.sh: line 2: 34382 Abort trap: 6 "${PODS_ROOT}/SwiftLint/swiftlint"
Command PhaseScriptExecution failed with a nonzero exit code
Swift 4.1
CocoaPods 1.5.3
SwiftLint 0.26.0
Its because of Keychain Access.
Open Keychain Access
Right Click Login Tab
Lock Keychain Login
Right Click Login Tab again
Unlock Keychain Login
and problem solved :)
It seems to be an issue with the SwiftLint 0.26.0 script when using Xcode 10.0 beta 3 or newer.
Cause
It seems related to SwiftLint #2276, itself related to SourceKitten 0.21.0, fixed in SourceKitten 0.21.1 and SwiftLint Master.
Solution
Update to SwiftLint 0.27.0 or newer:
pod 'SwiftLint', '~> 0.27'
(and run pod update SwiftLint)
Some Framework or SDK require Code Signing.
I done code signing and resolved the problem for me.
The pod that I was using was not updated for Xcode 10, so the solution that worked for me was to remove Cocoapods from my project and then installed again (the project was created on Xcode 9).
To remove it, the easiest way is:
$ sudo gem install cocoapods-deintegrate cocoapods-clean
$ pod deintegrate
$ pod clean
After that, install the pods again.
I just restarted my Macbook and it worked.
For me adding arm64 architecture in "Build Setting -> valid architectures" resolved the issue.
I had an authentication process (outside of Xcode) running in the background which seemed to be causing this issue for me. I had the keychain dialog up asking for my password. Solution was to restart the machine.
Solution worked for me
I deleted all pod generated files and folders as listed below
Podfile.lock
Pods folder
ProjectName.xcworkspace
Again install pod for this project.
Now open .xcworkspace. Build and run...
It may cause the iOS 13 version. My error is to look at below
Assignment/Pods-Assignment-frameworks.sh: eval: line 131: unexpected EOF while looking for matching `''
Command PhaseScriptExecution failed with a nonzero exit code
Pods -> Targets Support Files -> Pods-AppName -> Pods-AppName-frameworks.sh.
Just commented particular line 131
# eval "$code_sign_cmd"
then clean and run
For me it was an issue with swiftlint. This happens when ever there are serious errors, for example forced unwrapping that swift lint validates.
The actual SwiftLint errors are not shown. Instead this “Command PhaseScriptExecution failed with a nonzero exit code” error is shown. After a bit struggle, I figured out that if your project's directory name or any its hierarchy folders have an apostrophe 's , then actual swiftlint errors or warnings are not shown even after including the runscript for it.
So I just had to rename my folders.
For example:
User -> Dave's Projects -> Git -> ProjectName
should be changed to
User -> Daves Projects -> Git -> ProjectName
This will show you errors or warnings. You can then fix the errors and hopefully the concerned error will also be fixed.
This issue resolves for me when I wait and let the project complete indexing before I do anything!
Restarting Xcode 10.1 fixed it for me; arose while updating Cocoapods ('RxSwift').
If the directory where your project is has blank spaces that problem occurs
To solve that problem add double quotes(""). For example:
"$(SRCROOT)/my framework/path"
In my case, Apple development certificate got expires.
To verify open Keychain -> My certificates -> check developer certificate is valid or not, If certificate is not valid then follow the below steps.
Open your apple developer account and create a new development certificate
Download and add it in your keychain.
Go to profiles and open your existing development profile and add the newly created certificate.
Download the fresh profile and install it.
Hope this helps you too.
I had this issue on my ionic4 app after I have used cocoapods. My issue was that in Targets->Build Phases->Embed Pods Frameworks, I had a wrong path to Pods-MyApp-frameworks.sh script correcting that path solved the issue for me.
Its because most of the time $PODS_ROOT variable doesn't set after installing pods
For me, there seems to be an issue with the swiftlint script. It was initially this, Which was what was in the doc as of the time of installation
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
I resolve the issue by modifying it to
if swiftlint
then
echo "swiftlint installed"
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
Not sure, this may be due to my XCode version(10.3)
I resolve the issue by rewrite the .sh file.
Xcode 10 with Swift 3.
1.rename problem.sh file and command+A then command+C.
2.vi *problem*.sh and command+V.
3.:wq! to save the new file.
Then everything will be ok.
If not ok, chmod a+x *problem*.sh and try again.
Only the following helped me.
Delete Podfile.lock
run pod install
Optional - update SwiftLint version
I had a new Macbook and got this error when trying to archive. I forgot to install cocopods in the new machine, so I did, then restarted the computer and restarted Xcode and it worked.
If you're getting
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
and a red
Command PhaseScriptExecution failed with a nonzero exit code
You should install the specific version of libreadline that you need
brew install readline
brew list --versions readline
brew switch readline 0.0.0

Xcode 9.2: linker command failed with exit code 1 (use -v to see invocation)

I installed Cocoapods. I used GoogleMaps. When I build workspace on my device i get this error: Error
I also tried all this instructions: Linker command failed with exit code 1 after installing CocoaPods and firebase pod
P.S. Building on simulator works
Probably you've already check if you've open the .xcworkspace created in your project folder.(NOT .xcodeproj)
If still doesn't work try
Go to Project Settings.
Go to Build Settings.
Change BUILD ACTIVE
ARCHITECTURE ONLY to NO.

Linking error when building Parse in Xcode 7

I am trying to add the Parse.com SDK to my Xcode 7 project. I have followed the getting started guide and I have managed to do it before in Xcode 6.
However this time I am being shown this error message when I try to build:
ld: framework not found Bolts
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks
There seems to be an issue with Xcode 7 beta where the search path for manually added frameworks is missing.
To fix the issue add the search path by doing the following:
Select Project
Click on Targets
Click Build Settings
Search for: Framework Search Path
Add the following without the quotes: "$(PROJECT_DIR)" and choose recursive option.
The project should build now.
I suggest you integrate Parse using CocoaPods.
Cocoapods manages the library dependencies in a much better way.
The following is a sample PodFile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
inhibit_all_warnings!
target '**YourProjectName**' do
pod 'Parse', '~> 1.7.1'
pod 'AFNetworking', '2.2.3'
end

can somebody tell me how to resolve this issue " library not found for -lwoa_two"

ld: warning: directory not found for option '-L"/Users/qingyun/Sqy/iosHistory/iOS/iOS/newSDK/newFramework/GameLive/GamePlusAPI/woa"'
ld: library not found for -lwoa_two
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Xcode 5.0-DP test by iPhone 5 iOS 7 beta 6
OS X 10.8.4
When i add Third-Party Libraries in my project. then had this issue. i don't know why.
if somebody knows how to resolve this issue, please let me know.
thanks for reading ..
Go to your project directory and remove the folders Pods/ and yourProject.xcworkspace.
Run pod install again and reopen yourProject.xcworkspace on XCode. Things should go back to normal.

ld: 871 duplicate symbols for architecture armv7, clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am using FastPDFKit in my iPhone app for displaying PDF. When I run the project on simulator, it works fine. However when I run the project on iPhone, it gives me below error.
duplicate symbol _value_map in:
/Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
duplicate symbol _writeUnicodeToUTF8Buffer in:
/Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
ld: 871 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: 871 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea why it is happening like this?
Error comes when I add FastPDFFramework in Configuration in Debug and Release section.
Here's a solution I found even after messing with the header/framework search paths, rebuilding, etc:
http://support.fastpdfkit.com/discussions/problems/443-i-am-unable-to-link-fastpdfkitembeddedframework
I removed the -all_load linker flag in my project and it compiled successfully. As a warning, make sure removing this flag is appropriate for your project. It was probably placed there for a reason
Can you try to clean up the FastPdfKit target and recompile it? It should generate a new framework ex-novo that you then should be able to add to you project, overwriting the one you are using. You can grab the new .embeddedframework in the FastPdfKit project root directory.
These line helped me from the link below.
http://support.fastpdfkit.com/discussions/problems/759-duplicate-symbols-for-architecture-armv7
there are another reason this error often happens is accidentally importing the .m file instead of the .h.
it's happened to me :)
link : https://stackoverflow.com/questions/12279622/duplicate-symbols-for-architecture-i386-clang
You have too many #include or #import directives in header files for the same things. Move to using #class in headers and only import/include in your .m files.
In all you just need to review where these are and reassess them.
I add my solution, as if you follow the readme, it will ask you to do:
Inherit the project options: select the Project an from info tab and configurations line choose **FastPdfKitFramework** from the drop down list;
I replace the FastPdfKitFramework target to None and now it work great.
As it is on the readme file, I never add .a in my project so download the recompile one don't help me as I do not want to restart all integration.
I hope it can be helpful for someone.
I tries removing -all_loads linker flag, and it worked for me without any problem in the project.