Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Can't merge user_target_xcconfig for pod targets #161

Open
thomaskwan opened this issue Nov 12, 2022 · 6 comments
Open

Can't merge user_target_xcconfig for pod targets #161

thomaskwan opened this issue Nov 12, 2022 · 6 comments
Assignees

Comments

@thomaskwan
Copy link

Version

LibTorch-Lite (1.12.0), react-native-pytorch-core (0.2.2)

Problem Area

react-native-pytorch-core (core package)

Steps to Reproduce

Environment:

  • MacBook Air m1 Ventura 13.0
  • Darwin MacBook-Air.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64
  • npx --version
    8.3.1
  • packaage.json
{
  "name": "myapp",
  "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": "18.1.0",
    "react-native": "0.70.5",
    "react-native-pytorch-core": "^0.2.2"
  },
  "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.72.3",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}
  1. npx react-native init myapp
  2. cd myapp/ios && pod install
  3. cd ..
  4. npm install react-native-pytorch-core
  5. cd ios && pod install

Integrating client project
Pod installation complete! There are 60 dependencies from the Podfile and 51 total pods installed.

[!] Can't merge user_target_xcconfig for pod targets: ["LibTorch-Lite", "Core", "Torch", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["LibTorch-Lite", "Core", "Torch", "hermes-engine"]. Singular build setting CLANG_CXX_LIBRARY has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["LibTorch-Lite", "Core", "Torch", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["LibTorch-Lite", "Core", "Torch", "hermes-engine"]. Singular build setting CLANG_CXX_LIBRARY has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["LibTorch-Lite", "Core", "Torch", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

[!] Can't merge user_target_xcconfig for pod targets: ["LibTorch-Lite", "Core", "Torch", "hermes-engine"]. Singular build setting CLANG_CXX_LIBRARY has different values.

Expected Results

Dont expect to see the "Can't merge user_target_xcconfig for pod targets" messagesDon't

Code example, screenshot, or link to repository

No response

@raedle
Copy link
Contributor

raedle commented Nov 14, 2022

@thomaskwan, are there any issues besides the user_target_xcconfig merge issue (i.e., does the RN app build and run on iOS)?

Note: LibTorch-Lite is C++14 and hermes-engine is C++17 (IIRC). I am not aware of any way to fix this besides patching libraries locally. If anyone knows a fix, please let me know or submit a PR

@raedle raedle self-assigned this Nov 14, 2022
@thomaskwan
Copy link
Author

@raedle thanks for getting back. When I run "npx react-native run-ios", I get the following errors

❌  ld: in /Users/thomas/prj/test1/myapp/ios/Pods/LibTorch-Lite/install/lib/libtorch.a(empty.cpp.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/thomas/prj/test1/myapp/ios/Pods/LibTorch-Lite/install/lib/libtorch.a' for architecture arm64

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening myapp.xcworkspace.
info Run CLI with --verbose flag for more details.

Running on the actual phone is fine tho. Not sure if my original reported messages are related the simulator issue or not. Are we supposed to be able to run it on Simulator?

Thanks

@shahidjabbar
Copy link

@thomaskwan try running your Xcode in Rosetta mode. Go to your Application folder, double-tap on Xcode icon and select "Get Info". Select the option Open using Rosetta
And yes, Playtorch works flawlessly in Simulator too.

@shahidjabbar
Copy link

Also, could you try opening the workspace in Xcode, clean the Derived Data directory and rebuild everything?

@thomaskwan
Copy link
Author

@shahidjabbar thanks for the idea. I tried Rosetta mode and cleaning the derived data directory and that did not help.
I wonder if the problem is related to user_target_xcconfig being used in https://github.com/pytorch/pytorch/blob/master/ios/LibTorch.podspec#L25

I read from another project (https://code.videolan.org/videolan/VLCKit/-/issues/498) that user_target_xcconfig has been deprecated and should be avoided.

@shahidjabbar
Copy link

shahidjabbar commented Nov 16, 2022

Here is my Podfile. There are some options that you might want to turn on or off:

platform :ios, '12.1'

target 'app_test' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'app_testTests' 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)
    `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`

    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          # config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.1'
          # config.build_settings['ENABLE_BITCODE'] = 'NO'
        end
      end
  end
end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants