Ionic Error: Apple Mach-O Linker Error


#1

I have the same problem as Ionic Error: Apple Mach-O Linker Error - Have tried so much already.

Also tried to remove and re-adding the iOS platform in our project. Even when I create a new blank Ionic project (with the same app id) I get the same error. This is my ionic info log:

cli packages: (/Users/niels/.config/yarn/global/node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : ios 4.5.0
    Ionic Framework    : ionic-angular 3.6.1

System:

    Node  : v6.11.2
    npm   : 2.15.12 
    OS    : macOS Sierra
    Xcode : Xcode 8.3.3 Build version 8E3004b

Any idea?


Ionic Error: Apple Mach-O Linker Error - Have tried so much already
#2
[ERROR] An error occurred while running cordova build ios (exit code 1):

        
        (truncated) ... /Users/niels/Code/crappyapp/platforms/ios/build/emulator/include 
        -I/Users/niels/Code/crappyapp/platforms/ios/build/emulator/usr/local/lib/include 
        -I/Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/UninstalledProducts/include 
        -I/Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/UninstalledProducts/iphonesimulator/include 
        -I/Users/niels/Code/crappyapp/platforms/ios/build/emulator 
        -I/Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/DerivedSources/x86_64 
        -I/Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/DerivedSources 
        -F/Users/niels/Code/crappyapp/platforms/ios/build/emulator -include 
        /Users/niels/Code/crappyapp/platforms/ios/build/sharedpch/MyApp-Prefix-bsyppdqhhyomaoefawtzpjlhihyi/MyApp-Prefix.pch 
        -MMD -MT dependencies -MF 
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/IonicKeyboard.d 
        --serialize-diagnostics 
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/IonicKeyboard.dia 
        -c 
        /Users/niels/Code/crappyapp/platforms/ios/MyApp/Plugins/ionic-plugin-keyboard/IonicKeyboard.m 
        -o 
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/IonicKeyboard.o
        
        Ld build/emulator/MyApp.app/MyApp normal x86_64
             cd /Users/niels/Code/crappyapp/platforms/ios
             export IPHONEOS_DEPLOYMENT_TARGET=10.0
             export 
        PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
             
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 
        -arch x86_64 -isysroot 
        /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk 
        -L/Users/niels/Code/crappyapp/platforms/ios/build/emulator 
        -F/Users/niels/Code/crappyapp/platforms/ios/build/emulator -filelist 
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp.LinkFileList 
        -Xlinker -rpath -Xlinker @executable_path/Frameworks 
        -mios-simulator-version-min=10.0 -dead_strip -Xlinker -object_path_lto -Xlinker 
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp_lto.o 
        -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc 
        -fobjc-link-runtime -ObjC -Xlinker -sectcreate -Xlinker __TEXT -Xlinker 
        __entitlements -Xlinker 
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp.app.xcent 
        /Users/niels/Code/crappyapp/platforms/ios/build/emulator/libCordova.a -Xlinker 
        -dependency_info -Xlinker 
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp_dependency_info.dat 
        -o /Users/niels/Code/crappyapp/platforms/ios/build/emulator/MyApp.app/MyApp
        duplicate symbol _OBJC_CLASS_$_CDVLogger in:
             
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/CDVLogger.o
             
        /Users/niels/Code/crappyapp/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)
        duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
             
        /Users/niels/Library/Developer/Xcode/DerivedData/MyApp-gwyyhhzbodfcpqbjpzxwnzohsxgw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/CDVLogger.o
             
        /Users/niels/Code/crappyapp/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)
        ld: 2 duplicate symbols for architecture x86_64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        
        ** BUILD FAILED **
        
        
        The following build commands failed:
        	Ld build/emulator/MyApp.app/MyApp normal x86_64
        (1 failure)
        Error: Error code 65 for command: xcodebuild with args: 
        -xcconfig,/Users/niels/Code/crappyapp/platforms/ios/cordova/build-debug.xcconfig,-workspace,MyApp.xcworkspace,-scheme,MyApp,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS 
        Simulator,name=iPhone 
        SE,build,CONFIGURATION_BUILD_DIR=/Users/niels/Code/crappyapp/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/niels/Code/crappyapp/platforms/ios/build/sharedpch
  

Is there anything I can do to see more logs?

And @robertlair, I just installed my new MacBook last week, so I doubt if that will fix my problem. I just installed Visual Studio Code, Xcode, Angular, Ionic and Cordova, that’s about it. But good to hear that you are back in business and thanks for your suggestion :smiley:


