🔥 pod install errors on newly detached app on MacOS installing GLog - : /bin/bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

Originally I was upgrading from 25.0.0.0 to 27.0.0.0, when the iOS pod install/upgrade failed. :crazy_face: It seems to be a problem installing the glog (0.3.4) dependency of react-native.

/bin/bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

I created a blank app and I still get the error. It seems that the error is to do with ^M being in a script file, but this mac has nothing to do with windows computer, and I’m downloading all dependencies from scratch.

Here’s the full output of pod install with the error:

pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Pre-downloading: `ExpoKit` from `http://github.com/expo/expo.git`, tag `ios/2.5.10`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Installing Amplitude-iOS (3.14.1)
Installing Analytics (3.6.9)
Installing AppAuth (0.92.0)
Installing Bolts (1.9.0)
Installing Branch (0.14.12)
Installing CocoaLumberjack (3.2.1)
Installing Crashlytics (3.10.1)
Installing DoubleConversion (1.1.5)
Installing ExpoKit (2.5.10)
Installing FBAudienceNetwork (4.28.1)
Installing FBSDKCoreKit (4.33.0)
Installing FBSDKLoginKit (4.33.0)
Installing FBSDKShareKit (4.33.0)
Installing Fabric (1.7.6)
Installing Folly (2016.09.26.00)
Installing GPUImage (0.1.7)
Installing Google-Maps-iOS-Utils (2.1.0)
Installing Google-Mobile-Ads-SDK (7.22.0)
Installing GoogleAppUtilities (1.1.2)
Installing GoogleAuthUtilities (2.0.2)
Installing GoogleMaps (2.5.0)
Installing GoogleNetworkingUtilities (1.2.2)
Installing GoogleSignIn (3.0.0)
Installing GoogleSymbolUtilities (1.1.2)
Installing GoogleUtilities (1.3.2)
Installing JKBigInteger2 (0.0.5)
Installing React (0.55.2)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.4)
[!] /bin/bash -c 
set -e
#!/bin/bash
set -e

PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH:-armv7}"

export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"

# Remove automake symlink if it exists
if [ -h "test-driver" ]; then
    rm test-driver
fi

./configure --host arm-apple-darwin

# Fix build for tvOS
cat << EOF >> src/config.h

/* Add in so we have Apple Target Conditionals */
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <Availability.h>
#endif

/* Special configuration for AppleTVOS */
#if TARGET_OS_TV
#undef HAVE_SYSCALL_H
#undef HAVE_SYS_SYSCALL_H
#undef OS_MACOSX
#endif

/* Special configuration for ucontext */
#undef HAVE_UCONTEXT_H
#undef PC_FROM_UCONTEXT
#if defined(__x86_64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#elif defined(__i386__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip
#endif
EOF

/bin/bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

Here’s my package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "dependencies": {
    "exp": "^54.0.0",
    "expo": "^27.0.1",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz"
  }
}

Here’s the podfile

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

EXPO_CPP_HEADER_DIR = 'ExpoKit'

target 'test-project' do
 pod 'ExpoKit',
   :git => "http://github.com/expo/expo.git",
   :tag => "ios/2.5.10",
   :subspecs => [
     "Core",
     "CPP",
     "GL"
   ],
   :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

