-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
The select and time modules uses libm functions without linking against it #65867
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
Comments
The select and time modules use functions from libm, but do not link against it.
|
Note: This causes problems at least when running on android, where the system is unable to find the symbols when loading the modules at runtime. |
Additionally,
Patch attached. |
+ libraries=['m']) Why not using math_libs here? It would also be nice to add a comment explaining why libm is needed in each module. Can someone please combine both patches? |
math_libs is defined in detect_modules(). But the _ctypes_test The other option, would be to define math_libs=['m'] directly above this line and then use it once. I didn't think that added clarity, but I'd be happy to do it that way if it fits better with standard style.
Done.
Done. |
Bump. For rev c6930661599b timemodule.c and selectmodule.c no longer calls libm functions, while audioop.c and _ctypes_test.c still do. I have my updated patch here based on previous patches. Note that the introduction of detect_math_libs() is my naive try. Its naming and position in setup.py may need more consideration. Here's the result before and after my patch. Before:
shell@GT-N7000:/data/local/tmp $ python3
Python 3.6.0a0 (default:6a8fbb97c8d8+, Nov 26 2015, 18:42:29)
[GCC 4.9 20140827 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import select
>>> import time
>>> import audioop
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen failed: cannot locate symbol "floor" referenced by "audioop.cpython-36m-arm-linux-gnueabi.so"...
>>> import _ctypes_test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen failed: cannot locate symbol "sqrt" referenced by "_ctypes_test.cpython-36m-arm-linux-gnueabi.so"...
>>> After: shell@GT-N7000:/data/local/tmp $ python3
Python 3.6.0a0 (default:c6930661599b+, Nov 26 2015, 19:10:15)
[GCC 4.9 20140827 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> import selectr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'selectr'
>>> import select
>>> import audioop
>>> import _ctypes_test
>>> Tested on Samsung Galaxy Note GT-N7000 with my custom build of CyanogenMod 11.0 |
Well, the hg revision of Python in two tests are different, because I |
The _datetime module also calls functions in libm: delta_new() uses The attached patch updates setup.py for all the modules that use libm. |
The approach with a helper function is better. See https://github.com/yan12125/python3-android/blob/038271d/mk/python/modules-link-libm.patch. By the way, I have verified there are no libraries referencing libm functions with https://github.com/yan12125/python3-android/blob/cpython-hg/devscripts/import_all.py |
New changeset f92fea23161d by Victor Stinner in branch '3.5': New changeset 3a9b47b062b9 by Victor Stinner in branch 'default': |
I pushed ext_modules_libm.patch with the helper function proposed by Chi Hsuan Yen in https://github.com/yan12125/python3-android/blob/038271d/mk/python/modules-link-libm.patch. Tell me if it's not enough. I hope that it will make CPython a little bit more portable ;-) |
The patch should be acknowledged in Misc/NEWS to Chi Hsuan Yen and not to me. |
New changeset f76753f26982 by Victor Stinner in branch 'default': |
New changeset 7530caa5ed1a by Victor Stinner in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: