Lambda: can't install with static libvips
See original GitHub issueI need to compile libvips since the bundled one with sharp doesn’t support bmp, and I want to run this inside aws lambda so I am compiling libvips as a static library. This is done in the amazonlinux docker container.
I ran into 2 problems.
- During npm install
bash-4.2# PKG_CONFIG_PATH=~/vips/lib/pkgconfig/ npm install --runtime_link=static -prefix=~/sharp_test --unsafe-perm sharp
-
> sharp@0.17.1 install /root/sharp_test/node_modules/sharp
> node-gyp rebuild
readelf: Error: '/root/vips/lib/libvips-cpp.so': No such file
gyp: Call to 'if readelf -Ws "$(PKG_CONFIG_PATH=":$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
These are the flags I used to install vips
./configure --enable-static --disable-shared --prefix=$HOME/vips
I got around this by removing --disable-shared
Does sharp really need both shared and static libraries of libvips?
- After that I got another error during npm install
bash-4.2# PKG_CONFIG_PATH=~/vips/lib/pkgconfig/ npm install --runtime_link=static -prefix=~/sharp_test --unsafe-perm sharp
-
> sharp@0.17.1 install /root/sharp_test/node_modules/sharp
> node-gyp rebuild
make: Entering directory `/root/sharp_test/node_modules/sharp/build'
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/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/obj.target/sharp.node
/usr/bin/ld: cannot find -ljbig
/usr/bin/ld: cannot find -lffi
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/sharp.node] Error 1
make: Leaving directory `/root/sharp_test/node_modules/sharp/build'
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Sharp on AWS Amplify Backend Lambda Causing Build to Fail
When I push to git to trigger a deploy, my build is failing I think due to vips/vips8 a sharp dependency not being...
Read more >Creating Lambda container images - AWS Documentation
Create a container image for a Lambda function by using an AWS provided base image or an alternative base image.
Read more >AWS Lambda Microservice Workshop using S3, Libvips, & Ruby
Interested in learning AWS & Lambda from the ground up using Ruby? This workshop leverages Docker & AWS SAM Cookiecutter templates to ...
Read more >terraform-aws-modules/lambda/aws
Build and install dependencies - read more. ... Create static and dynamic aliases for AWS Lambda Function - see usage, see modules/alias.
Read more >libvips Executable for AWS Lambda | Cloud Functions library
libvips -lambda does not have a standard license declared. Check the repository for any ... libvips-lambda releases are available to install and integrate....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I got it working locally with shared libraries, but I’m getting an error when it runs on AWS lambda
Which looks like something inside build/Release/sharp.node
I’m not really sure what this means. Any ideas?Nevermind, AWS didn’t show the specific error for some reason. I had to use the “Test” button to see it. It seems like libwebp and libexif couldn’t be found even though Amazon listed them in the list of packages (https://aws.amazon.com/amazon-linux-ami/2016.03-packages/). I added those inside my zip and it works now. Thanks!
Worked for me:
libvips.so.42
andlibvips-cpp.so.42
from/usr/local/lib/
to/usr/lib/