LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-05-2014, 11:31 AM   #1
georgianao
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Rep: Reputation: Disabled
Install gcc in local folder without being a root user


I would like to install the latest version of gcc in a local account (not having administrator privileges). I need the latest version to be used by default in my local account since it is required for the installation of another software. I have ended up using Windows for running my programs just because of this problem with the gcc installation. I am still hoping to find a solution and convert to Linux since it is much faster.

I have installed first successfully all the dependencies and I have attached the code in installdependencies.txt.

I have modified the bash profile as follows (although I got the error even before this modification):

PATH=/home/geo6/build/gmp-6.0.0:/home/geo6/build/mpfr-3.1.2:/home/geo6/build/mpc-1.0.2:$PATH

Code used to install gcc:

Build gcc:
#tar xjf gcc-g++-4.5.0.tar.bz2 # optional
mkdir ~/gcc-4.9.2
cd ~/build
tar xzf /home/geo6/contrib/gcc-4.9.2.tar.gz
cd gcc-4.9.2
LD_LIBRARY_PATH=/home/geo6/gmp-6.0.0/lib:/home/geo6/mpfr-3.1.2/lib:/home/geo6/mpc-1.0.2/lib
./configure --disable-shared --enable-static --prefix=/home/geo6/gcc-4.9.2 --with-gmp=/home/geo6/build/gmp-6.0.0 --with-mpfr=/home/geo6/build/mpfr-3.1.2 --with-mpc=/home/geo6/build/mpc-1.0.2 --disable-multilib


I also checked the folder home/geo6/build/gmp-6.0.0 and gmp.h is listed there.

The error I get is the following:

checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.

This issue has been reported and asked in other questions and as far as I have understood one solution is to move the gmp and mpfr into the gcc folder so I tried:

mv gmp-6.0.0 gcc-4.9.2/gmp
mv mpfr-3.1.2 gcc-4.9.2/mpfr

However I got the same error.
Any help is greatly appreciated.
Attached Files
File Type: txt installdependencies.txt (2.6 KB, 99 views)
 
Old 12-05-2014, 12:14 PM   #2
ron7000
Member
 
Registered: Nov 2007
Location: CT
Posts: 248

Rep: Reputation: 26
when i've done gcc building i've always been root, but it should work under a regular user account.
The big thing is having the prerequisists built, off hand i know gmp and mpfr are the 2 big ones.
when i did mine i would put everything under /usr/local so
for gmp i would do 'configure --prefix=/usr/local/gmp4.2' and 'configure --prefix=/usr/local/mpfr2.4'.
once those were installed... for you change to prefix=/home/youraccount/gmp... you then need to update your PATH and LD_LIBRARY_PATH so those newly created libraries get referenced first before the system libraries.
I use tcsh so in /etc/csh.cshrc.local I would do "setenv PATH /home/your/account/gmp4.2:${PATH}"
and also "setenv LD_LIBRARY_PATH /home/youraccount/gmp4.2/lib:${LD_LIBRARY_PATH}".
with that done when you run configure for the gcc build it should then find those latest versions of gmp and mpfr.
do the same with any other prereq's such as ppl and cloog, whatever you build.

if configure for gcc still doesn't find the gmp or mpfr then do a configure --help for the gcc build. It will spit out the syntax for using the options --with-gmp and --with-mpr for which you say --with-gmp=/home/youraccount/gmp-4.2.
It may also do --with-gmp-include and --with-gmp-lib. so try those, that's what's worked for me.
 
Old 12-05-2014, 03:24 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
the easiest way would be to have your system administrator install gcc49 ( 32 bit or 64 bit or arm ) in /home/YourUserName/bin
the one already built for this unknown operating system

you will need a ton more things than JUST gcc ( and not many programs will YET build in 4.9 without hacking the code)

what operating system is this ?
and are you 100% sure that this unknown program WILL ONLY build in gcc 4.9.2
see the changes for porting 4.8 code to 4.9
https://gcc.gnu.org/gcc-4.9/changes.html

4.8 is default on a lot of OS's
and 4.4 is default on RHEL6



or

why not just use a operating system that ALREADY has gcc4.9 installed by default

Fedora 21
-- it is do to be released on Dec 9

Last edited by John VV; 12-05-2014 at 03:27 PM.
 
Old 12-05-2014, 03:46 PM   #4
georgianao
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
errors after running make

I am running Linux on a cluster computer which has a lot of memory and is faster so it is not my own computer. However I am just allowed to use my own local account and I do not have administrator support for software installations or installation rights. This is why I am trying to install locally.

I finally used config without the --with commands and it worked without errors.
./configure --disable-shared --enable-static --prefix=/home/geo6/gcc-4.9.2 --disable-multilib

However when I use make I get 2 errors (see below the errors). If anybody knows what it means please let me know.



rm -rf asm classes classes.lst asm.lst
make all-am
make[5]: Entering directory `/home/geo6/build/gcc-4.9.2/x86_64-unknown-linux-gnu/libjava/classpath/tools'
make[5]: Nothing to be done for `all-am'.
make[5]: Leaving directory `/home/geo6/build/gcc-4.9.2/x86_64-unknown-linux-gnu/libjava/classpath/tools'
make[4]: Leaving directory `/home/geo6/build/gcc-4.9.2/x86_64-unknown-linux-gnu/libjava/classpath/tools'
make[4]: Entering directory `/home/geo6/build/gcc-4.9.2/x86_64-unknown-linux-gnu/libjava/classpath'
true DO=all multi-do # make
make[4]: Leaving directory `/home/geo6/build/gcc-4.9.2/x86_64-unknown-linux-gnu/libjava/classpath'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/geo6/build/gcc-4.9.2/x86_64-unknown-linux-gnu/libjava/classpath'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/geo6/build/gcc-4.9.2/x86_64-unknown-linux-gnu/libjava'
make[1]: *** [all-target-libjava] Error 2
make[1]: Leaving directory `/home/geo6/build/gcc-4.9.2'
make: *** [all] Error 2
 
Old 12-05-2014, 05:18 PM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
← #4 and others.

Two fundamental errors :
1) The build/ folder is for the build only.
I.e. you must configure like this, in the empty build/ folder :
$ ../gcc-4.9.2/configure --prefix=/home/<etc.> --enable-languages=c,c++ --disable-multilib
* The unpacked gmp/ (ver.=6.0.0a), mpfr/ (-3.1.2), mpc/ (-1.0.2) must be present in gcc-4.9.2/.

2) You don't want the "gcc java" etc.: Hence --enable-languages=c,c++.

Please read about gcc-4.9.2 in "LFS development"
http://www.linuxfromscratch.org/lfs/view/development/

-
 
Old 12-06-2014, 03:38 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
One more required option :

$ ../gcc-4.9.2/configure \
--prefix=/home/<etc.> \
--program-suffix=49
--enable-languages=c,c++ \
--disable-multilib

-
 
  


Reply



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
[SOLVED] how to make a link (user)folder that links to a root folder morganfreeman Linux - Server 6 01-14-2013 05:56 AM
Local root user can su - to nis user haiders Linux - Security 4 12-04-2007 05:38 PM
errors in root and user for .nx file or folder? LVSuSE Linux - Newbie 1 03-07-2007 08:57 AM
i can't create folder or file by root user. Linux For Ever Red Hat 7 01-19-2007 02:34 PM
Im the only user on SUSE 10.0 and it will not allow me in the root folder BFGeier Linux - Newbie 4 01-02-2006 07:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:25 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
Open Source Consulting | Domain Registration