Setting path for GCC?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Setting path for GCC?
# 1  
Old 09-16-2003
Setting path for GCC?

Dear all, I have downloaded the latest version of gcc --- gcc-3.3.1.tar.gz from gnu.org. My Linux distribution is Mandrake 9.0. This was how I installed it:

su -
passwrd:

mkdir /usr/local/src
cd /usr/local/src

gunzip /tmp/gcc-3.3.1.tar.gz #where I downloaded the file
tar xvf /tmp/gcc-3.3.1.tar

cd /opt/build
/usr/local/src/gcc-3.3.1/configure
--prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu --with-system-zlib

make
make install

After I have done all these, I used "which, whereis, -v, and --version" to check the version of GCC.

Quote:
$ which gcc
/usr/bin/gcc

$ whereis gcc
gcc: /usr/bin/gcc3.2-version /usr/bin/gcc /usr/local/bin/gcc /usr/share/man/man1/gcc.1.bz2 /usr/share/man/man1/gcc.1

$ gcc -v
Reading specs from /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/specs
Configured with: /usr/local/src/gcc-3.3.1/configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.1

$ gcc --version
gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$
I can see the system holds two versions of gcc, and if I didn't guess it wrong, the system is still using the old gcc-3.2 as the default.

I have two questions here:
First, how could I set system to use gcc-3.3.1? Someone told me because gcc-3.2 was installed in /usr/bin and gcc-3.3.1 was in /usr/local/bin so I have to change the order in $PATH. I didn't understand that clear, so I went to ~/.bashrc and changed it. But after I rebooted the system, I saw the system was still using gcc-3.2. As a newbie, I hope someone could walk me through it step-by-step or even a little tip will be appreciated.
My second question is about removing the older version of gcc. I don't think I need two versions of gcc in my system since they require space. I want to remove the older version. My Mandrake 9.0 uses rpm to install gcc-3.2 in the system, so I tried to use "rpm -e gcc" to delete the old version. I failed because of the software dependency. Is there any way to remove it and not hurting my other programs have installed in my computer?

Thanx in advanced.

HOUSCOUS
# 2  
Old 09-16-2003
Just from your log it seems 3.3.1 is used, because gcc -v gives 3.3.1. On many systems, /usr/local comes before /usr in PATH. So if you have a version in /usr/local, it is usually the one that is loaded if you don't qualify with the absolute path.

You shouldn't delete 3.2, and in fact you should generally not remove the system-shipped gcc from your system.

If I don't interpret wrongly, because all of your libraries shipped in your RPMs were compiled using gcc 3.2, if you later on want to compile packages using these libraries, your gcc3.3 will not link those libraries unless they are recompiled using the new compiler. If you force remove gcc3.2 I guess you will break a lot of things. That's what I was told, and I need clarification on this too. gcc is not just another software package. It is the central component of any Linux and BSD systems that affects many parts of the system, and if that is not done carefully, you will likely wreck your system.

If you really have to stay with the latest compiler, use Debian unstable, because packages of the libraries compiled with that compiler will also be available with each compiler release. For example, the gcc version I have here is 3.3.2 with all necessary patches. That is by far the safest way to go.
# 3  
Old 09-17-2003
Thanx cbkihong! Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Gcc linker search path order

I have a build where I wish to link against and load a specific version of a library and a different version of the same library is installed on the system. I'm using a -L option to point to the version that I wish to link against but gcc still seems to choose the installed version. Is there a way... (4 Replies)
Discussion started by: Richard Johnson
4 Replies

2. Shell Programming and Scripting

Setting class path

hi , can anybody help me to chage the class path in unix server.. what are the files need to update .... (2 Replies)
Discussion started by: Madhu Siddula
2 Replies

3. UNIX for Dummies Questions & Answers

Is there any $PATH default setting?

This is a very newbie's question: I was trying to add a new version of the same command "blastn", but the old command always shows up first. which blastn /usr/local/bin/blastnThe two versions of the same command "blastn" are located in: which -a blastn /usr/local/bin/blastn... (5 Replies)
Discussion started by: yifangt
5 Replies

4. UNIX for Dummies Questions & Answers

Setting up a private path

Hi all, This is probably a very simple question but I couldn't even think of how to phrase it intelligently so google could tell me the answer. Basically I am a user on a server, I am not the admin and do not have root privileges. I have downloaded a bunch of programs that I need to use and... (2 Replies)
Discussion started by: DavyK1984
2 Replies

5. Shell Programming and Scripting

Setting path names

I am in a directory called /abstracts Doing tree -d gives . ├── geo1936 │ ├── geo01n01 │ ├── geo01n02 │ └── geo01n03 ├── geo1937 │ ├── geo02n01 │ ├── geo02n02 │ ├── geo02n03 │ └── geo02n04 (4 Replies)
Discussion started by: kristinu
4 Replies

6. Shell Programming and Scripting

Setting up a path in UNIX

I have the following script "test". When i tried to execute it, I am not able to run it. I dunno why ? Then i tried getting the first few lines of the script which is displayed below: $head -10 test #!/bin/ksh PROG=$0;export PROG ORAUSER=`get_inf_env INFORM_DB_ACCOUNT`;export ORAUSER... (13 Replies)
Discussion started by: bobby1015
13 Replies

7. Solaris

Problem Setting $PATH

I am trying to install the pkg-get package to a fresh install of Solaris 10. I am able to download and install correctly using the default directory for both pkg-get and wget as found on blastwave.org. When I issue the command "which wget and which pkg-get" it returns no wget or pkg-get found in... (1 Reply)
Discussion started by: greengrass
1 Replies

8. Shell Programming and Scripting

Setting path

Hi all, I have a java command in a shell script. When i m executing the command from the prompt its working fine. But when i paste the same command in a shell script and execute the shell script it says path not found. Please help. (5 Replies)
Discussion started by: radhika03
5 Replies

9. UNIX for Dummies Questions & Answers

Help on setting path variable

Hi there, I need help on setting the path variable. How can I set the path variable with Bourne Shell. My scripts goes like this, but did not work. #!/bin/sh PATH=/usr/bin:/usr/ucb:/etc:/export/home/zchen/home export PATH Thanks, Z (4 Replies)
Discussion started by: randomcz
4 Replies
Login or Register to Ask a Question