How to link statically with X11 Topic is solved

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
tuanphan
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Feb 01, 2007 3:56 am
Location: Viet Nam
Contact:

How to link statically with X11

Post by tuanphan »

Dear all my brothers/sisters!

I am new in Linux programming. I wrote a program using wxGTK-2.8. I built my program on my PC (using Fedora Core 4) and it ran OK. But, when I copied it to other Linux PC (RedHat 9) it couldn't run. It showed an error "can't open dynamic library wit X11". I tried to build wxGTK as static library but the problem didn't solve yet. So I think I must build wxGTK as static library and link statically with X11 library. I take a lot time but I am not success.

Please share me your ideas and experiences wit wxWidget or others on LINUX Platform.
Please bring me out the bog!
Thanks for your help
Tuan Phan
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Hi,

you CAN'T link statically to X11 (or, if it is possible, you don't want that)
X11 is supposed to be installed on all linux distros. Though it is most often the right choice to build wxWidgets static

you told the error message that appears when linking against dynamic wxGTK - but what happens when linking against static wxGTK?
tuanphan
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Feb 01, 2007 3:56 am
Location: Viet Nam
Contact:

Post by tuanphan »

Hi,
Firstly, I thank you for replying me.

I already built wxGTK as static library but the libs still link dynamic with X11(the libs end up with *.a and I checked some X11 function in the libs with nm command). When I copy it to other LINUX PC it can't run. I think maybe the error is caused by different X11 version or name of X11 libs. I know I don't want and I shouldn't link statically with X11 but I think I must find a way to change libtool or something else in my program to regconize X11 libs at most of Linux distros. I am very happy to have your advice about the problem and others.

Thank you very much!
Tuan Phan
Tuan Phan
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi,

Just about the only bad thing about linux is that each distro is different; you can't assume that names and locations that apply to one will also apply to others, It's likely that the X11 libs are stored in a different place in RedHat9 to FC4, so a makefile that works on one will fail on the other, and so will a statically-compiled wxWidgets app.

How did you install wxWidgets on each machine? And how do you build your app --- a home-made makefile? bakefile/autoconf? g++ plus wx-config?...

What you should be doing is to install wxWidgets properly on each machine, and then build your app properly using that wxWidgets build.

Regards,

David
Post Reply