Problem executing wxWidgets application Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
BobS0327
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed May 10, 2006 3:51 pm

Problem executing wxWidgets application

Post by BobS0327 »

My environment consists of the following:

wxWidgets 2.6.3
GCC 4.1.0
Fedora Core 5

The following does not generate any errors:

g++ test.cpp `wx-config --libs --cxxflags` -o testit

But when I execute testit, I get the following message:

./testit: error while loading shared libraries: libw_gtk2_xrc-2.6.so.0:
Cannot open shared object file: No such file or directory

An awkward resolution is to execute the app is as follows:

LD_LIBRARY_PATH=/usr/local/lib ./testit

Can anybody provide a better solution than listing the environment variable on the command line with the executable?

Finally, this app will be distributed to other users. So, I have to make the execution of this app as "user friendly" as possible.

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

Post by DavidHart »

Hi,

I delayed replying, hoping that you'd get an answer from someone who had make-installed Fedora Core 5 themselves. Still here goes:

Did you install wxWidgets from a tarball, or did it come with Fedora? If a tarball, was there anything unusual about how you configured it? Is this the only wxWidgets on the system, or is there an earlier version too? Are the libs actually in /usr/local/lib? (Presumably they are, or LD_LIBRARY_PATH wouldn't have worked, but a quick ls /usr/local/lib/libwx_* would confirm.)

Lastly, and most likely to help, what is the output of wx-config --libs, done from the directory in which you build testit?
Finally, this app will be distributed to other users. So, I have to make the execution of this app as "user friendly" as possible.
Hmm. Unless you are sure that all your users will be running Fedora Core 5, you will in any event need to do something more system-independent, such as Bakefiles/Automount :( .

Regards,

David
BobS0327
Knows some wx things
Knows some wx things
Posts: 27
Joined: Wed May 10, 2006 3:51 pm

Post by BobS0327 »

First of all, I just want to say that I'm a Linux newbie in general and a wxWidgets newbie in particular. I'm a windows programmer making the transition to Linux.

I've installed wxWidgets-2.6.3 from a tarball. It was a standard install. I didn't do any custom configuration.

wxWidgets-2.6.3 is the only version installed.

I did verify using the ls command that the libs are actually in /usr/local/lib

The output from wx-config --libs is:
-L/usr/local/ib
-pthread
-lwx_gtk2_src-2.6 -lwx_gtk2_qa-2.6 -lwx_gtk2_html-2.6
-lwx_gtk2_adv-2.6 -lwx_gtk2_core-2.6 -lwx_base_xml-2.6
-lwx_base_net-2.6 -lwx_base-2.6

Finally, can you direct me to some documentation, tutorials, examples etc on how to use Bakefiles/Automount?

Thanx for all your help!!!
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

I presume that -lwx_gtk2_src-2.6 is a typo for -lwx_gtk2_xrc-2.6, in which case your output is equivalent to mine (except mine is debug: if I were you I'd use --enable-debug next time you compile; it makes debugging much easier). So I've no idea why you're having this problem. EDIT: A late thought. Try running (as root) ldconfig again, in case it didn't 'take' the first time.
As a different short-term fix, you could try adding -L/usr/local/ib to your g++ command, or failing that -lwx_gtk2_xrc-2.6.

I'd postpone looking at Bakefiles/Automount yet, as they take a little getting used to. The <a href="http://www.linuxselfhelp.com/gnu/autoco ... >Automount manual</a> is markedly obscure, but I don't know of anything better. Note the tentative tone of my attempt at an <a href="http://forums.wxwidgets.org/viewtopic.p ... t/Bakefile howto</a>. <a href="http://bakefile.sourceforge.net">Bakefiles</a> are an underdocumented work-in-progress, and I have so far failed to get 0.2.0 to work with wxGTK-2.6.3 :(
chris
I live to help wx-kind
I live to help wx-kind
Posts: 150
Joined: Fri Oct 08, 2004 2:05 pm
Location: Europe

Post by chris »

This seems to be a problem with executing, not compiling, if I read correctly.
It looks like /usr/local/lib - where the wx libraries are installed to - isn't in the library search path of fc5. Try adding the line "/usr/local/lib" (without quotes) to /etc/ld.so.conf (that file is a list of all the additional library search paths) and then run ldconfig (must be root to do that).
Afterwards you should be able to run the executable without an additional LD_LIBRARY_PATH.

Alternatively you could re-configure wx with /usr/lib as wanted library path:
./configure --prefix=/usr/ --exec-prefix=/usr/
make
make install
I would recommend just tweaking your /etc/ld.so.conf, because that way the chance of wx colliding with an offical fc package is lower. It's a way "cleaner" method.

Chris
this->signature=NULL;
Post Reply