react-native icon indicating copy to clipboard operation
react-native copied to clipboard

C++17 features like std::optional throwing error

Open raza-jamil-reckon opened this issue 1 year ago • 7 comments

Description

Having trouble upgrading from RN 0.71.1 + MacOS + XCode 14 13 to 0.73.6 + Mac 14.4.1 + XCode 15.

Steps to reproduce

1 - I've applied all the updates per the upgrade helper tool. 2 - Update a bunch of packages to the latest version. Some of them require the C++ dialect to be changed to 17 or above because they use std::optional features so below I've added the below code to my pod file. I've left out the required boilerplate code.

  post_install do |installer|
      installer.pods_project.targets.each do |target|
      target.build_configurations.each do |build_configuration|
        build_configuration.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17'
      end
    end
  end

3- Step 2 makes the syntax errors go away, when running from XCode, for all the Pods except for RCTTypeSafety which gives the following error inside the RCTConvertHelpers.h file: /.../Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety/RCTConvertHelpers.h:41:16 No template named 'optional' in namespace 'std'

I've tried a bunch of different dialects and settings but I can get it the compile. My understand is that this pod is part of the default react-native pods?

I've been stuck for some time on this, any pointers would be greatly appreaciated.

Many thanks.

React Native Version

0.73.6

Affected Platforms

Build - MacOS

Output of npx react-native info

System:
  OS: macOS 14.4.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 323.20 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.asdf/installs/nodejs/18.17.1/bin/node
  Yarn:
    version: 1.22.10
    path: ~/.asdf/shims/yarn
  npm:
    version: 9.6.7
    path: ~/.asdf/plugins/nodejs/shims/npm
  Watchman:
    version: 2023.02.06.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.3 AI-213.7172.25.2113.9123335
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.16.1
    path: /Users/raza.jamil/.asdf/shims/javac
  Ruby:
    version: 2.7.6
    path: /Users/raza.jamil/.asdf/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

/.../apps/payroll/node_modules/react-native/Libraries/TypeSafety/RCTConvertHelpers.h:41:16 No template named 'optional' in namespace 'std'

Reproducer

n/a

Screenshots and Videos

Screenshot 2024-04-09 at 2 27 17 PM

raza-jamil-reckon avatar Apr 09 '24 04:04 raza-jamil-reckon

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

github-actions[bot] avatar Apr 09 '24 04:04 github-actions[bot]

I'm facing this issue as well, it came from nowhere. Any updates about it ? Capture d’écran 2024-04-15 à 9 45 02 AM

Mourad-Tlili avatar Apr 15 '24 07:04 Mourad-Tlili

Anyone else having the same issue? May be something to do with Xcode version or something. Seems very bizzare.

raza-jamil-reckon avatar Apr 19 '24 04:04 raza-jamil-reckon

I'm facing this issue as well, it came from nowhere. Any updates about it ? Capture d’écran 2024-04-15 à 9 45 02 AM

Hi, did you find a solution by any chance? I've tried different versions of XCode 15.x as well but no luck.

raza-jamil-reckon avatar Apr 23 '24 23:04 raza-jamil-reckon

Bump

raza-jamil-reckon avatar May 02 '24 23:05 raza-jamil-reckon

In my case, it turned out that my Package.json and Podfile made changes that I wasn't aware of, I had to roll back to a previous commit and found out that some libraries have a changed version, and this library was missing @react-native-community/cli-platform-ios, after that npm install , pod install and everything worked fine.

I hope this helps.

Mourad-Tlili avatar May 03 '24 06:05 Mourad-Tlili

@raza-jamil-reckon please provide a reproducer or we can't look into this

cortinico avatar May 03 '24 06:05 cortinico

I must have missed something in the upgrade process. Nuke the branch and started over and got it to work.

raza-jamil-reckon avatar Jun 19 '24 05:06 raza-jamil-reckon