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't compile initial project for iOS #30922

Closed
Yadro opened this issue Feb 9, 2021 · 26 comments
Closed

Can't compile initial project for iOS #30922

Yadro opened this issue Feb 9, 2021 · 26 comments
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@Yadro
Copy link

Yadro commented Feb 9, 2021

Description

When I create a new project via npx react-native init bestproject and trying to compile it on macOS I receive the following errors:

/Users/user/projects/bestproject/ios/Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s/openssl.framework/Headers/bn.h:186:39:
 Unknown type name 'BN_ULONG'
Flipper-Folly
/Users/user/projects/bestproject/ios/Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s/openssl.framework/Headers/bio.h:687:1:
 Expected function body after function declarator

React Native version:

System:
    OS: macOS 10.15.7
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 433.12 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.10.1 - /usr/local/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.10 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6626763
    Xcode: 12.3/12C33 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

  1. npx react-native init bestproject
  2. cd bestproject
  3. pod install
  4. Run project in xcode
  5. Receive the errors
@ParvinderjitSF

This comment has been minimized.

@singleton-altman

This comment has been minimized.

@lauritaipale
Copy link

Building existing iOS projects also start failing with the same error(s) if OpenSSL-Universal gets updated to 1.1.180 via pod update. Rolling back to OpenSSL-Universal 1.0.2.20 (Flipper-Folly 2.3.0 and Flipper-RSocket 1.1.0) seems to get the iOS build working again.

@EricWiener
Copy link

EricWiener commented Feb 10, 2021

Building existing iOS projects also start failing with the same error(s) if OpenSSL-Universal gets updated to 1.1.180 via pod update. Rolling back to OpenSSL-Universal 1.0.2.20 (Flipper-Folly 2.3.0 and Flipper-RSocket 1.1.0) seems to get the iOS build working again.

In case anyone else is wondering how to do this, you need to add pod 'OpenSSL-Universal', '~>1.0.2.20' to your Podfile

@Yadro
Copy link
Author

Yadro commented Feb 10, 2021

In case anyone else is wondering how to do this, you need to add pod 'OpenSSL-Universal', '~>1.0.2.20' to your Podfile

One more note: you should also remove Podfile.lock before pod install
Just execute pod update

@bramski
Copy link

bramski commented Feb 10, 2021

Ah my favorite. Random build breaks while updating core libraries. I applied @EricWiener 's code to Podfile and then issued a pod update and was successful. DIdn't need to blow away Podfile.lock as @Yadro was suggesting.
Mostly commenting to get my name on here and get an update when this issue is fixed so I can unpin OpenSSL-Universal.

@apperside
Copy link

apperside commented Feb 11, 2021

@lauritaipale's solution worked for me, adding this to my pod file fixed the problem:

pod 'OpenSSL-Universal', '~>1.0.2.20'

NOTE: after adding this, just running pod install will fire an error due to versions mismatch, in that case remove Podfile.lock and pod install again

@nikage
Copy link

nikage commented Feb 12, 2021

pod 'OpenSSL-Universal', '~>1.0.2.20'

NOTE: after adding this, just running pod install will fire an error due to versions mismatch, in that case remove Podfile.lock and pod install again

@aparedes this worked form me. I'm new to both react native and ios development. It's quite confusing to face such problems while running a helloWorldApp.

@blastering66

This comment has been minimized.

@janicduplessis
Copy link
Contributor

Updating cocoapods to 1.10.1 fixed the issue.

