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

Mac Catalyst build doesn't work on fresh project

Open rogerkerse opened this issue 4 years ago • 5 comments

Description

just by init-ing new project, Mac Catalyst build fails. (It used to work in react-native 0.64)

Version

0.66.2

Output of react-native info

info Fetching system and libraries information... System: OS: macOS 12.0.1 CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz Memory: 642.71 MB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.0.0 - ~/.nvm/versions/node/v16.0.0/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.0.0/bin/yarn npm: 7.20.5 - ~/.nvm/versions/node/v16.0.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: Not Found IDEs: Android Studio: Arctic Fox 2020.3.1 Patch 3 Arctic Fox 2020.3.1 Patch 3 Xcode: 13.1/13A1030d - /usr/bin/xcodebuild Languages: Java: 11.0.10 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.2 => 0.66.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  1. npx react-native init AwesomeProject
  2. cd AwesomeProject && yarn start
  3. In XCode add Mac support checkmark.
  4. Build to "My Mac" -- First error:
Showing Recent Messages
Signing for "React-Core-AccessibilityResources" requires a development team. Select a development team in the Signing & Capabilities editor.
  1. Adding this gets me further, but new problems arrive.
post_install do |installer|
    installer.pods_project.targets.each do |target|
        # Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally'
        if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
            target.build_configurations.each do |config|
                config.build_settings['CODE_SIGN_IDENTITY[sdk=macosx*]'] = '-'
            end
        end
    end
end

--- New Errors: ~/Projects/TMP/AwesomeProject/ios/Pods/Headers/Private/RCT-Folly/folly/portability/Time.h:52:17: Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t') and Command CompileSwiftSources failed with a nonzero exit code for YogaKit

Snack, code example, screenshot, or link to a repository

npx react-native init AwesomeProject

rogerkerse avatar Nov 08 '21 12:11 rogerkerse

I had the same issue. It looks like it relates to the redeclaration of a variable in macOS runtime and none of the workarounds I tried had any effect. React Native 64.2 works fine. Major Roadblock for us.

ZComwiz avatar Nov 14 '21 16:11 ZComwiz

@Huxpro — do you have any idea how to get a fresh project up and running on MacCatalyst with Hermes? I saw from Hermes release notes that it supports MacCatalyst but does RN itself? The last version I got working was on 0.64.0 with the following post install in podfile:

	# Enables Flipper.
	#
	# Note that if you have use_frameworks! enabled, Flipper will not work and
	# you should disable the next line.
	# TODO: Temporary fix until https://stackoverflow.com/questions/66189325/xcode-throws-atomic-notify-oneunsigned-long-is-unavailable gets resolved
	# use_flipper!()
	use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })

	post_install do |installer|
		react_native_post_install(installer)

		# For Mac Catalyst we need to modify Development team to have a successful build
		installer.pods_project.targets.each do |target|
			# Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally'
			if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
				target.build_configurations.each do |config|
					config.build_settings['CODE_SIGN_IDENTITY[sdk=macosx*]'] = '-'
				end
			end
		end
		# For Mac Catalyst release build. XCode v13, ReactNative v0.64
		installer.aggregate_targets.each do |aggregate_target|
			aggregate_target.user_project.native_targets.each do |target|
				target.build_configurations.each do |config|
				config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
				end
			end
			aggregate_target.user_project.save
		end
	end

ZComwiz avatar Nov 16 '21 12:11 ZComwiz

Per my comment on RN67 release candidate, we were able to move past the time.h file bug by adding the following to the if check on line 31: || TARGET_OS_MAC_CATALYST

that lead to the next error. That DoubleConversion switched from precompiled code with a '.a' file to the new xcFramework format. However, no slices were made for MacCatalyst. Someone familiar with the DoubleConversion xcFramework should post a fix by following the guide here

ZComwiz avatar Nov 28 '21 16:11 ZComwiz

I don't even am building for Mac. Is an iOS app and still get same problem.

Signing for "React-Core-AccessibilityResources" requires a development team.
Select a development team in the Signing & Capabilities editor.

Stuck, and didnt managed to fix this. now im reverting my project from ~0.67 to ~0.62 😔 before the addition of AccessibilityResources. Seem a pretty broken change. needs fixing asap.

itsmelion avatar Feb 19 '22 00:02 itsmelion

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

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

This issue was closed because it has been stalled for 7 days with no activity.

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