import wx.xrc in wxFormBuilder code fails with file not found error

193 views
Skip to first unread message

André Colomb

unread,
Jan 31, 2018, 12:18:13 PM1/31/18
to wxPython-users
Hi there!

I've been lurking on IRC today after asking this question, so now reposting it here in hope of a non-real-time answer :-)


The "missing" libwx_gtk3u_html-3.0.so.0 library is actually right there, but even an `ldd _xrc.cpython-36m-x86_64-linux-gnu.so` marks it as not found. wxPython was built from wxPython-4.0.0rc1.dev3641+54837c1.tar.gz using pip3 install, as advised in the Phoenix installation howto.

After looking around with ldd and objdump, it seems like any indirect library dependencies are not found, while direct .so deps are found in the same directory as the _xrc.*.so OR in the current working directory. What strikes me is that after copying the .so files to the current directory (from where python3 was invoked), they are found by ldd as well as python3 itself.

Kind regards
André

Robin Dunn

unread,
Jan 31, 2018, 1:25:14 PM1/31/18
to wxpytho...@googlegroups.com
André Colomb wrote:
> Hi there!
>
> I've been lurking on IRC today after asking this question, so now
> reposting it here in hope of a non-real-time answer :-)

I saw your messages just a few minutes after you left the channel, so
you just needed to wait a little longer... :-)

>
> I'm hitting the same problem described on
> https://stackoverflow.com/questions/47270751/import-wx-xrc-in-wxformbuilder-code-fails-with-file-not-found-error
>
> The "missing" libwx_gtk3u_html-3.0.so.0 library is actually right
> there, but even an `ldd _xrc.cpython-36m-x86_64-linux-gnu.so` marks it
> as not found. wxPython was built from
> wxPython-4.0.0rc1.dev3641+54837c1.tar.gz using pip3 install, as
> advised in the Phoenix installation howto.
>
> After looking around with ldd and objdump, it seems like any indirect
> library dependencies are not found, while direct .so deps are found in
> the same directory as the _xrc.*.so OR in the current working
> directory. What strikes me is that after copying the .so files to the
> current directory (from where python3 was invoked), they are found by
> ldd as well as python3 itself.

The build sets LD_RUN_PATH=$ORIGIN while building wxWidgets and
wxPython. That should be setting the rpath in the binaries such that it
will look first in the same folder where the loading entity (the
extension modules in our case) is located. It works fine on my various
linux boxes, so maybe there is something on your system that is
disrupting that feature. Do you have any LD_* variables set in your
environment? Googling rpath, $ORIGIN, and your distro version may turn
up some additional details or hints. One thing that leaves me a bit
confused is why this happens when importing the _xrc extension, but not
the others.

If all else fails you should be able to set LD_LIBRARY_PATH to include
the wx package folder where the wx shared libs are located, or you can
try using the chrpath system tool to view and/or change the rpath
settings in the extension modules.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Robin Dunn

unread,
Jan 31, 2018, 5:34:25 PM1/31/18
to wxpytho...@googlegroups.com
Robin Dunn wrote:
> The build sets LD_RUN_PATH=$ORIGIN while building wxWidgets and
> wxPython.

André, I just noticed that LD_RUN_PATH is only being set for the wxPython part of the build, so there's a good chance that is the source of the problem although I don't understand why it wouldn't be happening for me too.

Please try rebuilding with the attached patch and see if it fixes the problem for you. To do this build you will need to start with the source tarball and not use pip for the build.

1. Unpack the source tarfile
2. Apply the patch to build.py
3. Run `python build.py build bdist_wheel`

That will give you a wheel file you can then install with pip in your Python environment or virtual environment.
use-origin-for-wx.patch

André Colomb

unread,
Feb 1, 2018, 4:03:56 AM2/1/18
to wxpytho...@googlegroups.com
Hi Robin!

Thanks for your quick response. I would have stayed longer on IRC, but
couldn't keep my family waiting at home any longer. Time zones, I'm in
Europe ;-)

On Wed, Jan 31, 2018 at 11:34 PM, Robin Dunn <ro...@alldunn.com> wrote:
> Please try rebuilding with the attached patch and see if it fixes the problem for you. To do this build you will need to start with the source tarball and not use pip for the build.

I can confirm that with your patch applied, the libraries are found
correctly. Now on to fixing other XRC-related errors in Phoenix...

If you don't mind, I'll answer the question on StackOverflow. Need to
earn reputation after just signing up over there for this issue.

By the way, congratulations for the 4.0.0 release! This patch will
then land in the first point release?

Kind regards
André
Reply all
Reply to author
Forward
0 new messages