Problem description
Sometime, we want to relative new version of basic building tools on a linux sever, where we don’t have root permission, to install some software not so popular to our own account.
For my case, I want to install MOAB, PyNE and DAGMC on a sever maintained by the several PhD or post-doctor researchers. This sever is used for some specific purpose highly related to the research. There isn’t a staff versatile enough to cope with the sever maintaince. There isn’t a moudle on the sever. Some characters of the sever:
- No tool
module
- Some prebuild tools, such as GCC, are old version
- I don’t have root permission
While, maybe the better way to solve the problem is to ask experts to do install anything you want for me. But, I can’t find out a person with enough knowledge in our research group to do that. So, I am going to build a GCC on my own without root permission.
Setup GSRC
I way I choose to install GCC is use GSRC (GNU Source Release Collection) to install it.
Note: Do not download GSRC package from ftp, use bzr to download it.
1 | bzr checkout bzr://bzr.savannah.gnu.org/gsrc/trunk/ gsrc |
Set GSRC environment
Open ~/.bashrc, add the following line in the file:
1 | source $PATH_TO_GSRC/setup.sh |
Install dependencies
Update ISL
ISL is a required by GCC, but the version of the prebuild one is too lower thant 0.15. So, install ISL.
1 | make -C pkg/other/isl |
Install GCC
Now, I want to install GCC-7.4.0 on the sever.
Modify config.mk
Before install GCC, there are some configure options should be changed. Open the gsrc/pkg/gnu/gcc7/config.mk, edit the following items:
--enable-languages=c,c++,fortran
--disable-multilib
make
Run the following commands:
1 | # cd PATH_TO_GSRC |
Catch problems and fix
When you running perform make
, there may be some error like this:
...suspect...32...multilib..., if 64... rerun with --disable-multilib
. Just RERUN the same make process....vec.h:295:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
.
Form here I know the solution is unset a bunch of C compiler flags:And run the1
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
make
again:1
make -C pkg/gnu/gcc7
make install
1 | make -C pkg/gnu/gcc7 check |
Post-install, env set
The GCC binaries I installed have the suffix of -7
. Link them to the name without -7
. Acutally, I can modify the pkg/gnu/gcc7/config.mk
and change the --program-suffix
to none to avoid this suffix.
1 | cd $HOME/opt/GNU/bin |
Done!