LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-11-2009, 09:29 AM   #1
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Rep: Reputation: 32
Question Making cross-environnment applications


*Linux Newbie Programmer here

I've been making applications for Windows and Mac and now it's time i start making apps for Linux. But here's the thing about Linux.. More than 1 Desktop Environment exist and so i'm wondering if the application that i will make will or will not work on all desktop environments (KDE, GNOME, Xfce etc.)

And what is the best tool to make applications for Linux? I've heard of KDevelop.. is it any good?

I'm using openSuSE 11 with KDE 4...
 
Old 02-11-2009, 09:32 AM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
KDE is based on the Qt libraries; GNOME and Xfce are based on GTK+. As long as the GTK+ and/or Qt libraries exist on the system, you can use the application, whatever your desktop environment or window manager choice be.
 
Old 02-11-2009, 10:26 AM   #3
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by indienick View Post
KDE is based on the Qt libraries; GNOME and Xfce are based on GTK+. As long as the GTK+ and/or Qt libraries exist on the system, you can use the application, whatever your desktop environment or window manager choice be.
That sounds very smart Now, if some linux newbie will install Ubuntu with GNOME and he will want to run my program wich needs Qt libraries and he doesn't know how to install them, will his ubuntu automatically install Qt libraries necessery to run my application?

It's just that i'm making applications with Qt toolkit and there is this one linux newbie using Ubuntu with GNOME and he doesn't know more than duble-clicking my application to open it
 
Old 02-11-2009, 11:16 AM   #4
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
I can't say for Ubuntu, but in Mandriva at least, the minimal GTK and QT packages are almost always installed, for such cases, and sometimes even the minimal Gnome and KDE packages.

And anyone not using Ubuntu or Mandriva (known to be newbie-friendly) surely knows at least how to use the package-manager.
Speaking of that, you may want to explore LSB, which should ease cross-distribution working.

Yves.
 
Old 02-11-2009, 11:27 AM   #5
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Hah - unfortunately, no. You could have a "starter" script which will act as the launch point for your program: it would check to see if there is a Qt package installed - if not, install it using "apt-get" or "aptitude", then it would run your program.

Checking if Qt is installed would be a one-liner, something easy like grepping a DPKG list, or something...sorry I cannot be more specific on how to do a non-interactive command-line test for Qt's existence on a Debian-based system.

Quote:
Originally Posted by theYinYeti
Speaking of that, you may want to explore LSB, which should ease cross-distribution working.
It would, supplying the distribution is LSB-compliant. As far as I know, it's Red Hat, Fedora, Debian and OpenSuSE. Mandriva too, I think. Slackware, for instance, is not LSB-compliant.

Last edited by indienick; 02-11-2009 at 11:30 AM.
 
Old 02-11-2009, 12:07 PM   #6
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Now, of course besides the mainstream GTK and QT, there are many other graphical toolkits / widgets out there: wxWidgets, fltk, etc. Search here for more:
http://freshmeat.net/browse/851/
http://freshmeat.net/browse/810/

Also keep in mind that there exist a (substantial) group of users who dislike GUIs (including me), so don't feel like you have to use these to make simple programs that do menial tasks. I know that's probably how it works in Window$.
 
Old 02-11-2009, 12:14 PM   #7
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
H_TeXMeX_H -

You wouldn't happen to know of any eye-candy-ish C/C++ GUI toolkits for DOS (that's right: MS-DOS, or ROM-DOS), would you?

TIA .. PSM

PS:
Quote:
GUIs make simple tasks easier...
... and difficult tasks utterly impossible
 
Old 02-11-2009, 12:24 PM   #8
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by QueenZ View Post
And what is the best tool to make applications for Linux? I've heard of KDevelop.. is it any good?
Any text editor + compiler + build tool.
For text editor you can use vim, jedit, emacs, etc. - they should be available on all 3 platforms.
For build tool you can use "gnu make", "gnu build tools"("autotools"), scons (www.scons.org), or qmake (part of Qt package, only for Qt-based applications). I'd recommend to use scons or qmake. There will be a problem with autotools on windows (you'll need MSys (www.mingw.org) or cygwin to build applications that use them), and although hand-written makefiles are quite portable, they might not be flexible enough for large projects.

