3

I am currently experiencing a bug while compiling in Xcode for iOS with Meteor since I upgraded Xcode to iOS 11 and Meteor to 1.5.2

The build in the meteor console runs well but when trying to run on Xcode, I get an error.

Here are the details:

duplicate symbol _OBJC_CLASS_$_CDVLogger in:
    /Users/almaju/Library/Developer/Xcode/DerivedData/Shotgun-gfxenslogefzngcppvotdeekcsof/Build/Intermediates.noindex/Shotgun.build/Debug-iphonesimulator/Shotgun.build/Objects-normal/x86_64/CDVLogger.o
    /Users/almaju/Library/Developer/Xcode/DerivedData/Shotgun-gfxenslogefzngcppvotdeekcsof/Build/Products/Debug-iphonesimulator/libCordova.a(CDVLogger.o)
duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
    /Users/almaju/Library/Developer/Xcode/DerivedData/Shotgun-gfxenslogefzngcppvotdeekcsof/Build/Intermediates.noindex/Shotgun.build/Debug-iphonesimulator/Shotgun.build/Objects-normal/x86_64/CDVLogger.o
    /Users/almaju/Library/Developer/Xcode/DerivedData/Shotgun-gfxenslogefzngcppvotdeekcsof/Build/Products/Debug-iphonesimulator/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)

I have these plugins in my project:

cordova-android-support-gradle-release@0.0.2
cordova-custom-config@2.0.3
cordova-plugin-dialogs@1.3.3
cordova-plugin-facebook4@1.9.1
cordova-plugin-inappbrowser@1.7.1
cordova-plugin-meteor-webapp@1.4.2
cordova-plugin-splashscreen@4.0.3
cordova-plugin-statusbar@2.2.3
cordova-plugin-vibration@2.1.5
de.appplant.cordova.plugin.local-notification@0.8.4
org.apache.cordova.dialogs@1.3.1
org.apache.cordova.vibration@2.1.3

I have been searching for a while, tried to meteor reset or remove and re-add ios-platform, played with Build Settings and so on but nothing seems to fix this issue...

Looking at cordova_plugins.js in the build, I can see this:

{
  "id": "cordova-plugin-console.console",
  "file": "plugins/cordova-plugin-console/www/console-via-logger.js",
  "pluginId": "cordova-plugin-console",
  "clobbers": [
    "console"
  ]
},
{
  "id": "cordova-plugin-console.logger",
  "file": "plugins/cordova-plugin-console/www/logger.js",
  "pluginId": "cordova-plugin-console",
  "clobbers": [
    "cordova.logger"
  ]
},

Might be the problem but I don't know how to prevent this in the meteor build...

Michael Oryl
  • 20,856
  • 14
  • 77
  • 117
Almaju
  • 1,283
  • 12
  • 31
  • Possible duplicate of [Duplicate symbols for architecture x86\_64 under Xcode](https://stackoverflow.com/questions/24298144/duplicate-symbols-for-architecture-x86-64-under-xcode) – Styx Oct 08 '17 at 17:30
  • No, this is an entirely different issue specific to Cordova. Not a dupe. – Michael Oryl Oct 31 '17 at 14:46

4 Answers4

6

It appears that the cordova-plugin-console functionality has been moved into the main Cordova files. If you are using a newer version of Cordova, you end up with two copies of the Console Logger code and you get the XCode error.

To get rid of the problem you will need to run:

cordova plugin remove cordova-plugin-console

and then ensure that there are no entries for it in your package.json file in the dependencies or plugins section.

I suggest you then remove and re-install the ios platform for your project to make sure everything is clean, but you might not need to.

cordova platform remove ios
cordova platform add ios

I found some commentary on the problem here: https://forum.ionicframework.com/t/getting-error-on-ios-build/109326/3

Michael Oryl
  • 20,856
  • 14
  • 77
  • 117
2

I managed to make it work by removing "CDVLogger" in Build Phases > Compile Sources. Not sure this is the perfect solution though.

Almaju
  • 1,283
  • 12
  • 31
  • Look at my answer below for the proper way to deal with the issue. Your method only temporarily deals with the problem. It will come back unless you remove the plugin. – Michael Oryl Oct 31 '17 at 14:47
0

I had the same problem and manually installing cordova-plugin-console@1.1.0 in app/.meteor/cordova-plugins worked for me.

It seems that MDG is working on fixing this issue in next version (Meteor 1.6.1)

Violeta
  • 140
  • 1
  • 8
0

My app was upgraded from Ionic 1 so maybe that's why I found references to cordova-plugin-console in 3 sections in package.json: dependencies, plugins, and cordovaPlugins. They all had to go. Still it wouldn't build due to the same error.

Found one more reference in config.xml as <plugin name="cordova-plugin-console" spec="1.0.5" />. That line had to go too.

In short remove all references to cordova-plugin-console.

Paul Sturm
  • 2,118
  • 1
  • 18
  • 23