Why do I need X11 libraries ?

Linux specific forum
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Why do I need X11 libraries ?

Post by infratec »

Hi,

I just wrote a console program which uses the PNG stuff to read and write pngs.
On my development PC it works perfect.

Than I copied it on the target PC (an apache web-server) and the trouble starts:

It does not run.

ldd shows me a lot of missing libs: libgtk libgdk libX.. and so on.

So I copied the missing libs.
Now ldd is lucky.

But...
when I try to start the program I get now: Gtk Warning: cannot open display

Why ???

It is a console program :!: (Also compiled as such)

Any hints ?
I can not install X on the server.

Bernd
User avatar
shadow
User
User
Posts: 34
Joined: Thu Dec 16, 2010 1:25 pm
Location: Germany

Re: Why do I need X11 libraries ?

Post by shadow »

Do you have selected the "console"-mode in compiler-settings of the project?
You can use the OpenConsole() functions in a GUI app without any windows...
ThinkPad T61 | PureBasic 4.51 | Windows 7 (32) | Kubuntu 11.10 (64) | Syllable (32)
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Why do I need X11 libraries ?

Post by infratec »

infratec wrote:It is a console program :!: (Also compiled as such)
:wink:
I have already written pure console programs with PB and they don't need such libs.
The only reason which maybe possible is, that the

UsePNGEncoder()
UsePNGDecoder()

stuff requires such libs.
But I don't know.

Bernd
User avatar
shadow
User
User
Posts: 34
Joined: Thu Dec 16, 2010 1:25 pm
Location: Germany

Re: Why do I need X11 libraries ?

Post by shadow »

:oops: ups

Yeah, I think you're right. I assume that image handling functionality comes from GTK, too.
ThinkPad T61 | PureBasic 4.51 | Windows 7 (32) | Kubuntu 11.10 (64) | Syllable (32)
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Re: Why do I need X11 libraries ?

Post by remi_meier »

It is exactly as you assumed: The GTK/GDK libs need
a display. Why? I'm not sure...

"Solutions:"
If you only run the program over ssh, you might just
need to add the "-X" option to ssh.

Otherwise you can install Xvfb, which is a simple
X server running in memory (does not need a display).
Athlon64 3700+, 1024MB Ram, Radeon X1600
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Why do I need X11 libraries ?

Post by infratec »

Yes, I installed Xvfb

and use xvfb-run to start the program.
Very ugly.

Bernd
Post Reply