There are probably other build systems, like "Jam" but I never used them.

If you really want IDE available on all platforms, then there should be eclipse, netbeans (haven't used it), anjuta and codeblocks. List of all ides is available on en.wikipedia.org.
 
Old 02-11-2009, 01:38 PM   #9
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
Another Question

So how does Firefox (for example) get it to be cross-environment? I mean it runs on GNOME and KDE and i have never installed GTK+ or Qt... how can i make something like that??
 
Old 02-11-2009, 02:09 PM   #10
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
GTK+ and Qt are probably already installed on your system given OpenSuSE usually installs both libraries anyways.

Also, Firefox is built in something called XULRunner.

As a side thought, I think it would be cool if there was a library out there that let you build a graphical application using generic classes or types, and then upon compiling, the user/administrator would decide whether they want to build it using Qt or GTK+ (or both with added -qt and -gtk suffixes?). Maybe something like this already exists...? It would cut down on a lot of re-writing and provide a nice layer/library for beginning programmers to use, in Linux, BSD and UNIX.
 
Old 02-11-2009, 03:01 PM   #11
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Indienick - I don't think Firefox is "built in XULRunner". Here's the link:

https://developer.mozilla.org/en/XULRunner

QueenZ - here's an example Firefox. It's running on Suse 9.3 (an admittedly old Firefox, running on an admittedly old version of Suse). As you can see from the "ldd" output (you can run the Linux command "ldd" on any executable to see what shared libraries it needs), this Firefox needs GTK runtime (and a ton of other stuff!) to work:
Quote:
cd /opt/MozillaFirefox/lib
ldd firefox-bin

linux-gate.so.1 => (0xffffe000)
libmozjs.so => /opt/MozillaFirefox/lib/libmozjs.so (0x40019000)
libxpcom.so => /opt/MozillaFirefox/lib/libxpcom.so (0x400a1000)
libxpcom_core.so => /opt/MozillaFirefox/lib/libxpcom_core.so (0x400a4000)
libplds4.so => /opt/MozillaFirefox/lib/libplds4.so (0x4014f000)
libplc4.so => /opt/MozillaFirefox/lib/libplc4.so (0x40152000)
libnspr4.so => /opt/MozillaFirefox/lib/libnspr4.so (0x40156000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4019d000)
libdl.so.2 => /lib/libdl.so.2 (0x401af000)
libgtk-x11-2.0.so.0 => /opt/gnome/lib/libgtk-x11-2.0.so.0 (0x401b3000)
libgdk-x11-2.0.so.0 => /opt/gnome/lib/libgdk-x11-2.0.so.0 (0x4047b000)
libatk-1.0.so.0 => /opt/gnome/lib/libatk-1.0.so.0 (0x404f6000)
libgdk_pixbuf-2.0.so.0 => /opt/gnome/lib/libgdk_pixbuf-2.0.so.0 (0x4050f
000)
libpangoxft-1.0.so.0 => /opt/gnome/lib/libpangoxft-1.0.so.0 (0x40524000)
libpangox-1.0.so.0 => /opt/gnome/lib/libpangox-1.0.so.0 (0x4052b000)
libpango-1.0.so.0 => /opt/gnome/lib/libpango-1.0.so.0 (0x40536000)
libgobject-2.0.so.0 => /opt/gnome/lib/libgobject-2.0.so.0 (0x4056e000)
libgmodule-2.0.so.0 => /opt/gnome/lib/libgmodule-2.0.so.0 (0x405a2000)
libglib-2.0.so.0 => /opt/gnome/lib/libglib-2.0.so.0 (0x405a6000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40627000)
libm.so.6 => /lib/tls/libm.so.6 (0x40723000)
libpng.so.3 => /usr/lib/libpng.so.3 (0x40746000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x40774000)
libsmime3.so => /opt/MozillaFirefox/lib/libsmime3.so (0x40793000)
libssl3.so => /opt/MozillaFirefox/lib/libssl3.so (0x407b1000)
libnss3.so => /opt/MozillaFirefox/lib/libnss3.so (0x407cf000)
libsoftokn3.so => /opt/MozillaFirefox/lib/libsoftokn3.so (0x4082a000)
libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x40887000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4088f000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x408fe000)
libxpcom_compat.so => /opt/MozillaFirefox/lib/libxpcom_compat.so (0x40951000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4096b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40a29000)
libc.so.6 => /lib/tls/libc.so.6 (0x40a31000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x40b4a000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x40b5d000)
libpangoft2-1.0.so.0 => /opt/gnome/lib/libpangoft2-1.0.so.0 (0x40b8b000)
/lib/ld-linux.so.2 (0x40000000)
libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x40bb2000)
libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40bb6000)
libXinerama.so.1 => /usr/X11R6/lib/libXinerama.so.1 (0x40bbe000)
libXfixes.so.3 => /usr/X11R6/lib/libXfixes.so.3 (0x40bc1000)
libXcursor.so.1 => /usr/X11R6/lib/libXcursor.so.1 (0x40bc6000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40bd0000)
libz.so.1 => /lib/libz.so.1 (0x40bde000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40bef000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40bf7000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x40c10000)
 
