Skip to content

Cannot find png.h with custom Homebrew root because Boxen #45

Description

I have a non-standard, but not-uncommon Homebrew config which causes this module to fail to build on OS X. Specifically, Homebrew is installed by Boxen under /opt/boxen instead of /usr/local:

$ brew --env
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /opt/boxen/homebrew
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/opt/boxen/homebrew/Library/ENV/pkgconfig/10.10
ACLOCAL_PATH: /opt/boxen/homebrew/share/aclocal
PATH: /opt/boxen/homebrew/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/sbin

I confess to being fairly ignorant how node extensions are built with gyp, but I would expect to see something like -I/opt/boxen/homebrew/include here:

$ npm install --loglevel verbose png
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
  c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/toolbear/.node-gyp/0.10.31/src -I/Users/toolbear/.node-gyp/0.10.31/deps/uv/include -I/Users/toolbear/.node-gyp/0.10.31/deps/v8/include  -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/png/src/common.o.d.raw  -c -o Release/obj.target/png/src/common.o ../src/common.cpp
  c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/toolbear/.node-gyp/0.10.31/src -I/Users/toolbear/.node-gyp/0.10.31/deps/uv/include -I/Users/toolbear/.node-gyp/0.10.31/deps/v8/include  -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/png/src/png_encoder.o.d.raw  -c -o Release/obj.target/png/src/png_encoder.o ../src/png_encoder.cpp
In file included from ../src/png_encoder.cpp:3:

I can work around this issue with:

$ cd /usr/local
$ sudo ln -s /opt/boxen/homebrew/include include

And then everything builds.

With some pointers on what I should change, I'm happy to submit a pull request that incorporates brew --env values into the build config. The failure is trivial for me to reproduce and currently not blocking as png is an optional dependency ATM.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions