realm-js: ld: library not found for -lrealm-js-ios

How frequently does the bug occur?

All the time

Description

our team is trying to plugin realm as main db, however, we tried many times, it always return the below errors.

solution 1: clean & deintegrate everything in pod then reinstall everything

solution 2: excludes arm64

our pod file:

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

platform :ios, '12.0'
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.name == "Debug" || config.name == "Release-e2e"
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
      else
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
      end
    end
  end
end

target 'Internal' do

  pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
  'BarcodeDetectorMLKit'
]

  use_frameworks! :linkage => :static
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
end

realmjs: 10.11.0

node version: v14.15.4

yarn version: v1.22.10

pod version: 1.10.1

react native: 0.65.1

Stacktrace & log output

: warning: directory not found for option '-L"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator" "" "/Users/myname/Library/Developer/Xcode/DerivedData/Internal-finbwplvgoowpcfagqvegkbibheg/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/realm-js-ios"'
ld: library not found for -lrealm-js-ios
clang: error: linker command failed with exit code 1 (use -v to see invocation)


```Showing All Messages
Directory not found for option '-L"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator" "" "/Users/myname/Library/Developer/Xcode/DerivedData/Internal-finbwplvgoowpcfagqvegkbibheg/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/realm-js-ios"'```

log from terminal:

The following build commands failed:
	Ld /Users/myname/Library/Developer/Xcode/DerivedData/Internal-finbwplvgoowpcfagqvegkbibheg/Build/Products/Debug-iphonesimulator/Rivian\ HUB.app/Rivian\ HUB normal (in target 'Internal' from project 'Internal')

Can you reproduce the bug?

Yes, always

Reproduction Steps

No response

Version

10.11.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

xcode 13.2; react native 0.65.1

Build environment

Which debugger for React Native: …

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 30 (15 by maintainers)

Most upvoted comments

@tomduncalf meanwhile, we find out the root cause on our build machines, they all are because of cocoapod version; it was 1.10.1; after upgraded to 1.11.0, everything gets to work nicely and correctly.