Symbol is not found

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
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3514
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Symbol is not found

Post by ONEEYEMAN » Sun Oct 20, 2019 5:43 am

Hi, ALL,
I just tried to add a new dynamic library (.so) to my project.
Everything compiles but during the runtime I'm getting an error as in the screenshot.

I tried to do nm, and here is the output:

Code: Select all

[email protected] /usr/local/lib64 $ nm libmisc.so |grep StyleBar
000000000000b44a T _ZN8StyleBarC1EP8wxWindowi
000000000000b44a T _ZN8StyleBarC2EP8wxWindowi
                 U _ZTV8StyleBar
I declared this in the code as:

Code: Select all

class WXEXPORT StyleBar: public wxToolBar 
{
public:
    StyleBar(wxWindow *parent, int painter);
    ~StyleBar();
protected:

private:
    wxTextCtrl *m_fieldText;
};
What am I missing?

In case it matters - I am building against GTK3 on Linux with gcc 5.4 (c++11).

Thank you.
Attachments
Screenshot from 2019-10-20 00-35-41.png
Screenshot from 2019-10-20 00-35-41.png (9.58 KiB) Viewed 166 times

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

Re: Symbol is not found

Post by DavidHart » Sun Oct 20, 2019 9:24 am

Hi,
I just tried to add a new dynamic library (.so) to my project.
I presume that, by 'dynamic', you mean a non-static library, not one dynamically loaded by dlopen().

If so, then your problem is almost certainly caused by /usr/local/lib64 not being in your runtime library search path. You can prove that by trying:
LD_LIBRARY_PATH=/usr/local/lib64 /path/to/myprogram

Various longer-term solutions:
1) If this is a program for your personal use, add
export LD_LIBRARY_PATH=/usr/local/lib64
to your ~/.bashrc
2) If it is for several people, add that dir to the program's rpath: see e.g. https://dwheeler.com/program-library/Pr ... O/x36.html. Actually, see that link anyway.
3) If it is for distribution, don't use /usr/local/.

Regards,

David

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

Re: Symbol is not found

Post by ONEEYEMAN » Sun Oct 20, 2019 2:54 pm

Hi, David,
DavidHart wrote:
Sun Oct 20, 2019 9:24 am
Hi,
I just tried to add a new dynamic library (.so) to my project.
I presume that, by 'dynamic', you mean a non-static library, not one dynamically loaded by dlopen().
Correct.
DavidHart wrote:
Sun Oct 20, 2019 9:24 am
If so, then your problem is almost certainly caused by /usr/local/lib64 not being in your runtime library search path. You can prove that by trying:
LD_LIBRARY_PATH=/usr/local/lib64 /path/to/myprogram
No, it is not. By many reasons.
1. If that was the cause, then the library wouldn't be found. Instead the library is found, but for some reason the linker can't find the symbol.
2. I did run "ldconfig" in that directory, which should update LD_LIBRARY_PATH directory.
3. I just tried to run this command and got exactly the same failure.
DavidHart wrote:
Sun Oct 20, 2019 9:24 am
Various longer-term solutions:
1) If this is a program for your personal use, add
export LD_LIBRARY_PATH=/usr/local/lib64
to your ~/.bashrc
2) If it is for several people, add that dir to the program's rpath: see e.g. https://dwheeler.com/program-library/Pr ... O/x36.html. Actually, see that link anyway.
3) If it is for distribution, don't use /usr/local/.

Regards,

David

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

Re: Symbol is not found

Post by DavidHart » Sun Oct 20, 2019 7:27 pm

Fair enough. In that case this is outside my experience.

However googling for 'linux "undefined symbol" runtime' results in lots of hits e.g. this, and this (do you define a StyleBar in your program?). If those two don't help you, there are lots of others.

Post Reply