LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2010, 10:50 PM   #1
marksimmonds
LQ Newbie
 
Registered: Oct 2010
Location: melbourne australia
Posts: 4

Rep: Reputation: 0
help with compiling programs


Hi,

I'm trying to get my head around compiling programs, and need some things clarified.

can anyone confirm or deny my understanding so far:

1) program is written in high level language, such as C. File(s) of the program are the 'source code'.
2) program is then 'compiled' to turn it into low-level code that is both hardware - ie Intel/AMD/ARM processor specific, and also Linux distribution specific. This resulting files are called the binaries.
3) i can go from source code to installed and usable program by doing these steps:
./configure
make
make install

Thanks for helping!! Simmo.
 
Old 10-19-2010, 11:13 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,254

Rep: Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686
1) program is written in high level language, such as C. File(s) of the program are the 'source code'.

Yes but you could also have header and or makefiles to help compilation

2) program is then 'compiled' to turn it into low-level code that is both hardware - ie Intel/AMD/ARM processor specific, and also Linux distribution specific. This resulting files are called the binaries.

Depending on the options you pass to compiler, but generally yes you end up with an executable

What do you mean by the following:
Quote:
also Linux distribution specific
If I compile a program on Ubuntu or Gentoo the resulting executable will be the same (as far as I am aware)

3) i can go from source code to installed and usable program by doing these steps:
./configure
make
make install

Yes these basic steps will produce an executable but other supplementary steps may be required / suggested,

ie. you may have to patch some files to get it to work how you wish or for your architecture, etc
 
Old 10-20-2010, 12:52 AM   #3
marksimmonds
LQ Newbie
 
Registered: Oct 2010
Location: melbourne australia
Posts: 4

Original Poster
Rep: Reputation: 0
thanks so far.

By Linux Distribution i was thinking of KDE / Debian / BSD as so on.


Quote:
Yes these basic steps will produce an executable but other supplementary steps may be required / suggested,
How will I know?!!!

Cheers, Simmo.
 
Old 10-20-2010, 05:51 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,254

Rep: Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686
KDE - is a desktop environment, not a distribution

Debian v BSD - again just different flavours of Unix, so I believe executables should be the same

Maybe you are confusing architecture with distribution, ie SPARC, i386, x86_64, PPC
Quote:
How will I know?!!!
Generally the site where you get the source from will let you know what extras are required.
 
Old 10-20-2010, 06:55 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
@grail:
"distribution specific": The generated binary depends most times on different libraries. If you use Ubuntu, the binary has not to be compatible with Debian or Gentoo, because of different versions of libraries and maybe distribution specific patches in the libraries and different compiler options.

"Debian and BSD": They have different kernels (Linux and BSD-Kernel), so any application that is using the kernel will not run on the other kernel, it has to be recompiled/patched.
 
1 members found this post helpful.
Old 10-20-2010, 08:39 AM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,254

Rep: Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686
Thanks for the info Tobi Always happy to be corrected.
 
Old 10-20-2010, 09:58 AM   #7
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid
Posts: 4,734
Blog Entries: 12

Rep: Reputation: 461Reputation: 461Reputation: 461Reputation: 461Reputation: 461
From the first 2 pages of a Google search using: Compiling from source Linux

Compiling Programs from Source - LinuxQuestions.org
http://www.linuxquestions.org/linux/...ms_from_Source

How To Compile Linux Software With Debian Linux
http://www.aboutdebian.com/compile.htm

This one covers several distros
How To Install Software in Linux - Linux Forums
http://www.linuxforums.org/forum/lin...are-linux.html

Includes reason why to compile and reasons not to compile
How-To: Compile Programs From Source in Linux | Maximum PC
http://www.maximumpc.com/article/how...m_source_linux

Use the Source, Luke: Compiling and installing from source code LG #49
http://tldp.org/LDP/LG/issue49/lamb.html

remember Google or whatever search engine you prefer can be your best friend.
 
  


Reply


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
I need help with compiling my C++ programs. bitessy Programming 3 02-23-2004 07:07 PM
Compiling Programs mike35 Linux - Newbie 2 10-22-2003 10:39 AM
compiling programs disorderly Linux - Newbie 2 10-17-2003 01:48 PM
compiling c,c++ programs ksd Linux - Newbie 9 10-13-2003 09:23 AM
Compiling Programs Jabber63 Linux - Software 3 08-06-2003 03:58 AM


All times are GMT -5. The time now is 08:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration