bblanchon / pdfium-binaries

📰 Binary distribution of PDFium
900 stars 191 forks source link

AWS lambda support #31

Closed asterikx closed 2 years ago

asterikx commented 4 years ago

Are the binaries in this repository supposed to work on AWS Lambda?

I'm trying to build libvips with pdfium support using lambci/lambda:build-go1.x Docker image, but it fails:

make[3]: Entering directory `/build/vips-8.9.2/libvips'
/bin/sh ../libtool  --tag=CXX   --mode=link g++  -g -O2 -no-undefined -version-info 54:2:12   -o libvips.la -rpath /opt/lib  resample/libresample.la arithmetic/libarithmetic.la colour/libcolour.la conversion/libconversion.la convolution/libconvolution.la deprecated/libdeprecated.la foreign/libforeign.la freqfilt/libfreqfilt.la histogram/libhistogram.la draw/libdraw.la iofuncs/libiofuncs.la morphology/libmorphology.la mosaicing/libmosaicing.la create/libcreate.la -lz     -lpng12    -ltiff   -ljpeg   -pthread -lgthread-2.0 -lglib-2.0   -Wl,--export-dynamic -pthread -lgmodule-2.0 -lgobject-2.0 -lglib-2.0   -L/opt/lib -lexpat     -llcms2      -L/opt/lib -lpdfium -lc++ -licuuc         -lm 
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-amazon-linux/4.8.5/crtbeginS.o  -Wl,--whole-archive resample/.libs/libresample.a arithmetic/.libs/libarithmetic.a colour/.libs/libcolour.a conversion/.libs/libconversion.a convolution/.libs/libconvolution.a deprecated/.libs/libdeprecated.a foreign/.libs/libforeign.a freqfilt/.libs/libfreqfilt.a histogram/.libs/libhistogram.a draw/.libs/libdraw.a iofuncs/.libs/libiofuncs.a morphology/.libs/libmorphology.a mosaicing/.libs/libmosaicing.a create/.libs/libcreate.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/usr/lib64 -Wl,-rpath -Wl,/usr/lib64 -lz -lpng12 -ltiff -ljpeg -lgthread-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -L/opt/lib /usr/lib64/libexpat.so -llcms2 -lpdfium -lc++ -licuuc -L/usr/lib/gcc/x86_64-amazon-linux/4.8.5 -L/usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-amazon-linux/4.8.5/crtendS.o /usr/lib/gcc/x86_64-amazon-linux/4.8.5/../../../../lib64/crtn.o  -g -O2 -pthread -Wl,--export-dynamic -pthread   -pthread -Wl,-soname -Wl,libvips.so.42 -o .libs/libvips.so.42.12.2
/usr/bin/ld: cannot find -lc++
collect2: error: ld returned 1 exit status

Thanks for any help or pointers.

jahanford commented 4 years ago

I have just recently successfully built libvips with the non v8 linux binaries inside the lambci/lambda:build-nodejs12.x container. What you are having issues is with is linkage to libcxx.

I'm unsure if you have already installed libcxx via epel and yum. Like this:

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install libcxx

You can check the library linkage for the two dependencies libicu and libcxx using the method described in this stack. For example my library link command looked like this:

ln -s /usr/lib64/libc++.so.1.0 //usr/lib64/libc++.so