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

Improve installation experience when a globally-installed libvips below the minimum required version is found #1148

Closed
binarykitchen opened this issue Mar 6, 2018 · 18 comments

Comments

@binarykitchen
Copy link

make: Entering directory '/var/www/videomail/staging/source/node_modules/sharp/build'                              
  TOUCH Release/obj.target/libvips-cpp.stamp             
  CXX(target) Release/obj.target/sharp/src/common.o      
In file included from ../src/common.cc:25:0:             
/usr/local/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory                         
 #include <glib-object.h>                                
          ^~~~~~~~~~~~~~~                                
compilation terminated.                                  
sharp.target.mk:120: recipe for target 'Release/obj.target/sharp/src/common.o' failed                              
make: Leaving directory '/var/www/videomail/staging/source/node_modules/sharp/build'                               
make: *** [Release/obj.target/sharp/src/common.o] Error 1 
@lovell
Copy link
Owner

lovell commented Mar 6, 2018

Hello, the presence of /usr/local/include/vips suggests libvips has been compiled from source on this machine.

http://jcupitt.github.io/libvips/install.html#building-libvips-from-a-source-tarball

The glib2.0-dev dependency is probably missing.

You might also like to upgrade to sharp v0.20.0, which should remove the need for compilation.

@lovell lovell added the question label Mar 6, 2018
@lovell lovell changed the title Critical: unable to compile on production server, glib-object.h missing Compilation error: glib-object.h: No such file or directory Mar 6, 2018
@binarykitchen
Copy link
Author

already have bumped to .20 and this is where the above is happening

you saying i should apt-get install glib2.0-dev?

@lovell
Copy link
Owner

lovell commented Mar 6, 2018

Sharp will be built from source at install time when a globally-installed libvips is detected http://sharp.pixelplumbing.com/en/stable/install/

You can either:

  1. maintain the globally-installed libvips and its dependencies (including glib2.0-dev) and let sharp compile and link itself against that version of libvips, or
  2. remove the globally-installed libvips and let sharp use prebuilt binaries for both itself and libvips.

@binarykitchen
Copy link
Author

i already had glib2.0-dev installed

michael.heuberger@binarykitchen /v/log ❯❯❯ sudo apt-get install glib2.0-dev
[sudo] password for michael.heuberger:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libglib2.0-dev-bin' for regex 'glib2.0-dev'
Note, selecting 'libglib2.0-dev' for regex 'glib2.0-dev'
libglib2.0-dev is already the newest version (2.54.1-1ubuntu1).
libglib2.0-dev-bin is already the newest version (2.54.1-1ubuntu1).
libglib2.0-dev-bin set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

yet sharp failed to build

@lovell
Copy link
Owner

lovell commented Mar 9, 2018

Does glib-object.h exist?

$ locate glib-object.h | grep usr
/usr/include/glib-2.0/glib-object.h

Is pkg-config aware of the path it exists at?

$ pkg-config --cflags vips-cpp
-pthread -I/usr/local/include -I/usr/include/glib-2.0 ...

@binarykitchen
Copy link
Author

dont have the locate command here on ubuntu 17.10

@lovell
Copy link
Owner

lovell commented Mar 11, 2018

The find command is also suitable here, albeit a lot slower due to the lack of an index.

$ find /usr -name glib-object.h
/usr/include/glib-2.0/glib-object.h

@binarykitchen
Copy link
Author

thanks... so yes it exists

~ ❯❯❯ find /usr -name glib-object.h
/usr/include/glib-2.0/glib-object.h

and no, pkg-config isn't aware of it

~ ❯❯❯ pkg-config --cflags vips-cpp
Package vips-cpp was not found in the pkg-config search path.
Perhaps you should add the directory containing `vips-cpp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vips-cpp' found

@lovell
Copy link
Owner

lovell commented Mar 11, 2018

Please can you try that second command with the same PKG_CONFIG_PATH as sharp uses, to include /usr/local/...:

$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig pkg-config --cflags vips-cpp

My best guess is that there's one or more (partial?) installations of libvips that are conflicting.

@binarykitchen
Copy link
Author

nope that wont work either

~ ❯❯❯ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig pkg-config --cflags vips-cpp
Package vips-cpp was not found in the pkg-config search path.
Perhaps you should add the directory containing `vips-cpp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vips-cpp' found

and yes, on the server i have two nodejs projects running both using your package (local installs)

@lovell
Copy link
Owner

lovell commented Mar 11, 2018

I'd suggest ether re-installing libvips or totally removing it. Without looking at the machine I'm unlikely to be able to help further. Good luck!

@flyersa
Copy link

flyersa commented Mar 12, 2018

same error on ubuntu 16.04 with libvips-dev and glib dev installed, also file exists in fs

@lovell
Copy link
Owner

lovell commented Mar 12, 2018

If using a globally-installed libvips (e.g. via the libvips-dev package), please ensure it meets the minimum required version of libvips for a given version of sharp.

http://sharp.pixelplumbing.com/en/stable/changelog/

For example, sharp v0.20.x requires libvips v8.6.1+ but the most recent Ubuntu package is v8.4.5.

@asilvas
Copy link

asilvas commented Mar 12, 2018

fyi I see this issue on mac osx as well. brew update vips resolved.

@lovell
Copy link
Owner

lovell commented Mar 13, 2018

Thanks for the additional reports. This appears to only impact those using v0.20.0 with an globally-installed libvips that does not meet the minimum required version. I have an idea about how to improve the installation experience in this scenario.

@lovell lovell changed the title Compilation error: glib-object.h: No such file or directory Improve installation experience when a globally-installed libvips below the minimum required version is found Mar 13, 2018
@lovell lovell added this to the v0.20.1 milestone Mar 13, 2018
@lovell
Copy link
Owner

lovell commented Mar 13, 2018

Commit 48c5f86 should make the installation experience a little smoother - this will be in v0.20.1.

@Nokel81
Copy link

Nokel81 commented Mar 14, 2018

What is the timeframe for v0.20.1? Thank you in advance

@lovell
Copy link
Owner

lovell commented Mar 17, 2018

v0.20.1 now available, thank you for the feedback.

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

No branches or pull requests

5 participants