Compilation on Linux Newbie

From Stellarium Wiki
Revision as of 10:20, 18 April 2006 by Matthewg42 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For many people unfamiliar with the command line, the build process on Linux can appear a little daunting. Basic operations, like how to change "into" a particular directory are not obvious without some instruction.

I recently tried to step someone who was fresh to the command line through the build process on Ubuntu Linux. I'm posting extracts from that dialogue here in the hope that they will be useful to other new-comers to the Linux operating system.

I've inserted headings through the mail so that the wiki can generate a table of contents which will aide navigation. The original dialogue was in email, from which I have only posted my responses to questions. questions or comments from the other party (Greg) will be prefixed with the inline reply indicator ">".

Contents


Caveats

On Thursday 16 Mar 2006 06:30, you wrote:
> Hi Matthew,
>
> Greg here (astrodiver) from the Stellarium Forum. Hopefully you are
> willing to answer a Linux question for me.

Sure.

> I was finally able to intall Ubuntu. I really like it so far! I
> started using a computer after Windows came around. Anything that
> looks "command line" scares the hell out of me, but I'm trying. I
> was able to successfully download the CVS version and, according to
> my File Browser,  it seems to live in my /home/greg/stellarium
> directory. Now what? I see the commands I am supposed to enter in
> my terminal from the Stellarium Wiki page, but I do not know how to
> make this magic happen. What do I actually type in my terminal at
> the prompt? I guess the problem is that I know nothing about Linux
> commands, so I do not know how to tell the terminal what to do.
> Does that make any sense?

Yes it does.  I remember the first time looking at a unix terminal and 
not knowing where to start - it was awful!  It's the main problem 
with the command line - it's not intuiative, especially at the 
beginning.  But there's a lot of joy hidden away in there to keep 
nerds happy  ;)

Before we start to try to build the CVS version, I'd like to say this 
is a fairly hard-core nerd activity! It's not as hard as it looks at 
first, but I just wanted to say this isn't something most 
non-developers will ever do...  Don't associate this sort of 
procedure with Linux, it's a software developer thing...  :)

The CVS version doesn't always build properly because its a work in 
progress.  If it doesn't build it usually needs some quick fix to the 
sourcecode.  I know that the CVS build was broken a few days ago, but 
the fix is just to modify one line in one of the source files...  I 
can help with these problems (send you fixed version of files and so 
on).

Dependencies

OK. First we need to make sure all the dependencies are installed. 

Open the synaptic package manager, and install the packages listed in 
the pre-requsites table on the wiki page.  The search feature of 
synaptic will be very useful.

Ignore the bit on the wiki page saying about "apt-get" (it's an 
alternative way to install software, but lets not go into it now).

The Prompt; The Shell; The Terminal; Changing Directory

OK, once the prerequisites are installed open up a terminal window. 
You'll see a window with some text in it, at the end of which will be 
the prompt.  The prompt will look something like:

greg@ubuntu:~$ 

To execute commands, you type them in here. When you press return, the 
command is executed and when the command is complete, you get another 
prompt. 

By the way, the "terminal" program is an interface to another program 
which you will hear referred to a a lot, called the "shell".  It's 
the shell which reads what you type, executes the commands and prints 
output.  The terminal might be thought of as just the window in which 
the shell program operates.  I want to say this because I tend to mix 
the terms, so don't worry if you hear things like "type this into 
your terminal" or "execute this command in a shell"... people often 
use these terms to mean the same sort of thing.

OK.  When you're looking at your hard disk with Explorer in Windows,  
you have a "current" directory that it's looking at.  In Windows 
Explorer this is indicated in the bar at the top of the window, e.g. 
C:\Program Files\Stellarium.  In the shell this information is often 
shown in the prompt.  By the way, Linux uses "/" where Windows uses 
"\".  

The shell also has a current directory.  When you start the terminal 
program, the shell which it contains is started in your home 
directory, /home/greg.  The prompt tell you this.  I know what you're 
thikning, "what! where?".  It's the "~" bit.  Because the home 
directory is used so much it has a special abbreviation, "~".  

As well as looking at the prompt, you can ask the shell to tell you 
the current direction using the "pwd" command (which stands for 
"present working directory"):

greg@ubuntu:~$ pwd
/home/greg 

To build the CVS version, we need tell the shell to change into the 
directory where we have all the files, "stellarium".  In Windows 
explorer you'd do this by double-clicking (or single-clicking 
depending on the setup) on the stellarium folder.  In the shell, 
there is a text command for this: "cd" (short for "change 
directory").  You type the command and the name of the directory to 
change to as a "parameter".  A parameter is extra information which 
is passed to the command so it knows what you want:  Paremters are 
just extra words separated from the command by spaces:

greg@ubuntu:~$ cd stellarium

After the command has executed, you'll get the prompt back, but it 
will have changed to something like this:

greg@ubuntu:~/stellarium$

Which just tells you that you are now working in the stellarium 
directory.

Doing the Build

Now you're here, you just need to execute the commands from the wiki 
page to build stellarium:

greg@ubuntu:~/stellarium$ ./configure
greg@ubuntu:~/stellarium$ make
greg@ubuntu:~/stellarium$ sudo make install 

Each command will create a lot of output telling you what it is doing.  
Don't worry too much about it, but check to see that the last few 
lines of output don't look like an error of some kind, else the next 
command won't work as expected.

The last command "sudo make install" will prompt you for your 
password. "sudo" means "super user do".  This executes the command 
with administrator privilidges.  It's normal on Linux systems for 
user account to not be able to modify installed programs.  Users can 
only modify files in home directories.  When you install the software 
using the method shown here, it goes to some directories in 
the /usr/local area, which is only writable by the administrator.  On 
Ubuntu, the first user account (in this case "greg") can execute 
admin commands using their own password given to the sudo command...

In short, to install software you need to use sudo and give your 
password.

One final note.  Almost all shell commands are document in the manual.  
To get help on a command, use the "man" command.  e.g. to get help on 
"cd", do this:

greg@ubuntu:~$ man cd

You can use the cursor keys to scroll up and down, and the "q" key to 
get back to the prompt. 

OK, that's all for now.  I hope it isn't too verbose.  I usually err 
on the side of providing too much information rather than not enough.  

>
> If I do something once I can usually do it from then on.  Any help
> would be greatly appreciated.
>
> Thanks,
> Greg
>
> "The greatest obstacle to discovering the truth is being convinced
> that you already know it" - author unknown
Personal tools
Namespaces
Variants
Actions
in this wiki
other languages
Toolbox