There seems to be an issue with xcframeworks on version 1.9.x (krzyzanowskim/OpenSSL#113 (comment))

@Chasty
Copy link

Chasty commented Feb 16, 2021

Someone should fix this issue with npx, I get the same issue evertyme I create a simple app, please admin solve it.

@efec89
Copy link

efec89 commented Feb 24, 2021

Building existing iOS projects also start failing with the same error(s) if OpenSSL-Universal gets updated to 1.1.180 via pod update. Rolling back to OpenSSL-Universal 1.0.2.20 (Flipper-Folly 2.3.0 and Flipper-RSocket 1.1.0) seems to get the iOS build working again.

In case anyone else is wondering how to do this, you need to add pod 'OpenSSL-Universal', '~>1.0.2.20' to your Podfile

It worked for me. Thank you.

tgroshon added a commit to tgroshon/example-react-native-BLE that referenced this issue Feb 25, 2021
Add OpenSSL specific version to podfile and run `pod install`.

Notes: facebook/react-native#30922 (comment)
@ivankdev
Copy link

ivankdev commented Mar 4, 2021

In case anyone else is wondering how to do this, you need to add pod 'OpenSSL-Universal', '~>1.0.2.20' to your Podfile

You've saved my day

@mweststrate
Copy link
Contributor

/Users/user/projects/bestproject/ios/Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s/openssl.framework/Headers/bn.h:186:39:
Unknown type name 'BN_ULONG'

Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod

The OP is a known issue, caused by an outdated cocoapods. Make sure to update it to 1.10.

@melvinmt
Copy link

Updating cocoapods to 1.10.1 fixed the issue.

The OP is a known issue, caused by an outdated cocoapods. Make sure to update it to 1.10.

I run into other issues when I update cocoapods to 1.10.1, the build simply does not show up in the Organizer after archiving (may also be related to a Mapbox SDK issue, not sure) so I have to downgrade cocoapods to 1.9.3 by doing this:

$ sudo gem uninstall cocoapods
$ sudo gem install cocoapods -v 1.9.3

@petrosmm
Copy link

petrosmm commented Mar 14, 2021

@lauritaipale's solution worked for me, adding this to my pod file fixed the problem:

pod 'OpenSSL-Universal', '~>1.0.2.20'

NOTE: after adding this, just running pod install will fire an error due to versions mismatch, in that case remove Podfile.lock and pod install again

    OS: macOS 10.15.7
    Node: 14.16.0 - /usr/local/opt/node@14/bin/node
    npm: 6.14.11 - /usr/local/opt/node@14/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
    CocoaPods: 1.9.0 - /usr/local/bin/pod
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
    react-native: 0.62.2

Can confirm with specs on RN 0.62.2 new or existing project this works. Also ran into this. Mad props!!!!

@jonnyberanek
Copy link

@lauritaipale's solution worked for me, adding this to my pod file fixed the problem:

pod 'OpenSSL-Universal', '~>1.0.2.20'

NOTE: after adding this, just running pod install will fire an error due to versions mismatch, in that case remove Podfile.lock and pod install again

Adding that to the Podfile causes pod update to fail with an incompatibility error:

Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
[!] CocoaPods could not find compatible versions for pod "OpenSSL-Universal":
  In Podfile:
    FlipperKit/FBCxxFollyDynamicConvert (~> 0.75.1) was resolved to 0.75.1, which depends on
      Flipper-Folly (~> 2.5) was resolved to 2.5.1, which depends on
        OpenSSL-Universal (= 1.1.180)

    OpenSSL-Universal (~> 1.0.2.20)

System info:

System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Xeon(R) CPU           X5570  @ 2.93GHz
    Memory: 3.16 GB / 28.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.21.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.14.11 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.0 => 0.64.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

@apperside
Copy link

Try the following

cd ios
rm -rf Podfile.lock
pod install

@Kaihuang724
Copy link

I'm running into the same issue as @jonnyberanek . Has anyone figured out a fix?

@gulsher7
Copy link

gulsher7 commented May 18, 2021

by mistake i open .xcodeproj file instead of .xcworkspace.

@ardian-c
Copy link

I had this issue recently and the problem was with the outdated cocoapods (1.9) version. Updating to a newer version solved the issue.

sudo gem install cocoapods

@madhavisolanki
Copy link

madhavisolanki commented Jul 8, 2021

This saved me
pod 'OpenSSL-Universal', '~>1.1.1100'

   use_flipper!({'Flipper-Folly' => '~> 2.6.9','Flipper' => '0.95.0'})
    post_install do |installer|
      flipper_post_install(installer)
    end

I am also using googleplaces and google maps so I had to add this
installer.pods_project.targets.each do |target| if target.name == 'react-native-google-places' target.build_configurations.each do |config| config.build_settings['CLANG_ENABLE_MODULES'] = 'No' end end if target.name == "React" target.remove_from_project end end

and
pod 'react-native-google-places', :path => '../node_modules/react-native-google-places'

Adding to help someone with similar issue. After switching to Big Sur and Xcode 12.5

Later I had this issue while generating a device build ___cxa_increment_exception_refcount"
so I had to make these changes
pod 'OpenSSL-Universal', '~>1.1.180'
use_flipper!({'Flipper' => '0.92.0', 'Flipper-Folly' => '2.6.7'})

@elmcapp
Copy link

elmcapp commented Aug 16, 2021

For me the fix is just to change the Deployment Info target to iOS 11 or greater

@adityasingh773
Copy link

For me, the issue was related to older Cocoapods version, updating my cocoapods fixed it
sudo gem install cocoapods

@349989153
Copy link

Updating cocoapods to 1.10.1 fixed the issue.

There seems to be an issue with xcframeworks on version 1.9.x (krzyzanowskim/OpenSSL#113 (comment))

This is the EXACT ANSWER

@mweststrate
Copy link
Contributor

Updating cocoapods to 1.10.1 fixed the issue.
There seems to be an issue with xcframeworks on version 1.9.x (krzyzanowskim/OpenSSL#113 (comment))

This is the EXACT ANSWER

Will add that as requirement to the podspec itself

facebook-github-bot pushed a commit to facebook/flipper that referenced this issue Dec 17, 2021
Summary: Specify minimum required cocoapods version for Flipper, fixes facebook/react-native#30922, according to https://guides.cocoapods.org/syntax/podspec.html#cocoapods_version

Reviewed By: lawrencelomax

Differential Revision: D33138126

fbshipit-source-id: f63579cd1e180017b9b4ff04f61031264718d1ee
@facebook facebook locked as resolved and limited conversation to collaborators Mar 31, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.