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

Import error on case-sensitive filesystems #117

Closed
dawiddr opened this issue Mar 8, 2021 · 7 comments
Closed

Import error on case-sensitive filesystems #117

dawiddr opened this issue Mar 8, 2021 · 7 comments

Comments

@dawiddr
Copy link

dawiddr commented Mar 8, 2021

Hi,
First of all, thank you for all the work on this project!

Unfortunately my app fails to build on a case-sensitive filesystem when I try to use it through SPM (version 1.1.180):

/Users/***/Library/Developer/Xcode/DerivedData/***/Build/Intermediates.noindex//ArchiveIntermediates/***/BuildProductsPath/Internal-iphoneos/OpenSSL.framework/Headers/ssl.h:15:11: 'openssl/e_os2.h' file not found
# include <openssl/e_os2.h>
         ^
***.swift: could not build Objective-C module 'OpenSSL'
import OpenSSL
          ^

Is there any way I can work around this problem?

@felexx90
Copy link

felexx90 commented May 5, 2021

@dawiddr I had the same problem building a react native app with Flipper, what I did as workaround was made a symbolic link to the framework folder with the same name but all lowercase. here is the code I put in the Podfile to create the links.

post_install do |installer|
  flipper_post_install(installer)
  # Other stuff here ...
  system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s; ln -sfh OpenSSL.framework openssl.framework')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_i386_x86_64-simulator; ln -sfh OpenSSL.framework openssl.framework')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_x86_64-maccatalyst; ln -sfh OpenSSL.framework openssl.framework')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/macos-arm64_arm64e_x86_64; ln -sfh OpenSSL.framework openssl.framework')

end

@ravi0the0sun
Copy link

ravi0the0sun commented May 24, 2021

@dawiddr I had the same problem building a react native app with Flipper, what I did as workaround was made a symbolic link to the framework folder with the same name but all lowercase. here is the code I put in the Podfile to create the links.

post_install do |installer|
  flipper_post_install(installer)
  # Other stuff here ...
  system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s; ln -sfh OpenSSL.framework openssl.framework')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_i386_x86_64-simulator; ln -sfh OpenSSL.framework openssl.framework')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_x86_64-maccatalyst; ln -sfh OpenSSL.framework openssl.framework')
  system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/macos-arm64_arm64e_x86_64; ln -sfh OpenSSL.framework openssl.framework')

end

this helped out with the openssl error facebook/react-native#28409 i was getting cuz of APFS case sensitive but now it shows this error facebook/react-native#31181 i am using fnm for node manager and this error started showing up after i upgraded my project from v0.63 to v0.64

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 4.85 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.17.0 - /var/folders/nf/83z965450dd46qzdlrd86t6h0000gn/T/fnm_multishells/6853_1621875235419/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /var/folders/nf/83z965450dd46qzdlrd86t6h0000gn/T/fnm_multishells/6853_1621875235419/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.2, DriverKit 19.0, macOS 10.15, tvOS 14.2, watchOS 7.1
    Android SDK:
      API Levels: 23, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom_64, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.1.1/12A7605b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: ^0.64.1 => 0.64.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

so i cant build my app in xcode but i can build using yarn ios but the the simulator seems to be a bit sluggish

@friederbluemle
Copy link

Here is a version that works both on regular case-sensitive file systems, as well as on file systems that silently mask errors caused by typos and sloppiness (which unfortunately is still the default on macOS).

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # Fix openssl incompatibility on case-sensitive fs
    unless File.exist? "pods"
      ['ios-arm64_arm64e_armv7_armv7s', 'ios-arm64_i386_x86_64-simulator', 'ios-arm64_x86_64-maccatalyst', 'macos-arm64_arm64e_x86_64'].each do |d|
        system("cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/#{d} && ln -Fs {OpenSSL,openssl}.framework")
      end
    end
  end

@icesco
Copy link

icesco commented Jan 26, 2022

Hi all, is there a fix for this issue for projects that don't rely on Cocoapods for thrid party dependencies ? Like Carthage or SPM.
Thank you!

@thisIsTheFoxe
Copy link

This is a hack-y workaround but it seems to work in our case when using Carthage:

cd Carthage/Build/OpenSSL.xcframework/
grep -rl '#\s*include\s*<openssl' --include \*.h * | xargs -I@ sed -i '' -e 's/#[[:space:]]*include[[:space:]]*<openssl/#include <OpenSSL/gi' @

@Guang1234567
Copy link

Guang1234567 commented Jul 8, 2022

As this readme.md be mentioned:

IOS

fatal error: 'openssl/opensslv.h' file not found

This should no longer happen on RN 0.68.1 and up (Template Version 3.0.0+).

This seems to happen on APFS Case Sensitive Filesystems when Flipper is enabled.

Solution 1 - Create Symbolic Links

Thanks to felexx90 for providing this solution.

Edit ios/Podfile and add the following lines inside post_install.

post_install do |installer|
    react_native_post_install(installer)
    # Fix OpenSSL-Universal on APFS Case Sensitive Filesystem
    system('cd Pods/Headers/Public; ln -s Protobuf protobuf')
    system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_arm64e_armv7_armv7s; ln -sfh OpenSSL.framework openssl.framework')
    system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_i386_x86_64-simulator; ln -sfh OpenSSL.framework openssl.framework')
    system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_x86_64-maccatalyst; ln -sfh OpenSSL.framework openssl.framework')
    system('cd Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/macos-arm64_arm64e_x86_64; ln -sfh OpenSSL.framework openssl.framework')
  end

Now, reinstall pods.

cd ios && pod install

Solution 2 - Disable Flipper

If you do not need flipper you can just disable it to fix this error.

Edit ios/Podfile and comment out use_flipper!().

  # use_flipper!()

Now, reinstall pods and update repo.

  • Mac intel:

cd ios && pod install --repo-update

  • Mac M1:

sudo arch -x86_64 gem install ffi && pod install --clean-install && arch -x86_64 pod install

@krzyzanowskim
Copy link
Owner

The case-sensitive filesystem problem is addressed in the upcoming update 3.1.2 #174. Please give it a try.

#167 (comment)

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

No branches or pull requests

8 participants