Things I have tried:

  • Creating a blank App - Same Error
  • Reverting to 26.0.0 - Same Error
  • Doing a dos2unix on the react-native/scripts/*.sh folder - Same Error
  • Removing and recreating node_modules with npm
  • Removing and recreating node_modules with yarn

I’m dead in the water here. :swimming_man: Any suggestions or help would be deeply appreciated! :weary:

Full zip of the test project for your enjoyment here : Dropbox - test-project.zip - Simplify your life

Is it possible for you to post your whole project? Either as a link to a Github repo or as a .zip file?
It will be much easier to try to figure out what’s going on if you do that.

Hi,

I’ve uploaded a zip file with a test project that has the issue.

The project was created using expo-xde, then a detach.

Hope this is helpful.

After detach you should run sudo gem install cocoapods and after that run pod install its working fine…try this…

Thanks for the suggestion - but I have already installed the latest version of cocoapods. (as an app)
I wish it were this simple.
I’ve previously built and run detached applications before.

It seems that the error message is due to the line “./configure --host arm-apple-darwin” in the script ios-configure-glog.sh.
It seems that the source of glog is stored in DOS format (CRLF).

I added a “dos2unix” prior to the configure command to convert of all source in those folders to unix format.

The pod install completes, but now I get compile errors in the glog stuff…the journey continues…

Out of desperation I also reinstalled using sudo gem install cocoapods. Same result.

Research shows that it looks like I have the latest version of this ongoing issue:

Because the “third-party” folder no longer exists in RN0.55+, the workarounds dont work…

(The reason I keep relaying my progress on this board is so that googlers of the future may be helped)

So after doing a dos2unix on the files, podinstall works but in xcode I get errors in demangle.cc:


Showing Recent Messages
CompileC /Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/glog.build/Objects-normal/arm64/demangle.o glog/src/demangle.cc normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd xxxxxxxxx/ios/Pods
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu++14 -stdlib=libc++ -fmodules -fmodules-cache-path=/Users/julian/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/julian/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DCOCOAPODS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -miphoneos-version-min=8.0 -g -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wunguarded-availability -fembed-bitcode-marker -index-store-path /Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Index/DataStore -I/Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Products/Debug-iphoneos/glog/include -Ixxxxxxxxx/ios/Pods/Headers/Private -Ixxxxxxxxx/ios/Pods/Headers/Private/glog -Ixxxxxxxxx/ios/Pods/Headers/Public -Ixxxxxxxxx/ios/Pods/Headers/Public/glog -Ixxxxxxxxx/ios/Pods/glog/src -I/Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/glog.build/DerivedSources/arm64 -I/Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/glog.build/DerivedSources -F/Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Products/Debug-iphoneos/glog -w -Xanalyzer -analyzer-disable-all-checks -include xxxxxxxxx/ios/Pods/Target\ Support\ Files/glog/glog-prefix.pch -MMD -MT dependencies -MF /Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/glog.build/Objects-normal/arm64/demangle.d --serialize-diagnostics /Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/glog.build/Objects-normal/arm64/demangle.dia -c xxxxxxxxx/ios/Pods/glog/src/demangle.cc -o /Users/julian/Library/Developer/Xcode/DerivedData/clean-eating-axbjwyxpjotynydaklqkrzjerjwy/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/glog.build/Objects-normal/arm64/demangle.o

In file included from xxxxxxxxx/ios/Pods/glog/src/demangle.cc:38:
xxxxxxxxx/ios/Pods/glog/src/demangle.h:75:1: error: unknown type name '_START_GOOGLE_NAMESPACE_'
_START_GOOGLE_NAMESPACE_
^
xxxxxxxxx/ios/Pods/glog/src/demangle.h:80:1: error: expected unqualified-id
bool Demangle(const char *mangled, char *out, int out_size);
^
xxxxxxxxx/ios/Pods/glog/src/demangle.h:82:1: error: unknown type name '_END_GOOGLE_NAMESPACE_'
_END_GOOGLE_NAMESPACE_
^
xxxxxxxxx/ios/Pods/glog/src/demangle.cc:40:25: error: expected ';' after top level declarator
_START_GOOGLE_NAMESPACE_
                        ^
                        ;
xxxxxxxxx/ios/Pods/glog/src/demangle.cc:1304:1: error: unknown type name '_END_GOOGLE_NAMESPACE_'
_END_GOOGLE_NAMESPACE_
^
xxxxxxxxx/ios/Pods/glog/src/demangle.cc:1304:23: error: expected unqualified-id
_END_GOOGLE_NAMESPACE_
                      ^
6 errors generated.


I think this happens because config.h is being improperly built for some reason.

OK, I’ve got this working. I’m recording the workaround I used for prosperity:

  1. brew install dos2unix
  2. rm -rf node_modules
  3. modify the file ios-configure-glog.sh add this line prior to “configure”:
    dos2unix -f *
  4. expo detach
  5. cd ios
  6. pod install
  7. cd …
  8. cp node_modules/react-native/ReactAndroid/src/main/jni/third-party/glog/config.h ios/Pods/glog/src
  9. Open workspace in XCode as usual and run

Hope this helps someone

2 Likes

glad you figured it out! thanks for sharing

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.