Reputation: 395
I already built an android project of react native which is working fine. I then started with iOS part. I am using react-native-cli: 2.0.1 react-native: 0.60.4 and Xcode 10 and Mac OS Mojave
The default pod file had some issues installing glog It gave error /bin/bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
when pod install
was executed. Even after doing everything answered on GitHub and stack overflow like installing Cocoapods, reinstalling, ruby installation, linking cocoapods. Then later on GitHub I found out that pod file had some issues so replaced it with correct content specified on GitHub for react-native. Still did not work then according to this link : https://forums.expo.io/t/pod-install-errors-on-newly-detached-app-on-macos-installing-glog-bin-bash-configure-bin-sh-m-bad-interpreter-no-such-file-or-directory/10054 and then I modified the glog file and then it installed the glog successfully.
After that another issue with glog Need to implement mutex.h for your architecture, or #define NO_THREADS
which I corrected by adding define no_thread
in ios/Pods/glog/src/config.h file
And now stuck with this
/Volumes/Projects/derive-mobile/ios/Pods/glog/src/utilities.h:148:1: Unknown type name '_START_GOOGLE_NAMESPACE_'
/Volumes/Projects/derive-mobile/ios/Pods/glog/src/utilities.h:168:1: Unknown type name 'int64'; did you mean 'google::int64'?
/Volumes/Projects/derive-mobile/ios/Pods/glog/src/utilities.h:170:20: Unknown type name 'int64'; did you mean 'google::int64'?
/Volumes/Projects/derive-mobile/ios/Pods/glog/src/utilities.h:175:1: Unknown type name 'int32'; did you mean 'google::int32'?
/Volumes/Projects/derive-mobile/ios/Pods/glog/src/utilities.h:236:1: Unknown type name '_END_GOOGLE_NAMESPACE_'
/Volumes/Projects/derive-mobile/ios/Pods/glog/src/utilities.h:150:1: Expected unqualified-id
I think my glog installation did not go well. I am using project workspace already.
I have checked overall GitHub Facebook react-native and stack overflow but did not found anything. I have tried legacy build, clearing derived data. I have also tried pod deintegrate and pod install. for glog I have also tried cd ./node_modules/react-native/third-party/glog-0.3.4 && ../../scripts/ios-configure-glog.sh
How can I solve this issue ? is there any way to remove the glog completely and install it again without having the /bin/bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
as none of the solutions works as mentioned above
Upvotes: 6
Views: 4716
Reputation: 2689
I write a script for patching the compile error for React-Native(0.72.1x)
on macos
>= 14.x
, cause the React-Native now using glog v0.3.5 with a fault usage of diff
command (in source script configure
) on new macos.
error log example:
In file included from __path_react-native_pods__/glog/src/vlog_is_on.cc:35:
In file included from __path_react-native_pods__/glog/src/utilities.h:73:
__path_react-native_pods__/glog/src/base/mutex.h:147:3: error: Need to implement mutex.h for your architecture, or #define NO_THREADS
# error Need to implement mutex.h for your architecture, or #define NO_THREADS
^
__path_react-native_pods__/glog/src/base/mutex.h:188:3: error: unknown type name 'MutexType'
MutexType mutex_;
^
In file included from __path_react-native_pods__/glog/src/vlog_is_on.cc:35:
__path_react-native_pods__/glog/src/utilities.h:137:1: error: unknown type name '_START_GOOGLE_NAMESPACE_'
_START_GOOGLE_NAMESPACE_
^
__path_react-native_pods__/glog/src/utilities.h:139:1: error: expected unqualified-id
namespace glog_internal_namespace_ {
^
__path_react-native_pods__/glog/src/utilities.h:154:1: error: unknown type name 'int64'; did you mean 'google::int64'?
int64 CycleClock_Now();
^~~~~
google::int64
In file included from __path_react-native_pods__/glog/src/vlog_is_on.cc:35:
In file included from __path_react-native_pods__/glog/src/utilities.h:82:
__path_react-native_pods__/glog/src/glog/logging.h:94:17: note: 'google::int64' declared here
typedef int64_t int64;
^
In file included from __path_react-native_pods__/glog/src/vlog_is_on.cc:35:
__path_react-native_pods__/glog/src/utilities.h:156:1: error: unknown type name 'int64'; did you mean 'google::int64'?
solution:
# After `yarn install`, issue the following patch command ~
/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/SnowGirls/9a00c4cb15c2d8c2e9bdc5a178c3461d/raw/ce12fb435ca38a3ed680dde0bb485c10f4554d61/react-native-v0.72.11-glog-patch.sh)"
Upvotes: 0
Reputation: 21
What fixed it for me was to delete the derived data folder form xcode (xcode->preferences->locations), delete the pod folder from the ios folder and then run the commands
pod cache clean –all, pod repo update (if you use a pod repo) and pod install
Upvotes: 0
Reputation: 1775
I tried dos2unix
but honestly, I don't know which file should I apply it to. Because if you do pod install --verbose
, you see that glog
is being downloaded to a random temporary folder, and built (that's where it fails). So I don't have control.
So, I tried something else. Created a new user in my Mac. Xcode being a shared application. And pod install
just worked. No complains. Now, see, the difference in the console outputs seems to point to trunk
.
This one is from the new user. It works.
There you can see "Adding spec repo trunk"...
Now see my non working command log (from my original user).
There's nothing about trunk
. And it starts checking the cache, and downloading packages (like glog
and Folly
). Don't know why. Installing dependencies from the new user was just a breeze.
Hope this hint may lead to a different solution. It may be something about a user setting/configuration. Like UTF-8 or something.
Upvotes: 0
Reputation: 59
I still haven't determined a long term solution to this problem, but I've gotten a little farther than this thread.
Right now, every time after I call a yarn command, I need to update ios-configure-glog.sh
to replace these lines:
./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
with these lines
dos2unix -f configure
dos2unix -f config.sub
dos2unix -f config.guess
./configure --host arm-apple-darwin
cp {THE FULL PATH TO MY PROJECT}/node_modules/react-native/ReactAndroid/src/main/jni/third-party/glog/config.h src
This fixes all of my glog issues with one fix, but it's not permanent and I don't really want to fork react-native to make it permanent.
Maybe this will point someone else in the right direction to come up with the long term fix. I've narrowed the bad file formatting to those 3 files (configure, config.sub, config.guess) which all seem to reside inside of my Xcode application but appear to use LF line endings so I don't really know how the error is happening.
I might also be removing too much from this file, but I haven't seen any problems related to that.
Upvotes: 0
Reputation: 145
The ./configure
file may have been edited in a DOS or Windows environment. (With a notepad
, for example). That edition may have added a carriage return (^M or \r) at the end of each line... incompatible in a unix environment.
You can check it by:
$ file ./configure
To re-convert it to unix format you can use dos2unix
or edit with vi -b
(vi in binary mode).
edit: In ./configure : /bin/sh^M : bad interpreter you have other re-conversion options.
Upvotes: 0