Closed roncodes closed 3 years ago
Update below are a few things I've tried to no avail
sudo xcode-select --switch /Applications/Xcode.app
sudo xcode-select --reset
sudo xcodebuild -license accept
brew update
brew upgrade
brew info gcc
brew install gcc
brew cleanup
brew install gawk
I've disabled flipper as well, and after that the pod install still fails at glog
Additionally I'm able to build and install glog (v0.5.0) manually
Update! getting closer: I got into node_modules/react-native/scripts/ios-configure-glog.sh
where the error happens and boiled it down to this line ./configure --host arm-apple-darwin
I then navigated to the glog CocoaPod directory /Library/Caches/CocoaPods/Pods/External/glog/
and run the line from there where the same error occured.
I then run the line with sudo, and it was able to configure successfully. The error seems to be an issue with finding the correct c compiler. I think the issue is with my homebrew install on m1, looks like I have homebrew installed twice in two sep directories. Just updating here so if anyone else runs into this exact issue. I am going to try reinstalling homebrew with llvm and gcc to see if this resolves the pod install issue.
git config --global core.autocrlf false try this, it works for me . you can find the bug issues in google/glog at github.
@fighter520 just tried still getting the same error.
Furthermore if anyone is running into this issue. Two installs are needed on M1 for homebrew one for ARM binaries the other for intel, the ARM binary installation location should be /opt/homebrew
- you can find several resources online about installing homebrew in this dir for ARM binaries.
For me I found it easier to symlink the brew binary as armbrew like such ln -sf /opt/homebrew/bin/brew /usr/local/bin/armbrew
, once that was done I created a Brewfile from my main homebrew and installed it with my armbrew.
cd ~/
brew bundle dump
armbrew bundle install --file ~/Brewfile
There's a great answer on apple exchange about setting up homebrew in /opt/homebrew
this answer will get you squared away https://apple.stackexchange.com/a/410829
Now when manually running ./configure --host arm-apple-darwin
it runs successfully.
Although when it runs via pod install
still getting the same error at
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk
checking whether the C compiler works... no
/Users/ron/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing: Unknown `--is-lightweight' option
Try `/Users/ron/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/ron/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6':
configure: error: C compiler cannot create executables
See `config.log' for more details
you can see https://github.com/react-native-community/cli/issues/1194 and https://github.com/facebook/react-native/issues/29101
@fighter520 just tried still getting the same error.
Furthermore if anyone is running into this issue. Two installs are needed on M1 for homebrew one for ARM binaries the other for intel, the ARM binary installation location should be
/opt/homebrew
- you can find several resources online about installing homebrew in this dir for ARM binaries.For me I found it easier to symlink the brew binary as armbrew like such
ln -sf /opt/homebrew/bin/brew /usr/local/bin/armbrew
, once that was done I created a Brewfile from my main homebrew and installed it with my armbrew.cd ~/ brew bundle dump armbrew bundle install --file ~/Brewfile
There's a great answer on apple exchange about setting up homebrew in
/opt/homebrew
this answer will get you squared away https://apple.stackexchange.com/a/410829Now when manually running
./configure --host arm-apple-darwin
it runs successfully.Although when it runs via
pod install
still getting the same error atchecking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for arm-apple-darwin-strip... no checking for strip... strip checking for a thread-safe mkdir -p... ./install-sh -c -d checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for arm-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk checking whether the C compiler works... no /Users/ron/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing: Unknown `--is-lightweight' option Try `/Users/ron/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing --help' for more information configure: WARNING: 'missing' script is too old or missing configure: error: in `/Users/ron/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6': configure: error: C compiler cannot create executables See `config.log' for more details
@fighter520 Thanks the first thread helped me solve my issue but it's a bit hacky.
The comment https://github.com/facebook/react-native/issues/29101#issuecomment-663380161 did the trick for me.
node_modules/react-native/scripts/ios-configure-glog.sh
export CC=/usr/local/Cellar/gcc/11.2.0/bin/gcc-11
export CXX=/usr/local/Cellar/gcc/11.2.0/bin/g++-11
🎉 Thanks to this solution I can now install pods but I will continue looking into why the default CC path is wrong.
Still having the issue as the workaround above works for building and running the app, but when it comes time to archive and upload to iTunes the app is unable to archive due to not being compiled correctly.
The compiler should be /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk
but this is where my pod install fails everytime.
Found the issue and the actual fix.
I had LDFLAGS
and CPPFLAGS
set in my ~/.zshrc
courtesy of my llvm install via homebrew, like so
export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"
I simply unset them restart and now pod install and everything works, like so.
# export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
# export CPPFLAGS="-I/usr/local/opt/llvm/include"
@roncodes fix worked for me. I had also installed llvm/clang via homebrew and set my LDFLAGS and CPPFLAGS flags in ~/.zshrc
.
If you don't want to comment them out in your .zshrc
, you can also just unset them in your current session by calling unset LDFLAGS
, unset CPPFLAGS
, and then re-run the install command.
No solutions above worked for me. I haven't even set LDFLAGS or CPPFLAGS.
It just worked for me with this code
pod install --repo-update
Found the issue and the actual fix.
I had
LDFLAGS
andCPPFLAGS
set in my~/.zshrc
courtesy of my llvm install via homebrew, like soexport LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" export CPPFLAGS="-I/usr/local/opt/llvm/include"
I simply unset them restart and now pod install and everything works, like so.
# export LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" # export CPPFLAGS="-I/usr/local/opt/llvm/include"
Great job... it sovle me problem
Description
Suddenly unable to complete pod install when starting a new react-native project. Pod install also fails on current existing projects. I have tried the suggested solution of running
sudo xcode-select --switch /Applications/Xcode.app
to no avail. I've tried several suggestions but still stuck.Previously everything was installing working fine. I left my computer for about an hour, came back and pod install fails everytime with glog. Tried restart twice.
React Native version:
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
Run
npx react-native init TestApp
Received
Next went into project and ran
npx pod-install
Error occurs when installing Flipper-Glog
Opening the
config.log
displaysExpected Results
Expect new react native project to setup.
Snack, code example, screenshot, or link to a repository:
N/A