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

Force Poppler build to use custom (new) version of a library instead of default (old) one #3

Closed
asterikx opened this issue Aug 2, 2020 · 2 comments

Comments

@asterikx
Copy link

asterikx commented Aug 2, 2020

Hi @pavinthan!

First, I want to second #2. Thank you for open-sourcing this lambda-layer!

I need to build libvips with poppler support. I'm using the lambci/lambda:build-go1.x as base image as it matches the lambda environment very closely.

The lambda environment includes old versions of libraries such as libpng (which are not included in the amazonlinux:2018.03 image).
Still, I'm building the newest version of those libraries from source as the older ones have known security problems (see libvips/libvips#1749 (comment)).

However, Poppler picks up the pre-installed (old) versions /usr/lib64/ instead of the new version from /opt/lib during the build, e.g. it uses /usr/lib64/libpng.so instead of /opt/lib/libpng.so.

-- Found Freetype: /usr/lib64/libfreetype.so (found version "2.3.11") 
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.13.1
-- Found Fontconfig: /usr/lib64/libfontconfig.so  
-- Found JPEG: /usr/lib64/libjpeg.so (found version "62") 
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8") 
-- Found PNG: /usr/lib64/libpng.so (found version "1.2.49") 
-- Found TIFF: /usr/lib64/libtiff.so (found version "4.0.3")

I can reproduce this issue using the Dockerfile from this repository by adding libpng and libpng-devel via yum to the image.

&& yum install -y libuuid-devel openssl-devel gcc72 gcc72-c++

Original output of Poppler build:

-- Found Freetype: /opt/lib/libfreetype.so (found version "2.10.1") 
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.13.1
-- Found Fontconfig: /opt/lib/libfontconfig.so  
-- Found JPEG: /opt/lib/libjpeg.so (found version "62") 
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8") 
-- Found PNG: /opt/lib/libpng.so (found version "1.6.37") 
-- Found TIFF: /opt/lib/libtiff.so (found version "4.1.0")

Output of Poppler build after installing libpng and libpng-devel via yum:

-- Found Freetype: /opt/lib/libfreetype.so (found version "2.10.1") 
-- Checking for module 'fontconfig'
--   Found fontconfig, version 2.13.1
-- Found Fontconfig: /opt/lib/libfontconfig.so  
-- Found JPEG: /opt/lib/libjpeg.so (found version "62") 
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8") 
-- Found PNG: /usr/lib64/libpng.so (found version "1.2.49") // <=== Poppler uses old verion instead of new one
-- Found TIFF: /opt/lib/libtiff.so (found version "4.1.0") 

Question:
How can I "force" Poppler to build with a custom (new) version of a library instead of the default (old) one?

I appreciate any help on this

@asterikx asterikx closed this as completed Aug 9, 2020
@pavinthan
Copy link
Contributor

@asterikx did you try with setting LD_LIBRARY_PATH to $LAMBDA_TASK_ROOT/lib:$LAMBDA_TASK_ROOT/lib64:$LAMBDA_RUNTIME_DIR:$LAMBDA_RUNTIME_DIR/lib:$LAMBDA_TASK_ROOT:/opt/lib:/opt/lib64:/lib64:/usr/lib64

@asterikx
Copy link
Author

Hey @pavinthan, I solved the problem by adding the option -DCMAKE_PREFIX_PATH=${INSTALL_DIR} to any cmake invocation (see this discussion).

By default cmake does not use pkg-config so it's not aware of any non-default installations. I would recommend adding it to you compiler.Dockerfile as well.

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

No branches or pull requests

2 participants