How can I run a GUI application over x11 from the command line

I want to debug a GUI application with GNU debug. If I try to start my application from the command line I get “Can’t open display”. I can successfully run my application from the desktop, but the debugger is a command line tool.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The simple/dirty way is to, as your user, run "xhost +’ before calling
the command to run the debugger. Give it a shot, and be sure your
firewall is blocking incoming traffic, and that nobody else you do not
trust is on your system. :slight_smile:

Good luck.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJQtPKNAAoJEF+XTK08PnB5l4IP/RnDhankRqPdPz1G8mhAsdCa
46E2YrrXzKHPptO5h7Sw7X22hknN7eaWSUsBCERWRbOEAu6K+BzzfT7uJTaxM1L5
WAOia9nbc9lMtktulnjbOu0Z316G3fyRqpy1Js3EIjsm3+wJKC0WPu2MbBlPq/h5
urE7UHcQgN4FZV79o8alJTH8THP1//uL4z9+hCIJ8bMHSWdZ5MO0mac+wnxiGajb
dH7alg8TD6MD0C1ZfzhDcHB2z9LApFhVL9EK5TO6vOGyQ7Gl4AycDnFw67cryOkD
qsh7Ysj9Kd23/LyFQcMtCSgtuNj+dbZXJDJnGCzUuACOSHBI3f/GKLfUTs9eiH2P
X4vNeV4ZlPSJBSeQQqcgiF5gGu5+54JRjk3enyvhvNWJyUyGVUmafbwKTYYGo1NG
efjdhsqtr1tlXIZUcuuwDv6rsmXFFeUxiFlDo8xE8vl51honNxf9A+MzcKtm0C8K
uYZ1BtuRRJuivqRydOSBFnK6fFpuLj+Q0Oe38ofzAXcYHFPc3HG+iJ3kT8zodqI4
r8Z+7x6YgSZun6NmkA1gEX3M6n32i4SbhXucdzfQy3jSAc5CoSBNQsSwg7XCwbJO
n3mAX0kkNGoWNLMHEeNhxFCyekZQ9+drcFbMUCunpJFnDURRRXzGp7AoCkc2kQFV
qb/KDyMMv2gCrw+v1YrN
=W9Lm
-----END PGP SIGNATURE-----

To be clear, are you working in a terminal window (xterm, konsole, …) or from console (eg. VT1, …) ? If the later, then the answer should be self evident – there is no X server, hence no X Display, hence the client application cannot open (as it doesn’t find a Display).

If you are working in the former, a terminal emulator, then further to what ab points out, you can try (for example, and assuming you are using :0.0) “DISPLAY=:0 application_name” or export the DISPLAY variable first.

If I debug a gui application with gdb from within an active X11 session
(for example by starting it from within konsole or xterm) I have never
in my life seen such a behavior that the display can’t be opened.
So I wonder what the OP is doing here.


PC: oS 12.2 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.5 | GTX 650 Ti
ThinkPad E320: oS 12.2 x86_64 | i3@2.30GHz | 8GB | KDE 4.9.3 | HD 3000
eCAFE 800: oS 11.4 i586 | AMD Geode LX 800@500MHz | 512MB | lamp server

On 11/27/2012 06:59 PM, Martin Helm wrote:
> So I wonder what the OP is doing here.

trying to launch the GUI app directly as root rather than using
kdesu/gnomesu, maybe…


dd

Many thanks - this does it.

Martin Helm wrote:
> If I debug a gui application with gdb from within an active X11 session
> (for example by starting it from within konsole or xterm) I have never
> in my life seen such a behavior that the display can’t be opened.
> So I wonder what the OP is doing here.

Agreed. It should not be necessary to do anything special. The OP is
doing something that he hasn’t told us, but then he hasn’t told us what
he is doing or what OS he uses or anything much. But he is happy, so
perhaps it is best to wait until he experiences another problem …