vladholubiev / serverless-libreoffice

Run LibreOffice in AWS Lambda to create PDFs & convert documents
https://vladholubiev.com/serverless-libreoffice
513 stars 75 forks source link

Azure functions: error while loading shared libraries: libssl3.so #24

Open aorsten opened 4 years ago

aorsten commented 4 years ago

I'm trying to set this up in Azure functions, a python function which runs on Linux. I've managed to do some of the steps, but am now stuck on the conversion command.

Actually, what I need is to convert EMF and WMF files to PNG - not the entire PDF converter. But I'm trying to set up the PDF converter from a simple .TXT file first.

I've so far managed to:

  1. Connect to Azure Storage (S3 bucket equivalent) and pull the "test.txt" file into a "/tmp" folder.
  2. (I push the lo.tar.gz file along with the code - so no need to pull it from Storage/Bucket) Run the "tar -xf lo.tar.gz" and confirm that I get the executable at "/instdir/program/soffice.bin"
  3. Execute "instdir/program/soffice ~~" using subprocess (rather than os.system, so that I get the output and error messages) However, I get an error here:
        STDOUT: '',
        STDERR: '/tmp/functions\\\\standby\\\\wwwroot/instdir/program/soffice.bin: error while loading shared libraries: libssl3.so: cannot open shared object file: No such file or directory\\n',

I'm really inexperienced with Linux - so I don't understand the error message I'm getting here. Does it mean there's some system files that are required, which aren't included in the lo.tar.gz file?

I have used the lo.tar.gz file you had precompiled for Lambda. Do you reckon it should work here as well - or would I need to build my own specific file for use on Azure Functions (Python functions run on Linux)?

Any help here is much appreciated. And of course I'll share the code for Azure Functions once I manage to get it working - if that's interesting.

aorsten commented 4 years ago

For info, EMF/WMF to PNG conversion can be done with libreoffice with such a command: soffice --headless --convert-to png my_file.emf

aorsten commented 4 years ago

About the Linux version, I tried running lsb_release -a in the Function, resulting in:

Distributor ID: Debian
Description: Debian GNU/Linux 9.11 (stretch)
Release: 9.11
Codename: stretch

uname -a: Linux ccvm1 4.19.75-microsoft-standard #1 SMP Sat Sep 28 17:47:25 UTC 2019 x86_64 GNU/Linux

aorsten commented 4 years ago

About this, I have compiled a new lo.tar.gz for use in Azure Functions for Python on Debian 9 (stretch). So far it seems to work - I'll have to do some checks.

If interesting, I can probably share the release. I'm a complete beginner on the topic of building Linux tar balls, and did this on a Debian Virtual Machine in Azure: If I share the tar-ball, will I somehow expose any secrets or security holes regarding my own Azure? (I cant really think of anything, but I'm not really qualified to answer this)

randombluff commented 4 years ago

@aorsten Hello, nope, that's ok if in the tarball there is only a compiled LibreOffice. It can really expose the system runtime type only ;) Just check the tarball content to maximum match those folders like help, preset, program, sdk and share, core and other that can be found in the builded lo folder structure. All subfolders included and dotfiles like .DB_Store and .wh..wh..opq and possible other options ;)

ZsoltPath commented 2 years ago

I've run into the same issue in AWS Lambda. Built a layer and attached it to the Lambda code. Now getting the /tmp/lo/instdir/program/soffice.bin: error while loading shared libraries: libssl3.so: cannot open shared object file: No such file or directory error

MichaelPeter commented 2 years ago

@aorsten Hi, I am also interested in an Azure Function version, did you succeed? Is there maybe a repo?

plyhdrn commented 1 year ago

Hi @aorsten, I ran into the same problem when trying to make it work in Azure Functions. If you can share how you solved this problem I would appreciate it.