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

When docker install sharp for lambda linux x64 , libvips was not custom complied. #2006

Closed
ghost opened this issue Dec 13, 2019 · 3 comments
Closed
Labels

Comments

@ghost
Copy link

ghost commented Dec 13, 2019

I install libvips in global => brew install vips
--------------- brew info vips -------------------
vips: stable 8.8.4 (bottled)
Image processing library
https://github.com/libvips/libvips
/usr/local/Cellar/vips/8.8.4 (166 files, 11.6MB) *
Poured from bottle on 2019-12-13 at 14:10:10
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/vips.rb
==> Dependencies
Build: pkg-config ✔
Required: cfitsio ✔, fftw ✔, fontconfig ✔, gettext ✔, giflib ✔, glib ✔, imagemagick ✔, libexif ✔, libgsf ✔, libheif ✔, libmatio ✔, libpng ✔, librsvg ✔, libtiff ✔, little-cms2 ✔, mozjpeg ✔, openexr ✔, openslide ✔, orc ✔, pango ✔, poppler ✔, webp ✔
==> Analytics
install: 2,531 (30 days), 6,027 (90 days), 19,448 (365 days)
install-on-request: 2,403 (30 days), 5,774 (90 days), 18,362 (365 days)
build-error: 0 (30 days)

I check Sharp.format in my local mac.
{ jpeg:
{ id: 'jpeg',
input: { file: true, buffer: true, stream: true },
output: { file: true, buffer: true, stream: true } },
png:
{ id: 'png',
input: { file: true, buffer: true, stream: true },
output: { file: true, buffer: true, stream: true } },
webp:
{ id: 'webp',
input: { file: true, buffer: true, stream: true },
output: { file: true, buffer: true, stream: true } },
tiff:
{ id: 'tiff',
input: { file: true, buffer: true, stream: true },
output: { file: true, buffer: true, stream: true } },
magick:
{ id: 'magick',
input: { file: true, buffer: true, stream: true },
output: { file: true, buffer: true, stream: true } },
openslide:
{ id: 'openslide',
input: { file: true, buffer: false, stream: false },
output: { file: false, buffer: false, stream: false } },
dz:
{ id: 'dz',
input: { file: false, buffer: false, stream: false },
output: { file: true, buffer: true, stream: true } },
ppm:
{ id: 'ppm',
input: { file: true, buffer: false, stream: false },
output: { file: true, buffer: false, stream: false } },
fits:
{ id: 'fits',
input: { file: true, buffer: false, stream: false },
output: { file: true, buffer: false, stream: false } },
gif:
{ id: 'gif',
input: { file: true, buffer: true, stream: true },
output: { file: false, buffer: false, stream: false } },
svg:
{ id: 'svg',
input: { file: true, buffer: true, stream: true },
output: { file: false, buffer: false, stream: false } },
heif:
{ id: 'heif',
input: { file: true, buffer: true, stream: true },
output: { file: true, buffer: true, stream: true } },
pdf:
{ id: 'pdf',
input: { file: true, buffer: true, stream: true },
output: { file: false, buffer: false, stream: false } },
vips:
{ id: 'vips',
input: { file: true, buffer: false, stream: false },
output: { file: true, buffer: false, stream: false } },
raw:
{ id: 'raw',
input: { file: false, buffer: true, stream: true },
output: { file: false, buffer: true, stream: true } } }


docker run -v "$PWD":/var/task lambci/lambda:build-nodejs10.x npm install sharp
(in command)

sharp@0.23.4 install /var/task/node_modules/sharp
(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz

I compress index.js and node_modules and upload zip file in aws lambda functions.
However when I convert heic to jpeg, it is not working (error : not supported fomat error)
=> I think, it was downloading libvips-8.8.1-linux-x64.tar.gz. So, Maybe it was not complied my global libvips.

So, I tried another process.
npm install --no-cache --arch=x64 --platform=linux --target=10.15.0 sharp
(in command)

sharp@0.23.4 install /Users/vincent/Desktop/Project/image_resize_s3_trigger/node_modules/sharp
(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Detected globally-installed libvips v8.8.4
info sharp Building from source via node-gyp
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
CXX(target) Release/obj.target/sharp/src/metadata.o
CXX(target) Release/obj.target/sharp/src/stats.o
CXX(target) Release/obj.target/sharp/src/operations.o
CXX(target) Release/obj.target/sharp/src/pipeline.o
CXX(target) Release/obj.target/sharp/src/sharp.o
CXX(target) Release/obj.target/sharp/src/utilities.o
SOLINK_MODULE(target) Release/sharp.node

But, It is also not working. (error:Something went wrong installing the "sharp" module
/var/task/node_modules/sharp/build/Release/sharp.node: invalid ELF header)


I want to convert heic format image to jpeg format.
How to docker install sharp in my global libvibs circumstance???
Please help me.

@ghost ghost added the question label Dec 13, 2019
@lovell
Copy link
Owner

lovell commented Dec 13, 2019

OS X packages installed via Homebrew cannot be used inside Linux containers as these are two completely different platforms.

You'll need to compile libvips from source inside the container.
https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball

If the intent is to run this on AWS Lambda then you may run into further problems around packaging binaries - see #2000 - good luck!

@ghost
Copy link
Author

ghost commented Dec 16, 2019

Sorry... I can't understand your comment.
Can you suggest solution step by step?

You'll need to compile libvips from source inside the container.
https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball

I download it on my local mac and try ./configure & make & make install in vips-8.8.4 folder.
However, It was not work.
clang: error: unsupported option '-fopenmp'
make[3]: *** [heifload.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Please help me.....T_T
It' too hard....

@lovell
Copy link
Owner

lovell commented Dec 16, 2019

What you're attempting is rather complex and well beyond the scope of sharp itself - I recommend you ask on a site such as StackOverflow - good luck!

@lovell lovell closed this as completed Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant