'Cannot load __log_finite from libm.so.6 with ctypes
I'm trying to load the function __log_finite from libm.so.6 using ctypes.
If I run nm on the library I can see that the symbol refers to an indirect function (https://sourceware.org/binutils/docs/binutils/nm.html).
nm -gD libm.so.6 | grep __log_finite
000000000002c520 i __log_finite
When I try to load this function with ctypes from python I get an error that suggests that the symbol is not defined:
import ctypes
lib = types.CDLL("/usr/lib/x86_64-linux-gnu/libm.so.6")
func = lib.__log_finite
raises:
AttributeError: /usr/lib/x86_64-linux-gnu/libm.so.6: undefined symbol: __log_finite
If I try to load any other non-indirect function, I do not get this error:
nm -gD libm.so.6 | grep roundevenl
000000000001cc20 W roundevenl
func = lib.roundevenl
print(func)
outputs
<_FuncPtr object at 0x7fbea6820400>
I'm wondering what is going on here and the reason for this behavior. Is this related to __log_finite or to all the indirect functions?
NOTE: this issue does not seem related to the indirect function but to the finite suffix: I'm not able to load any *_finite function (e.g., __acos_finite, __expf_finite...)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
