Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can use Hermes on a new project #931

Closed
ospfranco opened this issue Dec 18, 2021 · 10 comments
Closed

Can use Hermes on a new project #931

ospfranco opened this issue Dec 18, 2021 · 10 comments
Labels
bug Something isn't working

Comments

@ospfranco
Copy link

Environment

react-native -v: 5.0.1
npm ls react-native-macos: 0.64.18
node -v: 16.12.0
npm -v: 8.1.0
yarn --version: 1.22.17
xcodebuild -version: 13.1

Steps to reproduce the bug

I created a new RN macOS project the other day, I wanted to start right away with Hermes, I followed the installation instructions and I got to the following issue:

https://stackoverflow.com/questions/68497865/rct-folly-error-when-using-hermes-with-ios

Debugging it is very confusing since all the info online points to flipper on iOS, but on macOS there is no flipper... anyways, I tried updating a bunch of things and had to resort to a similar solution to the one on the stack overflow answer on my Podfile:

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

# fixes for last Mac updates
def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

target 'messer-macOS' do
  platform :macos, '10.14'
  use_native_modules!
  use_react_native!(
    :path => '../node_modules/react-native-macos',
    :hermes_enabled => true
  )
  
  
  post_install do |installer|
    find_and_replace("Pods/Headers/Private/RCT-Folly/folly/synchronization/DistributedMutex-inl.h",
    "atomic_notify_one(state)", "folly::atomic_notify_one(state)")
  end
end

is there any plan to fix this (AFAIK RCT-Folly already fixed this in some of the later versions?)

Expected Behavior

No response

Actual Behavior

No response

Reproducible Demo

No response

Additional context

No response

@HeyImChris
Copy link

Duplicate of #952

@HeyImChris HeyImChris marked this as a duplicate of #952 Jan 13, 2022
@Saadnajmi
Copy link
Collaborator

@kelset the post install phase replacing ayomic_notify_one might be of interest to you here

@ospfranco
Copy link
Author

Just FYI I just trying updating a project to rn-macos 0.66.2 and this is still happening (although I think in a different file), so this issue is not solved, I still cannot use hermes on a new project

Screen Shot 2022-02-13 at 07 50 47

@ospfranco
Copy link
Author

Ah, it seems it is not related to hermes, I just tried updating to rn-macos 0.66 and it's not working. I'll create a new issue later

@Saadnajmi
Copy link
Collaborator

@ospfranco
Copy link
Author

@Saadnajmi thanks a lot, that error is gone, but now I'm getting arm64 compilation errors, some people seem to have solved this by compiling the app in Rosetta mode?

facebook#29605

Screen Shot 2022-02-13 at 20 50 15

@Saadnajmi
Copy link
Collaborator

@ospfranco I run into that intermittently and haven't found a cause. I suspect it might be an xcode incremental build problem. One thing to try is to do a full clean (cmd+shift+k) in xcode before building.

@ospfranco
Copy link
Author

Already tried that, also deleting the derived data folder, still no luck :(

@ospfranco
Copy link
Author

I initialized a brand new project and there it seems to be working

@ospfranco
Copy link
Author

I managed to get it working after resetting a bunch of swift flags in the Build Settings with a brand new rn-macos project, some of my changes:

  • Reset Swift Compiler custom flags
  • Reset Dead code stripping to NO
  • Reset Framework search paths
  • Reset Library search paths
  • Reset embed swift libraries to NO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants