Results 1 to 7 of 7

Thread: Compiling?

  1. #1
    Member registered user
    Join Date
    Sep 2004
    Posts
    78

    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

  2. #2
    Administrator Site Admin-
    Join Date
    Apr 2003
    Location
    USA
    Posts
    5,441

    Re: Compiling?

    Quote 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.

  3. #3
    Senior Member registered user
    Join Date
    May 2003
    Location
    Belgrade, YU
    Posts
    334
    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)

  4. #4

  5. #5
    Member registered user
    Join Date
    Sep 2004
    Posts
    78
    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

  6. #6
    Senior Member registered user
    Join Date
    Nov 2002
    Location
    USA, IL
    Posts
    1,041
    --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.

    Quote 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

  7. #7
    Administrator Site Admin-
    Join Date
    Apr 2003
    Location
    USA
    Posts
    5,441
    Quote 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

  1. New problems when compiling under 3.8.1
    By redss in forum General Support
    Replies: 4
    Last Post: 05-11-2005, 09:19 PM
  2. Compiling
    By Kowood in forum MS Windows & New to Linux
    Replies: 1
    Last Post: 04-17-2005, 10:44 AM
  3. Problem while compiling GTK+
    By Yuanlong in forum General Support
    Replies: 15
    Last Post: 08-03-2004, 11:01 AM
  4. Compiling netcat
    By Liquidant in forum General Support
    Replies: 2
    Last Post: 05-26-2004, 06:34 PM
  5. Compiling KDE Applications
    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
  •  


Firewalla Gold Pro 10GbE Firewall Router with Rack Mount Ears and USB Key picture

Firewalla Gold Pro 10GbE Firewall Router with Rack Mount Ears and USB Key

$829.99



OPNsense pfSense 16-Core Atom C3958 16GB ECC RAM 512GB SSD 8-Port QAT AES-NI VPN picture

OPNsense pfSense 16-Core Atom C3958 16GB ECC RAM 512GB SSD 8-Port QAT AES-NI VPN

$258.00



pfSense Firewall 16-Core Atom C3958 8GB DDR4 RAM 64GB SSD 8x 1Gbe QAT AES-NI VPN picture

pfSense Firewall 16-Core Atom C3958 8GB DDR4 RAM 64GB SSD 8x 1Gbe QAT AES-NI VPN

$184.99



Cisco Meraki MX67-HW Security Appliance Firewall NEW Unused Unclaimed picture

Cisco Meraki MX67-HW Security Appliance Firewall NEW Unused Unclaimed

$202.50



OPNsense pfSense 8-Core Atom C3758 2.2GHz 8GB DDR4 64GB SSD 8x NIC QAT AES VPN picture

OPNsense pfSense 8-Core Atom C3758 2.2GHz 8GB DDR4 64GB SSD 8x NIC QAT AES VPN

$145.00



Fortinet FortiGate 60F FG-60F Firewall Tested Reset Deregistered OEM PSU picture

Fortinet FortiGate 60F FG-60F Firewall Tested Reset Deregistered OEM PSU

$99.99



Fortinet FortiGate 60F FG-60F P24286-03-13 Network Firewall Security Appliance picture

Fortinet FortiGate 60F FG-60F P24286-03-13 Network Firewall Security Appliance

$155.75



Firewalla Gold Pro - 10 Gbps Cyber Security Firewall picture

Firewalla Gold Pro - 10 Gbps Cyber Security Firewall

$693.00



SonicWall TZ280 Firewall 03-SSC-6933 Advanced Edition 3YR NEW SEALED picture

SonicWall TZ280 Firewall 03-SSC-6933 Advanced Edition 3YR NEW SEALED

$999.99



Zero Trace Pen: All-in-one Tor Network Anonymous Drive + Cryptocurrency Wallet picture

Zero Trace Pen: All-in-one Tor Network Anonymous Drive + Cryptocurrency Wallet

$147.00