XCode 14 React Native project fails to run iOS: Command PhaseScriptExecution failed - ios

Trying to run the react-native project but encountered the following error
N/A: version "default -> N/A" is not yet installed.
You need to run "nvm install default" to install it before using it.
Command PhaseScriptExecution failed with a nonzero exit code
Output of npx react-native info
System:
OS: macOS 12.5.1
CPU: (10) arm64 Apple M1 Max
Memory: 359.91 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.0 - /usr/local/bin/node
Yarn: 1.22.18 - ~node_modules/.bin/yarn
npm: 8.19.1 - /opt/homebrew/bin/npm
Watchman: 2022.09.05.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 14.0/14A309 - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.4 => 0.67.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
I did remove nvm from ./zshrc but still got the error

was able to resolve it by commenting out
# Define NVM_DIR and source the nvm.sh setup script
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
# Source nvm with '--no-use' and then `nvm use` to respect .nvmrc
# See: https://github.com/nvm-sh/nvm/issues/2053
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
# shellcheck source=/dev/null
. "$HOME/.nvm/nvm.sh" --no-use
nvm use 2> /dev/null || nvm use default
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
# shellcheck source=/dev/null
. "$(brew --prefix nvm)/nvm.sh" --no-use
nvm use 2> /dev/null || nvm use default
fi
in node_modules/react-native/scripts/find-node.sh

Related

react native iOS pod install stuck on Installing glog (0.3.5)

I'm on m1 chip and when I ran pod install in my project's ios/ folder, the operation gets stuck at -> Installing glog (0.3.5), I waited for like 1 hr and 40 mins, but still it Was stuck at the same step. My internet is working fine. After a while growing through similar question answers on SO/Github, I added --verbose argument to get the logs of what is happening behind the scenes, and below is the output (not going forward after patching file config.sub step):
-> Installing glog (0.3.5)
> Git download
> Git download
$ /usr/bin/git clone https://github.com/google/glog.git
/var/folders/0y/rq93q_q13xl4p8kf4qmnld480000gn/T/d20221220-78496-8l9458 --template=
--single-branch --depth 1 --branch v0.3.5
Cloning into '/var/folders/0y/rq93q_q13xl4p8kf4qmnld480000gn/T/d20221220-78496-8l9458'...
Note: switching to 'a6a166db069520dbbd653c97c2e5b12e08a8bb26'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
> Running prepare command
$ /bin/bash -c set -e #!/bin/bash # Copyright (c) Meta Platforms, Inc. and affiliates.
# # This source code is licensed under the MIT license found in the # LICENSE file in
the root directory of this source tree. set -e
PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}" CURRENT_ARCH="${CURRENT_ARCH}" if [ -z
"$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then # Xcode 10 beta
sets CURRENT_ARCH to "undefined_arch", this leads to incorrect linker arg. # it's
better to rely on platform name as fallback because architecture differs between
simulator and device if [[ "$PLATFORM_NAME" == *"simulator"* ]]; then
CURRENT_ARCH="x86_64" else CURRENT_ARCH="arm64" fi fi if [
"$CURRENT_ARCH" == "arm64" ]; then cat <<\EOF >>fix_glog_0.3.5_apple_silicon.patch
diff --git a/config.sub b/config.sub index 1761d8b..43fa2e8 100755 --- a/config.sub +++
b/config.sub ## -1096,6 +1096,9 ## case $basic_machine in basic_machine=z8k-unknown
os=-sim ;; + arm64-*) + basic_machine=$(echo $basic_machine | sed
's/arm64/aarch64/') + ;; none) basic_machine=none-none os=-none EOF patch
-p1 config.sub fix_glog_0.3.5_apple_silicon.patch fi 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 # Manually disable gflags include to fix
issue https://github.com/facebook/react-native/issues/28446 sed -i ''
's/\#ac_cv_have_libgflags\#/0/' src/glog/logging.h.in sed -i ''
's/HAVE_LIB_GFLAGS/HAVE_LIB_GFLAGS_DISABLED/' src/config.h.in ./configure --host
arm-apple-darwin 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 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 # Prepare exported header include
EXPORTED_INCLUDE_DIR="exported/glog" mkdir -p exported/glog cp -f
src/glog/log_severity.h "$EXPORTED_INCLUDE_DIR/" cp -f src/glog/logging.h
"$EXPORTED_INCLUDE_DIR/" cp -f src/glog/raw_logging.h "$EXPORTED_INCLUDE_DIR/" cp -f
src/glog/stl_logging.h "$EXPORTED_INCLUDE_DIR/" cp -f src/glog/vlog_is_on.h
"$EXPORTED_INCLUDE_DIR/"
patching file config.sub
Podfile:
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false
target 'myapp' do
use_expo_modules!
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
config = use_native_modules!
# config = use_frameworks!
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
# Flags change depending on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => true,
:fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.disabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'myappTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
Output of npx react-native info:
info Fetching system and libraries information...
System:
OS: macOS 12.5
CPU: (8) arm64 Apple M1
Memory: 1.20 GB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.2/bin/yarn
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
Watchman: 2022.12.12.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 29, 30, 31, 33
Build Tools: 30.0.3, 31.0.0, 33.0.0
System Images: android-31 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.17 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Can someone shed some light on this matter?
If anyone require any more information about the project/env, please ask, I'll try to provide it!
Thank you in advance!