#3

Ahhh, I know what it is!

You are running cordova-ios 4.5.0 - did you remove the console plugin? If not, do so and try again.


#4

This is what I did:

> ionic cordova plugin remove cordova-plugin-console

cordova plugin remove cordova-plugin-console --save
✖ Running command - failed!
[ERROR] An error occurred while running cordova plugin remove cordova-plugin-console --save (exit code 1):

Error: Plugin "cordova-plugin-console" is not present in the project. See `cordova plugin list`.

Wierd, the cordova-plugin-console is present in the package.json and the config.xml, but ok. Lets try to add it first, so I did:

> ionic cordova plugin add cordova-plugin-console

cordova plugin add cordova-plugin-console --save
✔ Running command - done!
Adding cordova-plugin-console to package.json
Saved plugin info for "cordova-plugin-console" to config.xml

Then I tried to remove it:

> ionic cordova plugin remove cordova-plugin-console

cordova plugin remove cordova-plugin-console --save
✔ Running command - done!
Removing "cordova-plugin-console"
Removing plugin cordova-plugin-console from config.xml file...
Removing cordova-plugin-console from package.json

Ok, that worked, no build it.

> ionic cordova build ios

[INFO] Running app-scripts build: --platform ios --target cordova    
[12:57:50]  build dev started ... 
[12:57:50]  clean started ... 
[12:57:50]  clean finished in 4 ms 
[12:57:50]  copy started ... 
[12:57:50]  transpile started ... 
[12:57:53]  transpile finished in 2.49 s 
[12:57:53]  preprocess started ... 
[12:57:53]  deeplinks started ... 
[12:57:53]  deeplinks finished in 120 ms 
[12:57:53]  preprocess finished in 121 ms 
[12:57:53]  webpack started ... 
[12:57:53]  copy finished in 2.75 s 
[12:58:01]  webpack finished in 8.09 s 
[12:58:01]  sass started ... 
[12:58:02]  sass finished in 794 ms 
[12:58:02]  postprocess started ... 
[12:58:02]  removed unused font files 
[12:58:02]  postprocess finished in 5 ms 
[12:58:02]  lint started ... 
[12:58:02]  build dev finished in 11.54 s 
> ionic cordova prepare
> cordova prepare
⠴ Running command [12:58:56]  lint finished in 54.45 s 
✔ Running command - done!
> cordova build ios
✔ Running command - done!
...........
** BUILD SUCCEEDED **

:smiley: That worked! :+1: Thanks for your help @Sujan12!

But now the plugin is also removed for Android, can that cause any problems for my Android app? Are you sure I don’t need the cordova-plugin-console plugin? And what is the difference with the iOS engine 4.4 and 4.5?


#5

You should revert back to 4.4.0 and wait till they fix 4.5.0 using the following commands:

npm uninstall cordova-ios

npm install cordova-ios@4.4.0

ionic cordova platform add ios@4.4.0

ionic cordova build ios


#6

That works and sounds like the safest option for now.


#7

There will be no fix for cordova-ios as there is no bug. Cordova deliberately integrated the console plugin (and kinda decided in an “interesting” way for the upgrade path… but well, it is how it is)

See here: Cordova-ios 4.5.0 was released! and the linked blog post in there.

But staying with cordova-ios 4.4.0 still is a valid choice for now.

Not for iOS anyway.

See the linked blog post above.


#8

I’m stucked with the same problem…
I removed the cordova-plugin-console => nothing
I get back to cordova-ios 4.4.0 => nothing

I don’t know what to do…

cli packages: (/Users/simonesummo/Sviluppo/IONIC/glt-mobile/node_modules)

@ionic/cli-plugin-proxy : 1.5.8
@ionic/cli-utils        : 1.19.2
ionic (Ionic CLI)       : 3.20.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : android 6.3.0 ios 4.4.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v9.4.0
npm               : 5.8.0
OS                : macOS High Sierra
Xcode             : Xcode 9.3 Build version 9E145

Environment Variables:

ANDROID_HOME     : /Users/simonesummo/Library/Android/sdk/
HTTP_PROXY       : not set
http_proxy       : not set
HTTPS_PROXY      : not set
https_proxy      : not set
IONIC_HTTP_PROXY : not set
PROXY            : not set
proxy            : not set

Misc:

backend : pro