installing isolated gcc on server without sudo - gcc

I have access to a server (but don't have root permissions on there). To cut a long story short the admin won't upgrade to the newer version of gcc that I need, but has suggested that I can just install it locally.
I'm having some issues doing this, despite trying to follow the guide at http://gcc.gnu.org/install/index.html. I want to use the new versions of GMP, MPFR, and MPC that are installed now on the server.
I first go into my home dir on the server then mkdir mygcc which I then cd into (this is to be the build dir and is not a sub-dir of src dir), from there I do
/home/username/gcc-4.6.3/configure --with-gmp="/software/gmp-5.0.5" --with-
gmp-include="/software/gmp-5.0.5/include" --with-gmp-lib="/software/gmp-5.0.5/lib"
--with-mpfr="/software/mpfr-3.1.1" --with-mpfr-include="/software/mpfr-3.1.1/include"
--with-mpfr-lib="/software/mpfr-3.1.1/lib" --with-mpc-include="/home/username/usr/local
/include" --with-mpc-lib="/home/username/usr/local/lib" --prefix="/home/username/mygcc"
--with-local-prefix="/home/username/usr/local"
the src files that I unzipped are at /home/pmxlh1/gcc-4.6.3.
I also made the directories /home/username/usr/include, /home/username/usr/local etc and set the prefix flags to try and install various things there, but it also fails if I just leave those flags out for the same reasons.
When I get to make however it ends with
checking for suffix of object files... configure: error: in `/home/pmxlh1/mygcc/x86_64-
unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/pmxlh1/mygcc'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/pmxlh1/mygcc'
make: *** [all] Error 2
Not sure if I'm going about this the correct way? But basically I want to install it in my home/dir and so that it uses the correct GMP/MPFR/MPC not the old versions that maybe lurking elsewhere on the server.
thanks for any help

Related

Makefile error when building on Cygwin

I am installing some NASA's software (HEASoft) from the source code on Cygwin (32-bit) running on Windows 10. Configure ran successfully, but make gives the following errors:
Makefile:26: /home/Mario/heasoft-6.21/heacore/BUILD_DIR/Makefile-std: No such file or directory
gmake[2]: *** No rule to make target '/home/Mario/heasoft-6.21/heacore/BUILD_DIR/Makefile-std'. Stop.
gmake[2]: Leaving directory 'C:/cygwin/home/Mario/heasoft-6.21/heacore/BUILD_DIR'
make[1]: *** [Makefile:74: heacore] Error 2
make[1]: se sale del directorio '/home/Mario/heasoft-6.21/BUILD_DIR'
make: *** [Makefile:10: all] Error 2
My problem is that the file /home/Mario/heasoft-6.21/heacore/BUILD_DIR/Makefile-std is not found; however, it actually exists and is located in the correct directory. EDIT: here it can be seen that this file exists:
$ ls /home/Mario/heasoft-6.21/heacore/BUILD_DIR
config.guess config.sub hd_config_info headas-init.csh headas-setup.in hmakerc lhea-fixperl Makefile-CCfits
config.log configure hd_install.c headas-init.sh hmake hmakerc.in Makefile Makefile-std
config.status configure.in hd_scanenv headas-setup hmake_hd install-sh Makefile.in
Any clue why this might be happening and how can be solved?
When Cygwin shell is opened cd /cygdrive/c/home/Mario and run make on your project from that directory. I remember I had similar issue when the current directory was /home/foo. I got it solved just changing the directory to /cygdrive/c/home/foo which is definitely is the same directory, but somehow Cygwin's Make likes it better

Using mingw-w64 and ./configure --host=i686-w64-mingw32.static, make fails and Makefile CC variable looks wrong

I am new to compiling.
I am trying to compile iperf3 for Windows 10 because there is no official Windows distribution of iperf3 and for the learning experience. I am trying to do so on the new Windows Subsystem for Linux feature via Bash on Ubuntu on Windows, also for the learning experience.
I installed mingw-w64, which should give me the proper compiler and environment necessary for cross-compiling:
sudo apt-get install mingw-w64
This put two directories into my /usr directory:
i686-w64-mingw32
x86_64-w64-mingw32
It also put a bunch of things that look like compilers into /usr/bin.
I unzipped the .tar.gz file from iperf3 and navigated into it. Then, I run ./configure --host=i686-w64-mingw32.static and it completes without errors.
I note that the output of the command has a worrisome line: checking for i686-w64-mingw32.static-gcc... no
I note that the Makefile's CC variable is set to gcc, which doesn't sound like the proper compiler.
Then, I run make. It fails with errors:
collect2: error: ld returned 1 exit status
make[2]: *** [iperf3] Error 1
make[2]: Leaving directory `/home/snip/iperf3/iperf-3.1.4/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/snip/iperf3/iperf-3.1.4/src'
make: *** [all-recursive] Error 1
I also see the line: libtool: warning: undefined symbols not allowed in i686-w64-mingw32.static shared libraries; building static only
I think that the ./configure is not working correctly since it appears to have not found the right compiler for my --host argument and put it in the Makefile.
What am I doing wrong?
EDIT:
I changed the command to ./configure --host=i686-w64-mingw32 per comments and it completes without error. But no makefile is created so make yields make: *** No targets specified and no makefile found. Stop.
What am I doing wrong, now?
EDIT 2:
Looks like the ./configure actually is failing. Last line of its output is nanosleep() required for timing operations., which seems to mean that its missing a library for nanosleep.
How do I get nanosleep?
mingw doesn't support nanosleep. So programs using it cannot be compiled using mingw-w64.

Compiling GCC 4.7.3 for i386-elf support on Cygwin

I am trying to compile GCC for Cygwin with support for targeting i386-elf so I can compile some simple OSes (search Benu, by l30nard0, on Github). I've successfully compiled the binutils for i386-elf, and compiled all of GCC's floating-point numbers dependencies.
Problem is, it says windows.h can not be found. I do have w32api successfully installed, and tried including each of those one at a time in the include path for GCC, but none of them work. If I try any of them, I get so many errors and warnings that not all will show up in the Cygwin console. The dozens upon dozens of warnings are most if not all unused parameter.
Does anyone know where the problem might lie?
I've wasted the last three entire days of my life trying to get Linux Mint set up with everything I want, but for reasons I shan't go into I gave up on that. I'd love to be able to get just one thing to work so I can enjoy my life again. :) Thanks!
BTW: The configure arguments I used were --target=i386-elf --enable-threads=win32 --enable-languages=c,c++ Was I supposed to use --enable-targets instead?
And here's part of the log:
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2.o' failed
make[2]: *** [unwind-dw2.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2-fde.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2-fde.o' failed
make[2]: *** [unwind-dw2-fde.o] Error 1
make[2]: Leaving directory '/home/Sean/gccbuild/i386-elf/libgcc'
Makefile:10055: recipe for target 'all-target-libgcc' failed
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory '/home/Sean/gccbuild'
Makefile:870: recipe for target 'all' failed
make: *** [all] Error 2
Remove the --enable-threads=win32 flag; it is intended to specify thread support on the target system, not the build system.

What is the issue with Ubuntu (12.10) and GCC 4.7/4.8?

Since several versions of GCC and Ubuntu I am experiencing annoying issues with paths and naming of several header and object files that are necessary for the installation of GCC.
Description: After installing ubuntu (e.g. in my case 12.04) and installing all prerequisites of the gcc, I run the following commands:
sudo mkdir /usr/local/stow/gcc-4.8.0
./configure --prefix /usr/local/stow/gcc-4.8.0
make
sudo make install
For the sake of completeness, the rest of the installation procedure:
cd /usr/local/stow
sudo stow -t /usr/local/ gcc-4.8.0
gcc -v
However, this simple and proper way of installing gcc has some issues during the 'make' step with the following error messages:
1.) The problem with 'stubs.h'
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
which can be fixed with the following commands added to ~/.bashrc:
if [ -z "$CPATH"]; then
export CPATH="/usr/include/i386-linux-gnu"
else
export CPATH=$CPATH:"/usr/include/i386-linux-gnu"
fi
2.) The problem with 'crti.o', 'crtn.o', and 'crt1.o'
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtn.o: No such file or directory
/usr/bin/ld: cannot find crt1.o: No such file or directory
which can be fixed with the very ugly solution:
sudo ln -s /usr/lib/i386-linux-gnu/crti.o /usr/lib/i386-linux-gnu/crtn.o /usr/lib/i386-linux-gnu/crt1.o /usr/lib
since - and I don't know why - the following commands do not solve the problem during linking steps of 'sudo make install'
if [ -z "$LIBRARY_PATH"]; then
export LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LIBRARY_PATH=$LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
if [ -z "$LD_LIBRARY_PATH"]; then
export LD_LIBRARY_PATH="/usr/lib/${multiarch}"
else
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/lib/${multiarch}"
fi
(With these solutions I could compile GCC-4.7.2 on Ubuntu 12.04. - I have still issues compiling GCC-4.8.0 on Ubuntu 12.04, but that's different topic.)
My questions are: Does anybody know the reason/background that we have these issues? Does anybody know a proper solution? (With "proper solution" I mean a solution that does not require setting environment variables or symbolic linking libraries to different directories. To me these kind of changes are ugly, since they require changes to the system that one may not be able to trace back or redo.)
In the root folder of your GCC source execute ./contrib/download_prerequisites script.
These are the issues i encountered while compiling GCC 4.8.0 on Ubuntu 12.04 with solutions.
This might help you.
Compilation guide for compiling GCC 4.8 on ubuntu 12.04
ERROR 1
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.
SOLUTION
Download and install gmp version >=4.3.2 package because mpc needs higher version
download the source code from gmplib.org
compile the source code and install
while compiling gmp see ERROR 2 for help
Installed gmp version 5.1.1
Download and install mpfr package
Installed mpfr version 3.1.2
Download and install mpc package
Installed mpc version 1.0
Download the packages from
http://ftp.gnu.org
ERROR 2
Error while compiling gmp library
checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin
SOLUTION
sudo apt-get install m4
http://ubuntuforums.org/showthread.php?t=850491
ERROR 3
Cannot find g++ compiler
I got this error because I installed the OS recently and had not installed the compilers.
SOLUTION
sudo apt-get install build-essential
This installs all the standard build essential software
ERROR 4
checking for i686-pc-linux-gnu-gcc... /home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/xgcc -B/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/home/suhastheju/projects/gcc/gcc-4.8.0/i686-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
Though gcc documentation specify , that , we can provide the path of gmp
and mpfr installtion through –with-gmp and –with-mpfr flag ,
but unfortunately , i tried to give the path but it didnt work.
I am not in position to say final word about , this , whether it is a bug
in build script or something else , but bellow is the solution of the problem.
while building , add gmp and mpfr installation path in LD_LIBRARY_PATH environment
variable. Do as follows
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
If you have the libraries in different path, add the path where libraries are present
ERROR 5
libbackend.a(tree-vect-data-refs.o):tree-vect-data-refs.c:(.text+0x87da): more undefined references to `vector_type_mode(tree_node const*)' follow
collect2: error: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0'
make: *** [all] Error 2
SOLUTION
recompiled the source code from begining, It worked magically
make clean all
ERROR 6
/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc/../.././gcc/gcov.c:416: undefined reference to `gcc_init_libintl()'
collect2: ld returned 1 exit status
make[3]: *** [gcov] Error 1
make[3]: Leaving directory `/home/suhastheju/projects/gcc/gcc-4.8.0/host-i686-pc-linux-gnu/gcc'
SOLUTION
Added -I/usr/include

Compiling Qt3D without Qt source code

I'm experiencing difficulties with Qt3D. I can't manage to compile it from source code. If possible, I would like to compile Qt3D without compiling Qt itself. Can it link against an already compiled Qt ?
OS: Linux Ubuntu 11.10 (oneiric) x86_64
Qt version: 4.7.4
make output:
cp: cannot create regular file /usr/include/qt4/Qt3D/qt3dglobal.h': No such file or directory
make[2]: *** [/usr/include/qt4/Qt3D/qt3dglobal.h] Error 1
make[1]: *** [sub-threed-make_default-ordered] Error 2
make: *** [sub-src-make_default-ordered] Error 2
global/qt3dglobal.h /usr/include/qt4/Qt3D/qt3dglobal.h
make[2]: Leaving directory/home/soroush/programs/programming/libraries/qt3d-1.0-src/src/threed'
make[1]: Leaving directory `/home/soroush/programs/programming/libraries/qt3d-1.0-src/src'
My solution was to create the /usr/include/qt4/Qt3D folder.
Just type this in a terminal window
sudo mkdir /usr/include/qt4/Qt3D
This fixed the problem for me.
Also you might need to type
sudo mkdir /usr/include/qt4/QtQuick3D
To create the QtQuick3D directory.
Make sure you have qt-devel (or similar) development package installed for Qt. The library-only default package doesn't have headers nor development tools (moc, uic, qmake, etc.).
Alas, your problem seems to be that you're trying to install it to the default prefix /usr without running sudo make install. I suggest you mkdir ~/qt3d && configure --prefix=~/qt3d, so that it gets installed in your home directory.

Resources