LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 07-28-2009, 06:35 PM   #1
usef62
Member
 
Registered: Dec 2006
Posts: 50

Rep: Reputation: 15
How To Make Portable Applications


Hello
How to compile a program (src) is as portable ?
Like vlc, kaffein, gimp...
 
Old 07-28-2009, 06:57 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by usef62 View Post
Hello
How to compile a program (src) is as portable ?
Like vlc, kaffein, gimp...
???

You need to use portable libraries and language constructs present in your compiler(s) of choice for all platforms. Ideally use standard C/C++, ideally C89 if it's "C" (i.e. ANSI "C"), though C99 appears to be well supported well.

Try not to use system-specific system calls and primitives, use stuff like "Boost" (C++) library to have these system-specific stuff abstracted away.
 
Old 07-29-2009, 05:26 AM   #3
usef62
Member
 
Registered: Dec 2006
Posts: 50

Original Poster
Rep: Reputation: 15
vlc in linux this is a compilation
./configure
make
make install

How do I compile with c99 as portable

thanks for answer
 
Old 07-29-2009, 05:56 AM   #4
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
Can you be a little more specific in what you mean by portable?
In your example, building vlc like that will succeed if you have the prerequisite libraries and headers installed... try compiling it on a bare bones, text-console only debian box and you'll see what I mean.
 
Old 07-29-2009, 07:11 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
put a handle on it?
maybe wheels if it's heavy.
 
Old 07-29-2009, 06:05 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by usef62 View Post
vlc in linux this is a compilation
./configure
make
make install

How do I compile with c99 as portable

thanks for answer
The "portable" word has a number of meanings.

One of them is portability across operating systems, another - (typically used in Windows world) independence from system libraries, the ability to run from any directory, no need of installation.

That second meaning is well reflected by "self contained".

So, what meaning do you have in mind ?
 
Old 07-30-2009, 05:48 AM   #7
usef62
Member
 
Registered: Dec 2006
Posts: 50

Original Poster
Rep: Reputation: 15
The second is to explain your
When compiled the program is installed in the root
and Program can not move, but I want to be installed anywhere and relocatable

thanks
 
Old 07-30-2009, 06:34 AM   #8
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
From your example above, what happens during the build of the executable is controlled by the MakeFile.

A simple compilation... gcc example.c -o example will output the executable in the current directory.

Some builds allow you to run as root or a limited user... in the latter case, they will install somewhere like /home/user/bin

You need to be a lot more detailed in what you are asking here. Provide examples and such. Sadly there are very few of us who transcend genius to godhood and as such have to rely upon standard methods of communication rather than psychic abilities.
 
  


Reply



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
List of standalone, portable linux applications mahdif Linux - Software 9 03-17-2009 04:11 AM
need a portable linux distro to bring on portable usb hard drive... pippo17 Linux - Distributions 3 10-20-2008 06:41 AM
LXer: How To Make Desktop Applications Start Automatically After Login (GNOME) LXer Syndicated Linux News 0 11-09-2007 05:11 PM
how can i make executables for java applications ? HalkEkmek Programming 8 02-19-2006 01:05 PM
$99 Fry's computer, can I make it run linux applications? sealmouth Linspire/Freespire 2 10-10-2004 09:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:52 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration