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

./x2t: error while loading shared libraries: libgraphics.so: cannot open shared object file: No such file or directory #195

Closed
plush opened this issue Jan 14, 2021 · 13 comments

Comments

@plush
Copy link

plush commented Jan 14, 2021

Since the upgrade to Nextcloud 20.0 and Community Document Server 0.1.8, any attempt to access a document results in "ONLYOFFICE cannot be reached. Please contact admin." The log says that this is because the x2t binary cannot find libgraphics.so. The two files actually reside in the same directory, but apparently the library search path was not set, so x2t cannot find the library it needs. Setting LD_LIBRARY_PATH=. allows the binary to run. You can verify this on the command line.

Without setting LD_LIBRARY_PATH: Failure

$ cd apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin
$ ./x2t
./x2t: error while loading shared libraries: libgraphics.so: cannot open shared object file: No such file or directory

With LD_LIBRARY_PATH=.: Success

$ cd apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin
$ LD_LIBRARY_PATH=. ./x2t
-------------------------------------------------------------------------------
                OOX/binary file converter. Version: 5.6.5.3
-------------------------------------------------------------------------------
[...]

The fix would be to pass the correct LD_LIBRARY_PATH in ConverterBinary.php line 51. I quickly hacked this for myself by setting LD_LIBRARY_PATH to ., but the proper fix may be to derive the value from a path constant somewhere - I will leave it to those experienced with this project to develop a patch. This one-line hack was sufficient to get my Nextcloud working again though.

@speerwerfer
Copy link

speerwerfer commented Jan 16, 2021

The fix would be to pass the correct LD_LIBRARY_PATH in ConverterBinary.php line 51. I quickly hacked this for myself by setting LD_LIBRARY_PATH to ., but the proper fix may be to derive the value from a path constant somewhere - I will leave it to those experienced with this project to develop a patch. This one-line hack was sufficient to get my Nextcloud working again though.

can you send this one line of your FIX? I would also like to use that until it is officially fixed

@plush
Copy link
Author

plush commented Jan 16, 2021

I am sorry, I am not allowed to provide a patch directly for reasons. But it's easy to make the change yourself. The last argument to proc_open() is an array of environment variables. It's empty by default. Just replace it with an array that sets 'LD_LIBRARY_PATH' to '.'.

@plush
Copy link
Author

plush commented Jan 16, 2021

The PHP manual explains the array syntax and provides examples. You can define the array inline, making it a true one-line change.

@TueTchen
Copy link

Thank you!
Now happy - works fine with the replacement of the empty array at the end of line 51:
replace [ ] with ["LD_LIBRARY_PATH" => "."]

@plush
Copy link
Author

plush commented Jan 17, 2021

Yep, that's all it takes.

@nilskamm
Copy link

That´s a really easy fix. Thanks a lot for sharing!!!

@alghanim-lab
Copy link

alghanim-lab commented Mar 30, 2022

I tried your solution and I changed this line as follows:

Bildschirmfoto 2022-03-30 um 16 56 09

Unfortunately your solution doesn't work for me
in my system the variable LD_LIBRARY_PATH is not found with the command echo $LD_LIBRARY_PATH.

I used the find / -name command to search for and found the libgcc_s.so.1 object under /usr/lib/aarch64-linux-gnu/ and exported it but still doesn't work

Bildschirmfoto 2022-03-30 um 17 07 02

does anyone have any ideas?

@dugwood
Copy link

dugwood commented Apr 28, 2022

@alghanim-lab you can change $cmd from:

$cmd = './x2t ' . escapeshellarg($param);

to:

$cmd = 'export LD_LIBRARY_PATH=".";./x2t ' . escapeshellarg($param);

Worked for me (but I have other issues...).

My environment is a PHP-FPM chrooted, hence the same issue (I think).

@eliotmasset
Copy link

eliotmasset commented Dec 5, 2022

Hi, all this solutions don't work for me and after a while, this work with :
sudo cp apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/*.so /usr/lib64/
and
sudo cp apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/*.so.58 /usr/lib64/

Hope this can help some people !

@mrbaseman
Copy link

hmm... this way you have executable code which is not maintained by the package manager somewhere in the system. The proper solution would be to include those directories into $LD_LIBRARY_PATH - better as an absolute path rather than something like '.' - the latter would be more portable but less secure. So, find out the absolute path to the needed shared libraries, and append it to $LD_LIBRARY_PATH would be the preferred solution.

Copy link

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 60 days. Thank you for your contribution!

Retaking repo management include inheritance of old, not treated, and probablty obsolete issues, this is why it was decided to mark issues as stale.

@github-actions github-actions bot added the stale label Jul 29, 2024
@plush
Copy link
Author

plush commented Aug 29, 2024

The issue persists to this date. It's not stale/obsolete.

@github-actions github-actions bot removed the stale label Sep 2, 2024
chadek added a commit to chadek/documentserver_community that referenced this issue Sep 4, 2024
chadek added a commit to chadek/documentserver_community that referenced this issue Sep 4, 2024
chadek added a commit that referenced this issue Sep 4, 2024
* fix x2t librairie issue #195

* fixup! fix x2t librairie issue #195
@chadek
Copy link
Collaborator

chadek commented Sep 4, 2024

This issue should now be fix in v0.1.19

@chadek chadek closed this as completed Sep 4, 2024
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

9 participants