-
Compiling?
I've seen it used a million times but I really haven't got a clue what it means to Compile something.... out of all the books I've read I've been told to compile this or that... but I've never been told HOW to go about this compiling business...
Since this has the potential to take up pages in order to explain, I'd appreciate a link to a page that might shed a little light on this subject or perhaps this has been directed to an earlier post on the subject.
Thanks!
-Jameson
-
Administrator
Site Admin-
Re: Compiling?
Originally Posted by
Jameson
I've seen it used a million times but I really haven't got a clue what it means to Compile something....
This is way too broad of a subject for this forum. I'll give you a quick answer but understand that it will only scratch the surface. There is, however, plenty of information on the Internet that you can read once you get the basic comcept.
Not sure what all the book you read were, but this is covered pretty well in many of the books I've read.
In a nutshell (and simplifying things somewhat) there are two basic ways that computer languages work. Some languages are "interpreted" and some are "compiled". If a computer runs something written in an interpreted language (such as a DOS .bat file), it reads each line of the program and figures out what to do for that line and does it. The program stays in the form of a text file. For a compiled language (C, for example is almost always compiled) the computer translates the human readable text file into the computers own "op codes". These "op codes" can be run much faster than the computer trying to figure out what the human readable text file instructions are, at the small cost of the extra step or steps of the translation. What it means to compile is to run a program that takes the source program and do this translation (actually, the first step of the translation, there is usually also at least one more step, called "linking" that takes the output of the compiler and produces the final runnable .exe file.
There are many compilers for different languages. There are even many different compilers for the C language in Linux. One of these is evoked by the command cc at a shell prompt. A good place to start would be the man page for cc or maybe this webpage.
Obviously (at least I hope it's obvious), teaching you how to program in C or any other language is way beyond what we do in this forum.
-
Senior Member
registered user
Since this has the potential to take up pages in order to explain
No, it is very simple. Every driver or anything have some text file: "redme.1st" or something like that, and in this file you can see how to compile this driver: "Do that, do this, use this command..." and so on.
The basic form of a driver is in source code. This is good for every Linux, but you must prepare it - "compile" - for it. If somebody did it for you, than this is binary driver.
This is the general idea. Here is one example (not the best I am afraid):
(Name of the file is Readme.txt, and you get it after downloading and extracting file ltmodem-knoppix-2.4.27.tar.gz from http://linmodems.technion.ac.il/pack...modem/Knoppix/)
To do the modem driver compile, it was necessary to
1) copy /usr/src/linux-2.4.27 to a hard drive partition with a Linux distro
2) set /usr/bin/gcc --> /usr/bin/gcc-2.95
because the 2.4.27 kernel was compiled with a compiler gcc version 2.95.4
-------
cat /proc/version
Linux version 2.4.27 (root-Koffer) (gcc version 2.95.4 20011002 (Debian
prerelease)) 2 SMP Mo Aug 9 00:39:37 CEST 2004
shows that the kernel+modulQ- were compiled with gcc version 2.95.4
------------
while the burnt into the Knoppix CD is:
root-ttyp1[knoppix] ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root 7 Jul 27 18:48 /usr/bin/gcc -> gcc-3.3
-rwxr-xr-x 1 root root 69960 Mar 10 2004 /usr/bin/gcc-2.95
-rwxr-xr-x 1 root root 85772 Aug 14 19:50 /usr/bin/gcc-3.3
lrwxrwxrwx 1 root root 10 Jul 27 18:48 /usr/bin/gccbug -> gccbug-3.3
-rwxr-xr-x 1 root root 16033 Aug 14 19:44 /usr/bin/gccbug-3.3
without any way to reset to gcc --> gcc-2.95
The ltmodem-8.26a.tar.gz was the resource for the compile.
The core of the compile looks like:
To begin compilation of lt_modem.o and lt_serial
................................... (I cut it here, tdjokic)
-
Senior Member
registered user
-
Ah many thanks to all! I've starting to grasp it, for some reason I just thought there was a good bit more to it...
-Jameson
-
Senior Member
registered user
--There is, when you get _errors_ during the compile.
--Fortunately for you though, most of the things you can compile in Linux are error-free.
Originally Posted by
Jameson
Ah many thanks to all! I've starting to grasp it, for some reason I just thought there was a good bit more to it...
-Jameson
-
Administrator
Site Admin-
Originally Posted by
Jameson
Ah many thanks to all! I've starting to grasp it, for some reason I just thought there was a good bit more to it...
In some ways there is a lot more to it, in many ways the key information is available above. Underscore gave you some great links.
There are certainly many things we didn't cover (linkers, debuggers, assemblers, languages that are a combination of interpreting and compiling, development enviroments, macros, and plenty more). But you got a basic answer to what you asked and it should be a good place for you to start.
Let us know how your research works out for you.
Similar Threads
-
By redss in forum General Support
Replies: 4
Last Post: 05-11-2005, 09:19 PM
-
By Kowood in forum MS Windows & New to Linux
Replies: 1
Last Post: 04-17-2005, 10:44 AM
-
By Yuanlong in forum General Support
Replies: 15
Last Post: 08-03-2004, 11:01 AM
-
By Liquidant in forum General Support
Replies: 2
Last Post: 05-26-2004, 06:34 PM
-
By m_yates in forum Hdd Install / Debian / Apt
Replies: 0
Last Post: 10-15-2003, 02:54 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
TP-Link 24-Port Gigabit Ethernet Unmanaged Switch Desktop/Rackmount TL-SG1024D
$69.99
Fortinet FortiSwitch FS-124D-POE 24 Port Gigabit Ethernet Switch UNREGISTERED
$99.97
Dell X1018 X-Series Smart Managed Switches 16-Port Gigabit 2-Port SFP Switch
$42.00
New In Box BNIB Cisco SG300-10 - 10-Port Ethernet Gigabit Managed Switch S23
$119.99
NETGEAR GS108 ProSafe 8-Port GbE Unmanaged Switch w/ Power Adapter
$14.99
Dell X1026P E11W 24-Port PoE Smart Managed Gigabit Ethernet Switch 2X SFP
$25.00
Dell X1052P Series 52-Port Gigabit Rack Mountable Managed Network Switch
$30.00
New 10/100 Mbps 8 Ports Fast Ethernet LAN Desktop RJ45 Network Switch Hub
$11.49
Aruba 2530-24G 24-Port Gigabit Ethernet Managed Network Switch J9776A
$45.00
Loocam Gigabit PoE Switch 8 Port 96W 2 Uplink Port Unmanaged Ethernet Switch
$49.99