New RN project in M1 mbp built failed. "Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable."

System:
OS: macOS 11.3
CPU: (8) arm64 Apple M1
Memory: 124.86 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.0.0 - /opt/homebrew/bin/node
Yarn: Not Found
npm: 7.10.0 - /opt/homebrew/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.10.1 - /Users/chia/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
New RN project create successful, but built failed by Xcode.
Error:
Error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable.
Command PhaseScriptExecution failed with a nonzero exit code
node installed by homebrew, and Intel mbp doesn't have this error.
How to resolve this error?
Node in the PATH
npm -g bin
/opt/homebrew/bin
echo $PATH
/Users/chia/.pyenv/shims:/Users/chia/.rbenv/shims:/Users/chia/.rbenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
sudo ln -s $(which node) /usr/local/bin/node
It resolved.
#pekanchuan 's answer at https://stackoverflow.com/a/67342683/6512858 worked for me.
sudo ln -s $(which node) /usr/local/bin/node
I would like to add though that if this command says /usr/local/bin/node: File exists you need to know that the link already exists to maybe a different version of node.
In my case, to install yarn, brew installed a separate nodejs v15 and linked the file to its binary.
Although I use nvm to have nodejs v14 and nodejs v16. This extra nodejs was the reason for the error mentioned in question.
Simply run sudo rm -f /usr/local/bin/node to remove the link followed by the command sudo ln -s $(which node) /usr/local/bin/node to create correct link.
On my Mac M1 the folder /usr/local/bin was missing so I had the error :
ln: /usr/local/bin/node: No such file or directory
So here is what I did :
cd /usr/local
sudo mkdir bin
sudo ln -s $(which node) /usr/local/bin/node

Installing Ruby 2.3.1 on Mojave OSX with rbenv or rvm

First off I am on OSX Mojave 10.14, I have previously upgraded it from 10.13. I bought it new with 10.13.
I am trying to follow this tutorial:
https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-one
I want to make sure that I have the same environment setup using the same version of rails and ruby.
When I try to use rbenv to change my version of ruby (currently 2.6.1) to 2.3.1 I use the following command:
rbenv install 2.3.1
And I get the following error:
file.c:23:10: fatal error: 'CoreFoundation/CFString.h' file not found
I have tried looking on the internet where CFString.h might be, and I have found this useful command to list the directories where clang searches:
echo "#include <CoreFoundation/CFString.h>" | clang -v -x c -
This is the output:
$ echo "#include <CoreFoundation/CFString.h>" | clang -v -x c -
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
"/usr/local/Cellar/llvm/8.0.0/bin/clang-8" -cc1 -triple x86_64-apple-macosx10.14.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -ggnu-pubnames -target-linker-version 409.12 -v -resource-dir /usr/local/Cellar/llvm/8.0.0/lib/clang/8.0.0 -fdebug-compilation-dir /Users/nfgallimore/Code/todos-api -ferror-limit 19 -fmessage-length 121 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.14.0 -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/p6/pttqjn_s20g97kv6jxzwdl2m0000gn/T/--65bd40.o -x c -
clang -cc1 version 8.0.0 based upon LLVM 8.0.0 default target x86_64-apple-darwin18.0.0
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/Cellar/llvm/8.0.0/lib/clang/8.0.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
<stdin>:1:10: fatal error: 'CoreFoundation/CFString.h' file not found
#include <CoreFoundation/CFString.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Also I am not sure if it is using clang or gcc. Here's the gcc output:
$ echo "#include <CoreFoundation/CFString.h>" | gcc -v -x c -
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.14.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 409.12 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0 -fdebug-compilation-dir /Users/nfgallimore/Code/todos-api -ferror-limit 19 -fmessage-length 121 -stack-protector 1 -fblocks -fencode-extended-block-signature -fobjc-runtime=macosx-10.14.0 -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/p6/pttqjn_s20g97kv6jxzwdl2m0000gn/T/--9ee343.o -x c -
clang -cc1 version 10.0.0 (clang-1000.11.45.5) default target x86_64-apple-darwin18.0.0
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
<stdin>:1:10: fatal error: 'CoreFoundation/CFString.h' file not found
#include <CoreFoundation/CFString.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
I have tried reinstalling xcode command line tools with this command:
xcode-select --install
I have also tried to use rvm to install the older version (2.3.1) of ruby.
I follow the steps for installing rvm on osx using this tutorial:
https://usabilityetc.com/articles/ruby-on-mac-os-x-with-rvm/
I installed the pgp key and do the curl command to install it:
\curl -sSL https://get.rvm.io | bash -s stable --ruby
but I get the following error:
emacs: standard input is not a tty
curl: (23) Failed writing body (0 != 2759)
So in summary, I am seeking answers that that help with installing ruby 2.3.1 using rbenv or rvm. Considering that rvm will not install and rbenv fails to find the include files.
I seem to be fine using the new version of ruby for the tutorial but I want to complete the tutorial, and I am worried that maybe something will not go smoothly using the newer version of ruby.
install Xcode
install brew and openssl (or update it)
brew install openssl
and then try again
rvm install 2.3.1 --with-openssl-dir=`brew --prefix openssl`
Reinstall the header files with:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Failing to execute tests in Bitrise for debug variant

