marzer / poxy

Documentation generator for C++
https://pypi.org/project/poxy
MIT License
135 stars 5 forks source link

RuntimeError: libgs found, but is not in /usr/lib/libgs.so.10 #31

Closed wroyca closed 11 months ago

wroyca commented 11 months ago

Environment

version and/or commit hash:

0.13.5

In Fedora 38, there is an issue with poxy being unable to locate libgs and additionally libgs doesn't get automatically installed, meaning we we need to resort to using our system's package manager as fallback:

Writing /tmp/poxy/home_wroy_hello_doc/conf.py
Generating HTML files with m.css
m.css failed!
m.css stderr:
    Traceback (most recent call last):
      File "/home/wroy/.local/lib/python3.11/site-packages/poxy/mcss/documentation/doxygen.py", line 58, in <module>
        import latex2svg
      File "/home/wroy/.local/lib/python3.11/site-packages/poxy/mcss/documentation/../plugins/latex2svg.py", line 73, in <module>
        raise RuntimeError('libgs found, but is not in ' +  libgs_absolute)
    RuntimeError: libgs found, but is not in /usr/lib/libgs.so.10

Deleting /tmp/poxy/home_wroy_hello_doc

*************

Traceback (most recent call last):
  File "/home/wroy/.local/lib/python3.11/site-packages/poxy/main.py", line 303, in main
    run(
  File "/home/wroy/.local/lib/python3.11/site-packages/poxy/run.py", line 1683, in run
    run_mcss(context)
  File "/home/wroy/.local/lib/python3.11/site-packages/poxy/run.py", line 1588, in run_mcss
    run_python_script(
  File "/home/wroy/.local/lib/python3.11/site-packages/misk/functions.py", line 355, in run_python_script
    return subprocess.run([_state().python, str(path)] + [arg for arg in args],
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['python3', '/home/wroy/.local/lib/python3.11/site-packages/poxy/mcss/documentation/doxygen.py', '/tmp/poxy/home_wroy_hello_doc/conf.py', '--no-doxygen', '--sort-globbed-files', '--debug']' returned non-zero exit status 1.

*************

--bug-report

poxy_bug_report.zip

marzer commented 11 months ago

~What even is libgs? This probably isn't a poxy bug, but some issue with fedora or etc, tbh. I'll double-check the dependencies but this is a new one to me.~

Oh, right, so it's something in m.css: https://github.com/search?q=repo%3Amosra%2Fm.css%20libgs&type=code

mosra commented 11 months ago

Libgs is what converts latex math into SVGs. I was fixing something similar recently, in mosra/m.css@ea904dbb82b6e0d10ac2cf319ca065b4cc869ab3, the comment above this very error message explains why this might fire (locating libraries is apparently not easy).

Do you have libgs.so, libgs.so.10 etc on your system? Where is it? I'll add it to the list of hardcoded paths.

wroyca commented 11 months ago

Libgs is what converts latex math into SVGs. I was fixing something similar recently, in mosra/m.css@ea904db, the comment above this very error message explains why this might fire (locating libraries is apparently not easy).

Do you have libgs.so, libgs.so.10 etc on your system? Where is it? I'll add it to the list of hardcoded paths.

I do - I resolved it manually on my system, but on Fedora, libraries are typically installed in /usr/lib64

mosra commented 11 months ago

Ah so if you'd change that line to have lib64 instead of lib, it would no longer complain?

On Arch /usr/lib64 is a symlink to /usr/lib, isn't /usr/lib a symlink to /usr/lib64 on Fedora? I'd expect both to be there.

wroyca commented 11 months ago

Ah so if you'd change that line to have lib64 instead of lib, it would no longer complain?

Correct

On Arch /usr/lib64 is a symlink to /usr/lib, isn't /usr/lib a symlink to /usr/lib64 on Fedora? I'd expect both to be there.

I wish... it's not the first time it has caused issues. But alas no, both are distinct directory with their respective libs individually

mosra commented 11 months ago

As of mosra/m.css@c34e8608973548c5e3d31d65cbfdd5b2fc42a59e it looks into /usr/lib64 as well (unless I messed up the for-else expression).

wroyca commented 11 months ago

As of mosra/m.css@c34e860 it looks into /usr/lib64 as well (unless I messed up the for-else expression).

Sweet, thank!

mosra commented 11 months ago

Poxy still needs to get its copy of m.css updated tho ;)

marzer commented 11 months ago

TIL for/else

DavidAntliff commented 3 weeks ago

FWIW, on Ubuntu systems (at least 22.04, 23.10, probably 24.04):

/usr/lib/x86_64-linux-gnu/libgs.so.10

Worked around with a symlink, but if you're going to hard-code paths to search for find_library() results, /usr/lib/x86_64-linux-gnu/ might be a good addition to the list.

mosra commented 3 weeks ago

@marzer can you apply https://github.com/mosra/m.css/commit/523506668a61646603ed299e1b60b7f77a8ebd77 to poxy? That should fix this case as well, and hopefully all future ones too.

marzer commented 3 weeks ago

Sure, thanks @mosra