rishihahs / heroku-buildpack-libreoffice

Heroku buildpack for LibreOffice
MIT License
25 stars 45 forks source link

Support for Heroku 16 #13

Open jjalan opened 6 years ago

jjalan commented 6 years ago

I recently used this build pack to generate PDF file using unoconv on Heroku 16. I am documenting my finding and issue so in case other folks are running into similar issue and can help out.

  1. Out of the box, after libreoffice is installed, when I ran unoconv, it threw an error saying office installation is not found. To fix it, I had to set UNO_PATH in compile file at the bottom

    # Set UNO_PATH so unoconv can search for libreoffice
    echo 'export UNO_PATH="$HOME/vendor/libreoffice"' >> $PROFILE_PATH
  2. After that, unoconv complained as follows:

    error: "Traceback (most recent call last): File "/app/unoconv", line 810, in connect unocontext = resolver.resolve("uno:%s" % op.connection) uno.NoConnectException: Connector : couldn't connect to socket (Success) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/unoconv", line 1392, in <module> main() File "/app/unoconv", line 1306, in main convertor = Convertor() File "/app/unoconv", line 789, in __init__ unocontext = self.connect(resolver) File "/app/unoconv", line 821, in connect product = self.svcmgr.createInstance("com.sun.star.configuration.ConfigurationProvider").createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", UnoProps(nodepath="/org.openoffice.Setup/Product")) __main__.CannotActivateFactoryException: loading component library <file:///app/vendor/libreoffice/program/../program/libmergedlo.so> failed "
  3. I ran ldd libmergedlo.so. It said three shared libraries are missing - libGL, libSM, libICE. We are running on heroku 16. After reading https://devcenter.heroku.com/articles/stack-packages, it seems Heroku removes corresponding libraries from runtime which explains the issue. So I used https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt as well with Aptfile as

    libice-dev
    libice6
    libsm-dev
    libsm6

This fixed the issue complaining that libSM, libICE shared libraries are missing. However, it is still looking for libGL.so.1 (which is 32 bit version I believe).

I am stuck here. I tried various thing such as trying to instruct apt buildpack to download 32 bit version of libGL or creating a link of libGL.so.1 to libGL.so.8 (under /app/vendor/libreoffice/program) but both approach failed and running ldd libmergedlo.so still complains that libGL.so.1 is missing.

Any help would be greatly appreciated.

AlejandroFuster commented 6 years ago

Hello @jjalan!

Got the same problem, and I solved it the following way:

  1. Used https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt from the beggining with the following Aptfile:

    libreoffice
    libxfixes3
    libxinerama-dev
    libxinerama1
    libxdamage1
    libglu1-mesa:i386

    (libreoffice asked me for other libraries after step 2, that's why those extra dependencies are there)

  2. Ran the following command (to create a link): ln -s ~/.apt/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 ~/.apt/usr/lib/x86_64-linux-gnu/

And it worked!

I didn't use unoconv, but I really hope you can solve it with these steps!