Old 02-11-2009, 03:16 PM   #12
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Quote:
Originally Posted by paulsm4 View Post
You wouldn't happen to know of any eye-candy-ish C/C++ GUI toolkits for DOS (that's right: MS-DOS, or ROM-DOS), would you?
Are you serious ? Well try some of these:
http://members.chello.at/theodor.lauppert/dos/gui.htm

Back to the OP, I forgot to mention an IDE to use. Well, you can use any, but I'd recommend at least that it have syntax highlighting. I use geany, but there are plenty more to choose from:
http://freshmeat.net/browse/65/
 
Old 02-11-2009, 04:47 PM   #13
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by QueenZ View Post
Another Question

So how does Firefox (for example) get it to be cross-environment? I mean it runs on GNOME and KDE and i have never installed GTK+ or Qt... how can i make something like that??
DOn't confuse ideas. Being able to compile software on multiple platforms is not the same thing as being able to install it without additional dependencies.
Firefox needs GTK and you have it installed. If you want to distribute application without too many external dependencies, either use static linking, or include dependencies into installer, or use only commonly used libraries (probably the hardest way).
 
Old 02-12-2009, 02:42 AM   #14
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
OK, so does it mean that if i don't have GTK+ libraries installed then i can't install Firefox??
 
Old 02-12-2009, 05:34 AM   #15
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by QueenZ View Post
OK, so does it mean that if i don't have GTK+ libraries installed then i can't install Firefox??
You can install it. But it won't work without GTK libraries. GTK libraries are very common, and it is very unlikely that you don't have them.

Last edited by ErV; 02-12-2009 at 05:36 AM.
 
  


Reply

Tags
desktops, kdevelop, programming


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The cross-platform option: Developing Web applications for smartphones LXer Syndicated Linux News 0 01-21-2009 08:20 AM
Cross Linux From Scratch 5.7: Problems Making binutils-2.18 Yaro Linux From Scratch 3 11-12-2008 04:00 AM
Developing cross platform applications Principher Programming 7 08-27-2006 02:35 PM
Cross-platform, the road to Linux applications wyo Linux - Software 9 12-27-2005 10:10 AM
Static Bind Applications to Kernel; cross compilation Alybyzrp Linux - Newbie 0 11-25-2003 02:38 PM


All times are GMT -5. The time now is 08:56 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration