realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

xcode 13 wont build due to clash with GCDWebServer

Open stefoid opened this issue 2 years ago • 11 comments

How frequently does the bug occur?

All the time

Description

Moving from xcode 12 to 13 produces the output below.

I have tried doing exactly what is says by specifying an explicit version in the podspec for the target but that doesnt help.

Showing my ignorance of the build process here, I guess, but can anyone tell me how to resolve this?

cheers

Stacktrace & log output

2022-03-28T22:41:02.5049610Z warning: Multiple targets match implicit dependency for linker flag '-lGCDWebServer'. Consider adding an explicit dependency on the intended target to resolve this ambiguity. (in target 'GeoX' from project 'Geo')
2022-03-28T22:41:02.5152340Z     note: Target 'GCDWebServer' (in project 'RealmReact')
2022-03-28T22:41:02.5253740Z     note: Target 'GCDWebServer' (in project 'Pods')
2022-03-28T22:41:02.5273810Z note: Building targets in dependency order
2022-03-28T22:41:02.5327490Z error: Multiple commands produce '/Users/runner/Library/Developer/Xcode/DerivedData/Geo-cucvwhqycmrcwsfghjbccufelkjl/Build/Intermediates.noindex/ArchiveIntermediates/GeoX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libGCDWebServer.a':
2022-03-28T22:41:02.5357580Z 1) Target 'GCDWebServer': Libtool /Users/runner/Library/Developer/Xcode/DerivedData/Geo-cucvwhqycmrcwsfghjbccufelkjl/Build/Intermediates.noindex/ArchiveIntermediates/GeoX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libGCDWebServer.a normal
2022-03-28T22:41:02.5462030Z 2) Target 'GCDWebServer': Libtool /Users/runner/Library/Developer/Xcode/DerivedData/Geo-cucvwhqycmrcwsfghjbccufelkjl/Build/Intermediates.noindex/ArchiveIntermediates/GeoX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libGCDWebServer.a normal

Can you reproduce the bug?

Yes, always

Reproduction Steps

No response

Version

10.14.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

ios

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

stefoid avatar Mar 29 '22 00:03 stefoid

I am not experiencing this (using Xcode v13.3).

I have a few questions, which might help us diagnose this:

  • What version of React Native are you using here?
  • Does your app have a direct dependency on GCDWebServer?
  • Did you do "the usual" dance of clearing build folder (from within Xcode), perhaps deleted the Pods and ran pod install, etc.?

kraenhansen avatar Mar 29 '22 08:03 kraenhansen

Hi - actually this is built using 'microsoft app center' which always builds from a clean slate.

RN is 63

Ill search for what else uses it and get back to you

stefoid avatar Mar 29 '22 13:03 stefoid

Hmm, not sure how to find out where it is being pulled in, other than Realm. npm list fails to reveal anything. I wouldnt be surprised if it was something like segment/analytics or the newrelic agent we are using

stefoid avatar Mar 29 '22 13:03 stefoid

@kraenhansen

As far as I can see, Realm is the only package depending on GCDWebServer. If I remove realm from the package list, GCDWebServer disappears as a target from my Pods directory.

In the build log, it is complaining: 2022-03-28T22:41:02.5152340Z note: Target 'GCDWebServer' (in project 'RealmReact') 2022-03-28T22:41:02.5253740Z note: Target 'GCDWebServer' (in project 'Pods')

so if GCDWebserver is a target in project Pods and project RealmReact, and Realm is responsible for it being in the Pods project, is it somehow the cause of this issue all by itself?

stefoid avatar Mar 29 '22 23:03 stefoid

same problem

jdl7758258 avatar Mar 30 '22 13:03 jdl7758258

@jdl7758258 when you say the same problem, you mean build fails in 'App Center' or just in general?

For whatever reason, although xcode complains about the multiple dependency, it still compiles - it doesnt stop the build with a 'multiple commands produce...' error.

I mean, it would be ideal if Realm didnt produce dual dependencies for the library. Has anyone got a suggestion for how to address this in the podfile or whatever?

In the meantime, Ill see what I can do with App Center. Perhaps in the way of ignoring certain errors or similar

stefoid avatar Mar 31 '22 01:03 stefoid

As a workaround you could start using the "hermes" releases, it doesn't have a dependency on GCDWebServer:

npm install realm@hermes

kraenhansen avatar Mar 31 '22 09:03 kraenhansen

@kraenhansen Good to know thats an option, thx

stefoid avatar Mar 31 '22 11:03 stefoid

I can produce a similar problem by following this tutorial https://www.mongodb.com/docs/realm/sdk/react-native/install

Command

/Users/michael/.rbenv/versions/2.7.4/bin/pod install

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.11.3
        Ruby : ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-darwin20]
    RubyGems : 3.1.6
        Host : macOS 12.4 (21F79)
       Xcode : 13.2.1 (13C100)
         Git : git version 2.23.0
Ruby lib dir : /Users/michael/.rbenv/versions/2.7.4/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MyRealmApp' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MyRealmAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

Error

JSON::ParserError - 434: unexpected token at '{
          "name": "Core",
          "dependencies": {
            "GCDWebServer/Core": [

            ]
          },
          "source_files": "GCDWebDAVServer/*.{h,m}",
          "requires_arc": true,
          "ios": {
            "libraries": "xml2"
          },
          "'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/2.7.0/json/common.rb:156:in `parse'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/2.7.0/json/common.rb:156:in `parse'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification.rb:748:in `from_string'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification.rb:722:in `from_file'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source.rb:188:in `specification'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver/lazy_specification.rb:37:in `specification'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/2.7.0/delegate.rb:342:in `block in delegating_block'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/2.7.0/delegate.rb:343:in `block in delegating_block'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:178:in `dependencies_for'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:18:in `block in dependencies_for'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:17:in `dependencies_for'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:809:in `block in group_possibilities'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:808:in `reverse_each'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:808:in `group_possibilities'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:779:in `possibilities_for_requirement'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:761:in `push_state_for_requirements'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in `activate_new_spec'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416:in `analyze'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161:in `install!'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
/Users/michael/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
/Users/michael/.rbenv/versions/2.7.4/bin/pod:23:in `load'
/Users/michael/.rbenv/versions/2.7.4/bin/pod:23:in `<main>'

package.json

  "name": "myrealmapp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.68.2",
    "realm": "^10.17.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.67.0",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

I can also confirm that @kraenhansen 's proposed solution works.

timppa23 avatar May 27 '22 12:05 timppa23

Same issue here, and building works but not archiving. I do not wish to use hermes for now. Any solution?

Pingou avatar Jun 26 '22 16:06 Pingou

Was able to archive by removing GCDWebServer from libraries -> RealmReact.xcodeproj -> targets -> GCDWebServer. Not sure of the whole implications but the app works for me.

Pingou avatar Jun 28 '22 10:06 Pingou

We have removed GCDWebServer in version 11.0.0 and suggest that you use Flipper to debug.

kneth avatar Nov 03 '22 16:11 kneth