Page 1 of 1

Problem executing wxWidgets application

Posted: Thu May 18, 2006 11:48 am
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:
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.


Posted: Fri May 19, 2006 11:17 am
by DavidHart

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 :( .



Posted: Fri May 19, 2006 10:54 pm
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:
-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!!!

Posted: Sat May 20, 2006 2:35 pm
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=" ... >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=" ... t/Bakefile howto</a>. <a href="">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 :(

Posted: Tue May 23, 2006 10:35 am
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/ (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 install
I would recommend just tweaking your /etc/, because that way the chance of wx colliding with an offical fc package is lower. It's a way "cleaner" method.