1159 повторяющихся символов для архитектуры x86_64 - PullRequest
0 голосов
/ 04 сентября 2018

У меня недавно была странная проблема с react-native-maps. При попытке скомпилировать приложение через xcode, я получаю следующую ошибку

...
ld: 1159 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Вся трассировка стека

Я уже все перепробовал. Например, эти сообщения первый второй

Это мой Подфайл:

platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'

target "__APP_NAME__" do
  react_native_path = "../node_modules/react-native"
  pod "yoga", :path => "#{react_native_path}/ReactCommon/yoga"
  pod 'React', path: '../node_modules/react-native', :subspecs => [
  'Core',
  'RCTActionSheet',
  'RCTGeolocation',
  'RCTImage',
  'RCTLinkingIOS',
  'RCTNetwork',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket'
  ]

  pod 'GoogleMaps'

  pod 'Firebase/Core', '~> 5.3.0'
  pod 'Firebase/Messaging', '~> 5.3.0'

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
    if target.name == "React"
      target.remove_from_project
    end
  end
end

Я также пытался использовать тот же Podfile, который указан в файле Readme в репозиторииact-native-maps (с такими же результатами), а также пытался удалить флаг -ObjC из Other Linker Flags, и это привел к созданию приложения, но оно вылетело с Thread 1: signal SIGABRT в файле main.m, когда я попытался запустить его. Thread 1: signal SIGABRT

EDIT:

Я вернул свой репозиторий git до установки react-native-maps, переустановил все модули узлов и попытался переустановить все модули (я запустил this и rm -rf ~/.cocoapods/repos/master && pod setup && pod install), затем попытался пересобрать проект в Xcode и до сих пор получил ту же ошибку. Мой Подфайл

platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'

target "_APP_" do
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
  pod 'React', path: '../node_modules/react-native', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]

  pod 'Firebase/Core', '~> 5.3.0'
  pod 'Firebase/Messaging', '~> 5.3.0'
end

Теперь мне интересно, что пошло не так с моим проектом?

1 Ответ

0 голосов
/ 05 сентября 2018

Итак, после целого дня отладки я нашел причину, по которой приложение не создавалось. Если бы я не решил ее, прежде чем опубликовать этот ответ, комментарий @Christos Koninis привел бы меня к основной причине проблемы. Я еще раз заглянул в журналы и увидел, что использую два экземпляра React. Один из node_modules/ и один из ios/pods/. В моем Podfile мне не хватало этого:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

Кредиты

В конце концов мой Podfile выглядит так:

platform :ios, '9.0'

target "_APP_" do
  rn_path = '../node_modules/react-native' # This path is likely to be `../node_modules/react-native` in your own project.
  rn_maps_path = '../node_modules/react-native-maps' # This path is likely to be `../node_modules/react-native-maps` in your own project.

  # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]

  # React Native third party dependencies podspecs
  pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

   # react-native-maps dependencies
   pod 'react-native-maps', path: rn_maps_path
   pod 'react-native-google-maps', path: rn_maps_path  # Remove this line if you don't want to support GoogleMaps on iOS
   pod 'GoogleMaps'  # Remove this line if you don't want to support GoogleMaps on iOS
   pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS

  # Firebase
  pod 'Firebase/Core', '~> 5.3.0'
  pod 'Firebase/Messaging', '~> 5.3.0'



end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
    if target.name == "React"
      target.remove_from_project
    end
  end
end
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...