You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using WeeChat 1.1.1, compiled on CentOS 6 against a manually compiled Python 2.7 (because CentOS 6 only has Python 2.6), I've stumbled upon this problem loading the python.so plugin:
Error: unable to load plugin "/package/host/localhost/weechat-1.1.1/lib/weechat/plugins/python.so": /package/host/localhost/weechat-1.1.1/lib/weechat/plugins/python.so: undefined symbol: forkpty
ldd provides the following linker information on python.so:
The undefined symbol: forkpty is a result of python.so not being linked to libutil.so. I could quickly verify that starting WeeChat like this ...
$ LD_PRELOAD=/lib64/libutil.so.1 weechat
... effectively fixed the problem. That was amazingly hard to debug because as soon as another plugin that correctly links to libutil.so - like, e.g., the perl.so plugin - is loaded before the python.so plugin, the problem silently disappears. This left me with the weird situation that exactly the same binaries, used on two identically installed CentOS 6 hosts, provided different results, based on the order of plugins in the plugins folder as provided by the underlying filesystem.
I have found out that cmake/FindPython.cmake uses this code to create the list of libraries to link python.so against:
I'm not pretty sure if that's the correct way to do it. The section Compiling and Linking under Unix-like systems of the official Python 2 docs states that one is expected to use the pythonX.Y-config script to find out which linker flags have to be used to compile against Python. These flags correctly include -lutil:
The Python docs admit, however, that the pythonX.Y-config procedure is "not guaranteed to work for all Unix-like platforms" and also references LINKFORSHARED as an alternative way, but combines it together with the value of LIBS (which does provides -ldl -lutil). So ... for now I'm solving the problem by explicitly adding the LIBS value to the code generation:
Using WeeChat 1.1.1, compiled on CentOS 6 against a manually compiled Python 2.7 (because CentOS 6 only has Python 2.6), I've stumbled upon this problem loading the python.so plugin:
ldd
provides the following linker information onpython.so
:The
undefined symbol: forkpty
is a result ofpython.so
not being linked tolibutil.so
. I could quickly verify that starting WeeChat like this ...... effectively fixed the problem. That was amazingly hard to debug because as soon as another plugin that correctly links to
libutil.so
- like, e.g., theperl.so
plugin - is loaded before thepython.so
plugin, the problem silently disappears. This left me with the weird situation that exactly the same binaries, used on two identically installed CentOS 6 hosts, provided different results, based on the order of plugins in theplugins
folder as provided by the underlying filesystem.I have found out that
cmake/FindPython.cmake
uses this code to create the list of libraries to linkpython.so
against:I'm not pretty sure if that's the correct way to do it. The section Compiling and Linking under Unix-like systems of the official Python 2 docs states that one is expected to use the
pythonX.Y-config
script to find out which linker flags have to be used to compile against Python. These flags correctly include-lutil
:In contrast, the
LINKFORSHARED
variable from thesysconfig
module doesn't:The Python docs admit, however, that the
pythonX.Y-config
procedure is "not guaranteed to work for all Unix-like platforms" and also referencesLINKFORSHARED
as an alternative way, but combines it together with the value ofLIBS
(which does provides-ldl -lutil
). So ... for now I'm solving the problem by explicitly adding theLIBS
value to the code generation:I'd be happy if somebody with better compiler knowledge could review this and possibly fix it in the code base.
The text was updated successfully, but these errors were encountered: