termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.91k stars 2.97k forks source link

[Bug]: PyMuPDF install error #20873

Open DesiSpymaster opened 1 month ago

DesiSpymaster commented 1 month ago

Problem description

Trying to install package pymupdf with pip install pymupdf results in error:

install_log error PyMuPDF.txt

EDIT: uploading the copied error from pip install -v pymupdf in txt file because of improper formatting issues. [sorry]

EDIT2: updated with full log in txt file. From start to finish.

build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/thirdparty/extract/src/xml.o build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/thirdparty/extract/src/zip.o    -lm -Wl,-soname,libmupdf.so.24.4 -shared -Wl,-Bsymbolic           -lpthread -lstdc++  -L/data/data/com.termux/files/usr/lib -lcrypto                                                    (+4m010.0s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: mkdir -p build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/ ; ar cr build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/libmupdf-threads.a build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/source/helpers/mu-threads/mu-threads.o      (+4m10.2s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: mkdir -p build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/ ; ar cr build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/libmupdf-pkcs7.a build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/source/helpers/pkcs7/pkcs7-openssl.o           (+4m10.8s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: ln -sf libmupdf.so.24.4  build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/libmupdf.so                (+4m10.9s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: mkdir -p build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/ ; cc -Wl,--gc-sections -Wl,-s  -o build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/muraster build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/source/tools/muraster.o build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/libmupdf-pkcs7.a build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/libmupdf-threads.a -Lbuild/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/ -lmupdf  -lm            -lpthread -lstdc++  -lpthread -L/data/data/com.termux/files/usr/lib -lcrypto                               (+4m11.0s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: ld.lld: error: undefined reference due to --no-allow-shlib-undefined: __android_log_print                    (+4m11.0s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: >>> referenced by build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/libmupdf.so                       (+4m11.0s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: cc: error: linker command failed with exit code 1 (use -v to see invocation)                                 (+4m11.0s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: make: *** [Makefile:360: build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release/muraster] Error 1          (+4m11.0s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build: make: *** Waiting for unfinished jobs....                    (+4m12.4s): -b: m: __main__.py:1618:build: (+0.2s): -b: m: __main__.py:1618:build:              (+4m12.4s): -b: m: __main__.py:1618:build: [returned e=2]                                       Traceback (most recent call last):                  scripts/mupdfwrap.py:6:<module>(): wrap.__main__.main()                                         scripts/wrap/__main__.py:3092:main(): jlib.exception_info()                                     ^except raise:                                  scripts/wrap/__main__.py:3090:main(): main2()                                                   scripts/wrap/__main__.py:2484:main2(): build( build_dirs, swig_command, args, vs_upgrade, make_command)                                         scripts/wrap/__main__.py:1618:build(): jlib.system( command, prefix=jlib.log_text(), out='log', verbose=1)                                      scripts/jlib.py:1682:system(): raise Exception( message)                                    Exception: Command failed: cd /data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/mupdf-1.24.4-source && XLIB_LDFLAGS=-Wl,-Bsymbolic make -j 8 HAVE_GLUT=no HAVE_PTHREAD=yes verbose=yes shared=yes HAVE_LEPTONICA=yes HAVE_TESSERACT=yes build=release build_prefix=PyMuPDF-aarch64-shared-tesseract-bsymbolic-                                  Traceback (most recent call last):                File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>                                                 main()                                        File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main                                                     json_out['return_val'] = hook(**hook_input['kwargs'])                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                         File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel                         whl_basename = backend.build_wheel(metadata_directory, config_settings)                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                       File "/data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/pipcl.py", line 642, in build_wheel                                                       items = self._call_fn_build(config_settings)                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                  File "/data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/pipcl.py", line 812, in _call_fn_build                                                    ret = self.fn_build()                                 ^^^^^^^^^^^^^^^                         File "/data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/setup.py", line 557, in build             mupdf_build_dir = build_mupdf_unix( mupdf_local, env_extra, build_type)                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                       File "/data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/setup.py", line 812, in build_mupdf_unix                                                  subprocess.run( command, shell=True, check=True)                                              File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 571, in run             raise CalledProcessError(retcode, process.args,                                             subprocess.CalledProcessError: Command 'cd /data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/mupdf-1.24.4-source && XCFLAGS=-DTOFU_CJK_EXT XCXXFLAGS=-DTOFU_CJK_EXT /data/data/com.termux/files/usr/bin/python3.11 ./scripts/mupdfwrap.py -d build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release -b all && echo /data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/mupdf-1.24.4-source/build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release: && ls -l /data/data/com.termux/files/usr/tmp/pip-install-ba6til9d/pymupdf_447964b37dcd4f1c9d0fe4cd03f32d48/mupdf-1.24.4-source/build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release' returned non-zero exit status 1.                  [end of output]                                                                             note: This error originates from a subprocess, and is likely not a problem with pip.          error: metadata-generation-failed                                                               × Encountered error while generating package metadata.                                          ╰─> See above for output.                                                                       note: This is an issue with the package mentioned above, not pip.                               hint: See above for details.

What steps will reproduce the bug?

pip install pymupdf

What is the expected behavior?

Pymupdf should be installed without errors.

System information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=13107
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.1
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.csclub.uwaterloo.ca/termux/termux-main stable main
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/21 termux extras
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
# x11-repo (sources.list.d/x11.list)
deb https://mirror.csclub.uwaterloo.ca/termux/termux-x11 x11 main
Updatable packages:
termux-x11-nightly/x11 1.03.00-7 all [upgradable from: 1.03.00-0]
termux-tools version:
1.42.4
Android version:
13
Kernel build information:
Linux localhost 4.19.113-27223811 #1 SMP PREEMPT Fri Jun 7 16:23:27 KST 2024 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-G781B
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.x11 versionCode:14
com.termux.api versionCode:51
com.termux.tasker versionCode:6
Biswa96 commented 1 month ago

Could you format the output correctly with triple backticks?

TomJo2000 commented 1 month ago

Could you format the output correctly with triple backticks?

You should be able to edit comments since you're a maintainer.

Biswa96 commented 1 month ago

You should be able to edit comments since you're a maintainer.

I have tried that but the output is in one line. I am not eager to indent that.

DesiSpymaster commented 1 month ago

Could you format the output correctly with triple backticks?

Triple ticks are a single line!

EDIT: Yeah you beat me to it.

How can I make it readable?

Appreciate the attention.

TomJo2000 commented 1 month ago

Looks like your newlines got eaten.

DesiSpymaster commented 1 month ago

Could you format the output correctly with triple backticks?

See if this helps.

install_log error PyMuPDF.txt

EDIT: Updated with full log. From start to finish.

Grimler91 commented 1 month ago

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: __android_log_print

Seems like it needs -llog in LDFLAGS (or a patch so that it does not try to use android's logging facilities)

DesiSpymaster commented 1 month ago

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: __android_log_print

Seems like it needs -llog in LDFLAGS (or a patch so that it does not try to use android's logging facilities)

Noob here Mr. Grimler. How would that command look like?

Biswa96 commented 1 month ago

There is a pymupdf package request. I think that can be added in repository.

Grimler91 commented 1 month ago

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: __android_log_print

Seems like it needs -llog in LDFLAGS (or a patch so that it does not try to use android's logging facilities)

Noob here Mr. Grimler. How would that command look like?

Generally just export LDFLAGS=" -llog" before pip install pymupdf

DesiSpymaster commented 1 month ago

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: __android_log_print

Seems like it needs -llog in LDFLAGS (or a patch so that it does not try to use android's logging facilities)

Noob here Mr. Grimler. How would that command look like?

Generally just export LDFLAGS=" -llog" before pip install pymupdf

Ah, that one. I already did that. Was asking whether the patching stuff I'd have to do myself, too? And whether that's the reason for the main problem or just for helping with logs? Have no idea about how to patch things up. (BTW, I did update the original post with full error logs. Apparently termux couldn't accommodate so much of it on the console itself.

Hopefully these will help you better identify the source of these 7 errors and 3 and 20 warnings.)

Very grateful for all of you people's assistance.🙏