Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package libffi was not found in the pkg-config search path #1603

Closed
binarykitchen opened this issue Mar 8, 2019 · 11 comments
Closed

Package libffi was not found in the pkg-config search path #1603

binarykitchen opened this issue Mar 8, 2019 · 11 comments
Labels

Comments

@binarykitchen
Copy link

It's me again on MacOS. Can't install sharp again. Here the whole output

error /Users/michael-heuberger/code/videomail.io/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: /Users/michael-heuberger/code/videomail.io/node_modules/sharp
Output:
info sharp Detected globally-installed libvips v8.7.4
info sharp Building from source via node-gyp
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@8.12.0 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/michael-heuberger/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/michael-heuberger/code/videomail.io/node_modules/sharp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/michael-heuberger/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/michael-heuberger/.node-gyp/8.12.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/michael-heuberger/.node-gyp/8.12.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/michael-heuberger/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/michael-heuberger/.node-gyp/8.12.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/michael-heuberger/code/videomail.io/node_modules/sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-2.0', not found
gyp: Call to 'PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.13:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/michael-heuberger/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/michael-heuberger/.nvm/versions/node/v8.12.0/bin/node" "/Users/michael-heuberger/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

Any clues?

@lovell
Copy link
Owner

lovell commented Mar 8, 2019

Hello, it looks like you're using a globally-installed version of vips installed by homebrew.

Has brew update && brew upgrade been run to eliminate any problems/inconsistencies with the dependencies it manages?

@lovell lovell added the question label Mar 8, 2019
@binarykitchen
Copy link
Author

Nope, brew update && brew upgrade doesn't make a difference. Still seeing the same error.

Any clues, tips, how to fix this?

@lovell
Copy link
Owner

lovell commented Mar 10, 2019

If you want to use a homebrew-managed version of vips then brew reinstall vips.

If you'd prefer to use sharp-managed version of vips then brew uninstall vips.

@binarykitchen
Copy link
Author

ok that worked, uninstalling vips via brew. confusing. can you add a warning about this to improve DX?

@lovell
Copy link
Owner

lovell commented Mar 11, 2019

At install-time, sharp logs the decisions it's making - here's the salient part of the log from your initial comment:

info sharp Detected globally-installed libvips v8.7.4
info sharp Building from source via node-gyp

Errors from node-gyp after this in the install log usually relate to an invalid/corrupt installation of libvips and/or its dependencies, which is what you were seeing. By removing the globally-installed libvips you allowed sharp to make a different decision and download and use its own libvips.

Mac-specific installations are at https://sharp.pixelplumbing.com/en/stable/install/#mac-os

@lovell lovell closed this as completed Mar 11, 2019
@lovell
Copy link
Owner

lovell commented Mar 11, 2019

Coincidentally I just ran into this same error on an OS X machine:

Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable

and was able to fix it by following the instructions in the error message:

export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig"

so this was a brew/libffi/pkgconfig problem unrelated to either sharp or libvips.

@binarykitchen
Copy link
Author

Ah good to know. Report this problem to either brew, libffi or pkgconfig somewhere?

@axelpale
Copy link

Had this issue today. Resolved it with brew uninstall vips.

Development: Why does sharp need the globally managed vips? Could sharp always download its own libvips? Is it just a matter of download time optimization?

@zhuweiyou
Copy link

Coincidentally I just ran into this same error on an OS X machine:

Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable

and was able to fix it by following the instructions in the error message:

export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig"

so this was a brew/libffi/pkgconfig problem unrelated to either sharp or libvips.

Thank you !

@nether-cat
Copy link

Coincidentally I just ran into this same error on an OS X machine:

Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable

and was able to fix it by following the instructions in the error message:

export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig"

so this was a brew/libffi/pkgconfig problem unrelated to either sharp or libvips.

Been running into similar issues since using macOS back in 2015 – probably once per year – whenever I try to install sharp in a fresh project. I've always managed to find help here... Thank you! ❤️

@joelfrederico
Copy link

joelfrederico commented Aug 8, 2019

FYI, from what I've seen, all of the backends I can test (Qt5Agg, macosx, TkAgg, WxAgg) currently have the same behavior (with the exception of WebAgg and nbAgg):

  • Backend uses Python icon
  • Backend does not turn off Python icon when all windows are closed
    • Unclear if this is because backends don't stop running when windows are closed
  • Icon is the Python rocketship

WebAgg does not show an icon at all. nbAgg is specifically for embedding in Jupyter notebook/lab, so showing an icon doesn't make sense.

Repository owner locked and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants