Forum How do I...?

Statically linked binary for 64-bit CentOS

kamilkp
Is it possible to somehow obtain a statically linked binary for 64-bit CentOS 6 ?
mikeday
Do you have problems with missing system libraries?
kamilkp
I need to have a self sufficient executable that I can copy over in a zip to Amazon AWS Lamdba.

So far I managed to install princexml on a local CentOS 6, it did break at first because of missing libs so I installed them. Now it works there but the binary is dynamically linked so if I move it to another machine - it won't work.
mikeday
I see. Which Linux distribution does AWS Lambda support? Perhaps it would make sense for us to prepare a customised Prince package.
kamilkp
It's: Amazon Linux AMI release 2016.03

Running uname -a produced:
Linux ip-10-11-166-143 4.4.35-33.55.amzn1.x86_64 #1 SMP Tue Dec 6 20:30:04 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

It's based on CentOS 6.
mikeday
And I guess you can't install your own RPM packages?
kamilkp
No you can only zip files and send them over.
kamilkp
So that's why I need a statically linked executable.
kamilkp
In this example they describe how to do it with OpenCV. https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/

Can it be done in a similar way?
mikeday
We will investigate and get back to you.
mikeday
Can you please try this new package: prince-20170111-centos6-amazon-x86_64.tar.gz, it's not fully statically linked but most of the necessary libraries are included and hopefully the remainder should already be installed on Amazon Lambda. Please let me know if you experience any missing library errors.

Edited by mikeday

wangp
To run Prince on Amazon Lambda, you can use the CentOS 6 package. The only shared library that should be missing is libtiff; you can place a copy of the libtiff.so.3* files from CentOS (or Amazon Linux) into the 'lib' directory of your deployment package. Alternatively, use the generic Linux version of Prince; there should be no missing dependencies.