Cocoapods: help uninitialized constant Pod::Podfile::EXPO_CPP_HEADER_DIR

Created on 14 May 2018  路  4Comments  路  Source: CocoaPods/CocoaPods

Error

[!] An error occurred while processing the post-install hook of the Podfile.

uninitialized constant Pod::Podfile::EXPO_CPP_HEADER_DIR

ios/Podfile:75:in `block (5 levels) in from_ruby'
ios/Podfile:73:in `each'
ios/Podfile:73:in `block (4 levels) in from_ruby'
ios/Podfile:50:in `each'
ios/Podfile:50:in `block (3 levels) in from_ruby'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.4.0/lib/cocoapods-core/podfile.rb:179:in `call'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.4.0/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:638:in `run_podfile_post_install_hook'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:626:in `block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/user_interface.rb:142:in `message'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:625:in `run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:186:in `block in generate_pods_project'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:183:in `generate_pods_project'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:119:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/command/install.rb:41:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.4.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

PodFile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'wupplier-pre' do
  pod 'ExpoKit',
    :git => "http://github.com/expo/expo.git",
    :tag => "ios/2.1.4",
    :subspecs => [
      "Core",
      "CPP"
    ],
    :inhibit_warnings => true

  pod 'React',
    :path => "../node_modules/react-native",
    :inhibit_warnings => true,
    :subspecs => [
      "Core",
      "ART",
      "RCTActionSheet",
      "RCTAnimation",
      "RCTCameraRoll",
      "RCTGeolocation",
      "RCTImage",
      "RCTNetwork",
      "RCTText",
      "RCTVibration",
      "RCTWebSocket",
      "DevSupport",
      "CxxBridge"
    ]
  pod 'yoga',
    :path => "../node_modules/react-native/ReactCommon/yoga",
    :inhibit_warnings => true
  pod 'DoubleConversion',
    :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
    :inhibit_warnings => true
  pod 'Folly',
    :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
    :inhibit_warnings => true
  pod 'GLog',
    :podspec => "../node_modules/react-native/third-party-podspecs/GLog.podspec",
    :inhibit_warnings => true


  post_install do |installer|
    installer.pods_project.main_group.tab_width = '2';
    installer.pods_project.main_group.indent_width = '2';

    installer.pod_targets.each do |target|

    if target.pod_name == 'ExpoKit'
      target.native_target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'

        # needed for GoogleMaps 2.x
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
      end
    end
    if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? target.pod_name
      target.native_target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end
    # Can't specify this in the React podspec because we need
    # to use those podspecs for detached projects which don't reference ExponentCPP.
    if target.pod_name.start_with?('React')
      target.native_target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
        config.build_settings['HEADER_SEARCH_PATHS'] << "${PODS_ROOT}/Headers/Public/#{EXPO_CPP_HEADER_DIR}"
      end
    end
    # Build React Native with RCT_DEV enabled
    next unless target.pod_name == 'React'
    target.native_target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
    end

    end
  end
end

Erro line config.build_settings['HEADER_SEARCH_PATHS'] << "${PODS_ROOT}/Headers/Public/#{EXPO_CPP_HEADER_DIR}"

Does anyone know why the error is?

Most helpful comment

@RoWaiR @thompsonemerson I was able to solve this by adding the following to my Podfile EXPO_CPP_HEADER_DIR = 'ExpoKit'

My guess is that somewhere during the detaching process Expo fails to add it to your Podfile. I this solution by referencing the Expo Github repo here

I hope this helps.

All 4 comments

@RoWaiR This looks like a user error, EXPO_CPP_HEADER_DIR is not set anywhere in your Podfile.

Those questions are better to be asked in StackOverflow under cocoapods tag.

Will close for now but will re-open if we figure this is an actual CocoaPods library bug.

@RoWaiR have you found any solutions to this problem?

@RoWaiR @thompsonemerson I was able to solve this by adding the following to my Podfile EXPO_CPP_HEADER_DIR = 'ExpoKit'

My guess is that somewhere during the detaching process Expo fails to add it to your Podfile. I this solution by referencing the Expo Github repo here

I hope this helps.

@oneuptim Worked for me. Thank you!

Was this page helpful?
0 / 5 - 0 ratings