Error loading wxWidgets shared libraries on Debian 10

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
jgoodchild
Earned a small fee
Earned a small fee
Posts: 20
Joined: Thu Jul 28, 2016 9:09 am

Error loading wxWidgets shared libraries on Debian 10

Post by jgoodchild » Mon May 24, 2021 3:11 pm

We have an application that was originally developed about 10 years ago, based on wxWidgets version 2.8, running under Debian 6 on a 32-bit platform. Nearly 5 years ago, shortly after I joined the company, we moved to a 64-bit platform, running Debian 8.3, and updated to wxWidgets version 3.0.2.

We have now decided it is time to produce a version of our application to run under Debian 10.

I have done the following:
- downloaded the sources for wxWidgets v3.0.5
- extracted the files into my home folder, in the sub-directory "wx", so the path is $home/wx/wxWidgets-3.0.5
- created a build sub-directory within the wxWidgets-3.0.5 directory, namely wxbld
- from wxbld, I ran:

../configure --enable-unicode
make
make install
cd samples
make

All of these built successfully, and I was able to run the samples successfully.

I then tried building our application from within the Eclipse IDE.

The compiler settings include: `wx-config --cxxflags` -O3 -Wall
The linker settings include: ``wx-config --libs --unicode=yes` `wx-config --gl-libs`

The application built successfully. When I tried to run it, however, I got the following error:

: error while loading shared libraries: libwx_gtk3u_xrc-3.0.so.0: cannot open shared object file: No such file or directory

I have checked that the libraries are present in /usr/local/lib and that they all have executable privilege. And I therefore mystified as to what could be wrong, although presumably there must be a fundamental difference in my build settings in comparison with those of the samples. Or maybe the samples don’t actually use the shared libraries?

Any clues gratefully received!

DavidHart
Site Admin
Site Admin
Posts: 4063
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Error loading wxWidgets shared libraries on Debian 10

Post by DavidHart » Mon May 24, 2021 3:28 pm

Hi,
The application built successfully. When I tried to run it, however, I got the following error:
: error while loading shared libraries: libwx_gtk3u_xrc-3.0.so.0: cannot open shared object file: No such file or directory
There was a change to wx-config in wx3. You now need e.g. `wx-config --libs std,xrc`.
Or maybe the samples don’t actually use the shared libraries?
The samples get correctly configured when you build the wx source.

Regards,

David

jgoodchild
Earned a small fee
Earned a small fee
Posts: 20
Joined: Thu Jul 28, 2016 9:09 am

Re: Error loading wxWidgets shared libraries on Debian 10

Post by jgoodchild » Mon Jun 07, 2021 9:57 am

Unfortunately changing the linker options to use `wx-config --libs std,xrc` didn't work, and neither did `wx-config --libs all`. In a way, that wasn't particularly surprising, because I was already building my application successfully with wxWidgets 3 on Debian 8.

Instead, it turned out that the problem was with ldconfig. I resolved the issue by running (as the superuser):

/sbin/ldconfig -v

I got this tip from the following page on the web:

https://itsfoss.com/solve-open-shared-o ... quick-tip/

Thanks very much for the rapid assistance, nevertheless!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5224
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Error loading wxWidgets shared libraries on Debian 10

Post by ONEEYEMAN » Mon Jun 07, 2021 12:05 pm

Hi,
Out of curiosity - is there areason you use -O3 when building?
It is known to cause problems...

Thank you.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 467
Joined: Fri Nov 03, 2006 2:00 pm

Re: Error loading wxWidgets shared libraries on Debian 10

Post by stahta01 » Mon Jun 07, 2021 2:04 pm

ONEEYEMAN wrote:
Mon Jun 07, 2021 12:05 pm
Hi,
Out of curiosity - is there areason you use -O3 when building?
It is known to cause problems...

Thank you.
I thought that was just on Windows? Is it on Linux, also?

Tim S.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5224
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Error loading wxWidgets shared libraries on Debian 10

Post by ONEEYEMAN » Mon Jun 07, 2021 2:53 pm

@Tim,
Still -O3 loks a little weird...

Thank you.

jgoodchild
Earned a small fee
Earned a small fee
Posts: 20
Joined: Thu Jul 28, 2016 9:09 am

Re: Error loading wxWidgets shared libraries on Debian 10

Post by jgoodchild » Tue Jun 08, 2021 11:54 am

ONEEYEMAN wrote:
Mon Jun 07, 2021 12:05 pm
Out of curiosity - is there a reason you use -O3 when building?
That is a very good question to which I do not have an adequate answer!

Thanks for the tip - I will try without it...

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5224
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Error loading wxWidgets shared libraries on Debian 10

Post by ONEEYEMAN » Tue Jun 08, 2021 12:23 pm

Hi,
The best option is usually -O2 (or -Os to optimize for speed).
But you need to recompile wxWidgets and any other library you are using with new optimization option. And then your application.

Thank you.

Post Reply