Description
I'm using Bitrise to run Detox tests. The build command runs ok and is a success. But the test command always fails.
Running locally:
Command detox test -c ios.sim.debug without starting the packager: 'No bundle URL present' error
Command detox test -c ios.sim.debug with the packager: Opens the packager and everything runs OK.
Command detox test -c ios.sim.release without the packager: works fine.
Command detox test -c ios.sim.release with the packager: works fine.
Running in Bitrise:
Command detox test -c ios.sim.debug --cleanup without starting the packager: 'No bundle URL present' error
Command detox test -c ios.sim.debug --cleanup with the packager:
Verify tests are up
"before all" hook:
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/vagrant/git/e2e/tests.spec.js)
Command detox test -c ios.sim.release --cleanup without the packager: works fine.
Command detox test -c ios.sim.release --cleanup with the packager: works fine.
Disclaimer
With/Without the packager means the variable RCT_NO_LAUNCH_PACKAGER equals false/true, respectively.
The package.json file
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PROJECT_NAME.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/PROJECT_NAME.xcworkspace -scheme INTEGRATION_SCHEME -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/PROJECT_NAME.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/PROJECT_NAME.xcworkspace -scheme PRODUCTION_SCHEME -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 7 Plus"
},
The bitrise.yml file
_init_install:
steps:
- activate-ssh-key#3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone#4.0.11: {}
- script#1.1.5:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
brew uninstall --ignore-dependencies node
brew install node#8
brew link --overwrite --force node#8
- yarn#0.0.7: {}
_detox_tests:
steps:
- npm#0.9.0:
title: Install Detox CLI
inputs:
- command: install -g detox-cli
- npm#0.9.0:
title: Install React-Native CLI
inputs:
- command: install -g react-native-cli
- script#1.1.5:
title: Install Detox Utils
inputs:
- content: |-
#!/bin/bash
brew tap facebook/fb
export CODE_SIGNING_REQUIRED=NO
brew install fbsimctl
brew tap wix/brew
brew install applesimutils --HEAD
- script#1.1.5:
title: Detox - Build Debug App
inputs:
- content: |-
#!/usr/bin/env bash
detox build -c ios.sim.debug
- script#1.1.5:
title: Detox - Run E2E Tests
inputs:
- content: |-
#!/usr/bin/env bash
detox test -c ios.sim.debug --cleanup
- deploy-to-bitrise-io#1.3.10: {}
test_ios:
before_run:
- _init_install
after_run:
- _detox_tests
steps:
- cocoapods-install#1.7.2:
inputs:
- podfile_path: ios/Podfile
- resource-archive#2.0.1:
inputs:
- extract_to_path: "$HOME/Documents/FacebookSDK/"
- archive_url:https://origincache.facebook.com/developers/resources/?id=facebook-ios-sdk-current.zip
- certificate-and-profile-installer#1.9.3: {}
```
Detox, Node, Device, Xcode and macOS Versions
Detox: v7.4.3
React Native: v0.51.0
Node: v9.4.0
Device: iPhone 7 (simulator)
Xcode: Version 9.3 (9E145)
macOS: 10.13.3 (17D102)
Device and verbose Detox logs
Error detox test -c ios.sim.debug --cleanup with the packager
pastebin
File detox.last_launch_app_log.err prints:
pastebin
TL;DR
I get an error when running Detox with Bitrise. The command detox test -c ios.sim.debug --cleanup should open a packager but looks like it's not doing it.
The version that is needed to test is the Debug one, no other options. Maybe I missed something about the installation, but all the files were checked with official docs and other examples and are the identical.
Related issues: 742, 749, 740

Pkg-config 0.28 did not build on OSX 10.10.2

Recently I clean installed Yosemite 10.10.2
I also installed gcc using
brew install gcc
Now I'm trying to build and install python and openmpi from source because previously I've had problems with gfortran and clang.
So I did
brew install openmpi --build-from-source -verbose
brew install python --build-from-source -verbose
with variables and aliases:
export CC=gcc-4.9
export CXX=g++-4.9
export CPP=g++-4.9
export LD=gcc-4.9
export FC=gfortran-4.9
export HOMEBREW_CC=gcc-4.9
export HOMEBREW_LD=gcc-4.9
export HOMEBREW_CXX=g++-4.9
export HOMEBREW_CPP=g++-4.9
export HOMEBREW_FC=gfortran
alias cc=gcc-4.9
alias gcc=gcc-4.9
alias c++=c++-4.9
alias g++=g++-4.9
Still getting the following error:
In file included from /usr/include/dispatch/dispatch.h:51:0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19,
from gunicollate.c:30:
/usr/include/dispatch/object.h:143:15: error: expected identifier or '(' before '^' token
typedef void (^dispatch_block_t)(void);
/usr/include/dispatch/object.h:362:3: error: unknown type name 'dispatch_block_t'
dispatch_block_t notification_block);
==> Formula
Path: /usr/local/Library/Formula/pkg-config.rb
==> Configuration
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 9bbd6637009256d70b57691c3ad1979ca2bb5916
Last commit: 9 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.10.2-x86_64
Xcode: 6.2
CLT: 6.2.0.0.1.1424975374
Clang: 6.0 build 600
X11: N/A
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby
Java: 1.6.0_65
==> ENV
HOMEBREW_CC: gcc-4.9
HOMEBREW_CXX: g++-4.9
MAKEFLAGS: -j2
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apache2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
CMAKE_FRAMEWORK_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10
HOMEBREW_SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
PATH: /usr/local/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/gcc/bin
Error: pkg-config 0.28 did not build
My understanding is that there is a conflict between clang and gcc-4.9 configuration.
I could temporally solve it doing:
brew install pkg-config
So it doesn't build if from source and uses clang configuration.
I see that Xcode is still in the Include and Library path, and I think this prevents linking with gcc-4.9.
How can I install pkg-config using gcc-4.9 only?
Problem solved after following this instructions changing:
typedef void (^dispatch_block_t)(void); // this is for clang
To
typedef void* dispatch_block_t; //this is for gcc-4.9

Resources