I am trying to install gcc (a branch of gcc, not the trunk in the svn), and I configured it with:
./configure --prefix=/home/user/myroot/ --enable-languages=c,c++ \
--disable-multilib --libexecdir=/usr/lib --without-included-gettext \
--enable-threads=posix --disable-werror --with-arch-32=i486 \
--with-tune=generic --enable-checking=release --build=i486-linux-gnu \
--host=i486-linux-gnu --target=i486-linux-gnu
/home/user/myroot is a directory that exists.
When I run make, it builds gcc fine.
However, when I do make install, this is what I get:
make[1]: Entering directory `/home/user/gcc/gcc-cjung'
/bin/bash ./mkinstalldirs /home/user/myroot /home/user/myroot
make[2]: Entering directory `/home/user/gcc/gcc-cjung/host-i486-linux-gnu/fixincludes'
rm -rf /usr/lib/gcc/i486-linux-gnu/4.5.0/install-tools
/bin/bash ../.././fixincludes/../mkinstalldirs /usr/lib/gcc/i486-linux-gnu/4.5.0/install-tools
mkdir -p -- /usr/lib/gcc/i486-linux-gnu/4.5.0/install-tools
mkdir: cannot create directory `/usr/lib/gcc/i486-linux-gnu/4.5.0': Permission denied
make[2]: *** [install] Error 1
make[2]: Leaving directory `/home/user/gcc/gcc-cjung/host-i486-linux-gnu/fixincludes'
make[1]: *** [install-fixincludes] Error 2
make[1]: Leaving directory `/home/user/gcc/gcc-cjung'
make: *** [install] Error 2
Why does it still want to copy stuff to /usr/lib when I specified the prefix to be /home/user/myroot?
Btw, I am using Ubuntu 9.10 if that matters. I have already installed build-essential, gawk, flex, bison, and libmpfr.
Why did you set the libexecdir to /usr/lib? That means it will have to install things into /usr/lib, a directory to which you cannot write.
You probably want --libexecdir=/home/user/myroot/usr/lib
Related
I was trying to build & install GCC cross-compiler for arm-none-eabi, and got this error after running make install-target-libgcc, and I got this:
dingus#DingusPC:~/src/build-gcc$ make install-target-libgcc
/bin/bash ../gcc-11.2.0/mkinstalldirs /home/dingus/opt/gcc /home/dingus/opt/gcc
make[1]: Entering directory '/home/dingus/src/build-gcc/arm-none-eabi/libgcc'
make[1]: *** No rule to make target 'install'. Stop.
make[1]: Leaving directory '/home/dingus/src/build-gcc/arm-none-eabi/libgcc'
make: *** [Makefile:13220: install-target-libgcc] Error 2
The full list of commands I run is:
mkdir build-gcc
cd build-gcc
../gcc-11.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
$PREFIX is set to /home/dingus/opt/gcc, and $TARGET is arm-none-eabi
Oddly enough, I have built it for i686-elf multiple times with no problem.
I was following a guide from https://wiki.osdev.org/GCC_Cross-Compiler
On a fresh install of Fedora 30 onto a VM (in the below yum gets gcc 9.1, and trying to use that to build gcc 9.2):
sudo yum install make cmake gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel zlib-devel libgo libgo-devel go g++
wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
tar xf gcc-9.2.0.tar.xz
cd gcc-9.2.0
./configure --prefix=/usr --disable-multilib --with-system-zlib --enable-languages=c,c++,d,fortran,go,objc,obj-c++
make
gives:
make[4]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[3]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[2]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[2]: Entering directory '/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gotools'
/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gcc/gccgo -B/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -g -O2 -I ../x86_64-pc-linux-gnu/libgo -static-libstdc++ -static-libgcc -L ../x86_64-pc-linux-gnu/libgo -L ../x86_64-pc-linux-gnu/libgo/.libs -o go ../.././gotools/../libgo/go/cmd/go/alldocs.go ../.././gotools/../libgo/go/cmd/go/go11.go ../.././gotools/../libgo/go/cmd/go/main.go ../x86_64-pc-linux-gnu/libgo/libgotool.a
gccgo: error: ../x86_64-pc-linux-gnu/libgo/libgotool.a: No such file or directory
make[2]: *** [Makefile:821: go] Error 1
make[2]: Leaving directory '/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gotools'
make[1]: *** [Makefile:14649: all-gotools] Error 2
make[1]: Leaving directory '/home/mmalak/gcc-9.2.0'
make: *** [Makefile:997: all] Error 2
Yet libgotool.a exists in /home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo/libgotool.a
I don't know if this is the reason but it is not recommended to configure and build gcc in the same directory of source code. Try:
cd ../
mkdir stage1-build && cd stage1-build
../gcc-9.2.0/configure --prefix=/usr --disable-multilib --with-system-zlib --enable-languages=c,c++,d,fortran,go,objc,obj-c++
make
Im having trouble to compile gcc 4.5.0 in red hat 7.
Im following the instructions from here ("The hard way", without libelf).
I use following versions:
# rpm -qa | grep -e libelf -e gmp -e mpfr -e mpc
mpfr-3.1.1-4.el7.x86_64
mpfr-devel-3.1.1-4.el7.x86_64
elfutils-libelf-0.170-4.el7.x86_64
elfutils-libelf-devel-0.170-4.el7.x86_64
gmp-6.0.0-15.el7.x86_64
libmpc-1.0.1-3.el7.x86_64
gmp-devel-6.0.0-15.el7.x86_64
While compiling, he doesnt find mpc.h:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ 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.
So I compiled it.
Here is the working configure:
/opt/app/gcc/gcc-4.5.0_SOURCE/configure
--prefix=/opt/app/gcc-4.5.0
--enable-languages=c,c++,fortran
--enable-bootstrap
--enable-shared
--enable-threads=posix
--enable-checking=release
--with-system-zlib
--enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-gnu-unique-object
--with-mpc=/opt/app/gcc/tmp/
At the end of make I get this:
...
ar rc libgcc.a $objects
ranlib libgcc.a
make[5]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/32/libgcc'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/libgcc'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make: *** [all] Error 2
After some research I found out, that texinfo was missing. Install texinfo got me to a new failure:
...
make[3]: *** [doc/gccint.info] Error 1
rm gcc.pod
make[3]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make: *** [all] Error 2
After some research I found here that texinfo has a bug. Now Im trying to compile texinfo 4.13a but again, I get into trouble with no clear error message.
Did anyone achieve to compile gcc 4.5.0 in redhat 7?
UPDATE
I can compile gcc 4.5.4, but ONLY IF texinfo is NOT installed ...
kind regards
Your errors 1. GCC requires a build directory outside the gcc-source/ https://gcc.gnu.org/install/configure.html
gcc-4.5.x cannot use the EL7 texinfo. Please install a texinfo from "the gcc-4.5 days" :
yum remove texinfo
yum install Downloads/texinfo-4.13a-10.fc14.x86_64.rpm
http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/14/Everything/x86_64/os/Packages/texinfo-4.13a-10.fc14.x86_64.rpm
GCC-4.5 : The bugfix version is 4.5.4 .
Note: The default build directory is $HOME/tmp/ (Or other dir. in $HOME). ... My build example :
cd gcc-4.5.4/
tar xvf mpfr-3.0.1.tar.xz
mv mpfr-3.0.1/ mpfr
tar xvf gmp-5.0.5.tar.xz
mv gmp-5.0.5/ gmp
tar xvf mpc-0.8.2.tar.gz
mv mpc-0.8.2/ mpc
cd ../
mkdir build-gcc45
cd build-gcc45/
../gcc-4.5.4/configure --prefix=/usr/local/gcc45 --program-suffix=45 --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --disable-multilib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
make
# make install
cd /usr/bin/
# ln -s /usr/local/gcc45/bin/gcc45
# ln -s /usr/local/gcc45/bin/g++45
# ln -s /usr/local/gcc45/bin/gfortran45
Using, examples : $ export CC=gcc45 CXX=g++45 FC=gfortran45 && ./configure .... .... $ CC=gcc45 CXX=g++45 FC=gfortran45 cmake ../
Result : "gcc45-c++-4.5.4-1.el7.x86_64.rpm" https://drive.google.com/file/d/15aRg-BPhuyaEyZA9Jy-iAyC21_pwN7nD/view?usp=sharing
Example with the older gcc-4.5.0 :
$ cd build-gcc450/
$ ../gcc-4.5.0/configure --prefix=/opt/app/gcc-4.5.0 --program-suffix=450 --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --disable-multilib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
$ make -j4
# make install ( No errors at all )
https://www.dropbox.com/s/45kfetdjj9lif66/gcc450-configure-opt.txt?dl=0
... More examples → https://drive.google.com/drive/folders/1j7qE9YKTT313B5VBg3kevzCNiykGkonO?usp=sharing
I am trying to install libogg file. I am getting following error.
Making install in src
.././install-sh -c -d '/usr/lib'
/bin/sh ../libtool --mode=install /usr/bin/install -c libogg.la '/usr/lib'
libtool: install: /usr/bin/install -c .libs/libogg.0.dylib /usr/lib/libogg.0.dylib
install: /usr/lib/libogg.0.dylib: Permission denied
make[2]: *** [install-libLTLIBRARIES] Error 71
make[1]: *** [install-am] Error 2
make: *** [install-recursive] Error 1
You need administrator privilege to install items in /usr/lib which is a system directory.
If you ran the command make install to get the result shown above, run the command:
sudo make install
and enter your administrator (root) password when prompted to write to the system directory.
It's somewhat unusual for open source software to install itself in /usr/lib, much more common to use /usr/local/lib but that's a different question.
Because default GCC in Cygwin is 4.5.3, I tried to install GCC 4.7.2. I have dowloaded tar.bz archive from here, put it to cygwin\usr\gcc-4.7.2 and proceed the following sequence:
tar xvf gcc-4.7.2.tar.bz2
cd gcc-4.7.2
./contrib/download_prerequisites
mkdir build
cd build
../configure --build=x86_64-linux-gnu --prefix=/usr/gcc-4.7.2 --enable-checking=release --enable-languages=c,c++ --disable-multilib --program-suffix=-4.7
make
sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
sudo make install
I stucked at make with the following error: (after more than one hour)
make[3]: Leaving directory `/usr/gcc-4.7.2/build/gcc'
mkdir -p -- x86_64-linux-gnu/libgcc
Checking multilib configuration for libgcc...
Configuring stage 1 in x86_64-linux-gnu/libgcc
configure: creating cache ./config.cache
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking for x86_64-linux-gnu-ar... ar
checking for x86_64-linux-gnu-lipo... lipo
checking for x86_64-linux-gnu-nm... /usr/gcc-4.7.2/build/./gcc/nm
checking for x86_64-linux-gnu-ranlib... ranlib
checking for x86_64-linux-gnu-strip... strip
checking whether ln -s works... yes
checking for x86_64-linux-gnu-gcc... /usr/gcc-4.7.2/build/./gcc/xgcc -B/usr/gcc-4.7.2/build/./gcc/ -B/usr/gcc-4.7.2/x86_64-linux-gnu/bin/ -B/usr/gcc-4.7.2/x86_64-linux-gnu/lib/ -isystem /usr/gcc-4.7.2/x86_64-linux-gnu/include -isystem /usr/gcc-4.7.2/x86_64-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/usr/gcc-4.7.2/build/x86_64-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Makefile:15654: recipe for target `configure-stage1-target-libgcc' failed
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/usr/gcc-4.7.2/build'
Makefile:19334: recipe for target `stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/usr/gcc-4.7.2/build'
Makefile:903: recipe for target `all' failed
make: *** [all] Error 2
Does this log contain enoung information, to say what went wrong?
The full log is much more bigger so I allowed myself to put only the part of him. The instruction that I used, I found on Pastebin: http://pastebin.com/1MBaAikB
Could anyone give me a tip how could I solve this problem?
EDIT 1:
I trieid to achieve it in annother way. I found an installation description on http://matpack.de/cygwin/index.html
tar -xf gcc-4.7.2.tar.bz2
mkdir gcc-build
cd gcc-build
../gcc-4.7.2/configure --enable-languages=c,c++
make -j 4
make install
make clean (OPTIONAL)
cd ..
The error that I got, is connected now with 'permission denided'. Error log: http://pastebin.com/0stdpFKf
How this is possible?
I had come across the same problem. Just I have exported the library path of mpc, mpfr and gmp libraries to the LD_LIBRARY_PATH environment variable, then it is working.
GCC 4.7.2 is now available as a test release. In setup.exe, toggle the version numbers for all the gcc4-* packages, as well as libgcc1, libstdc++6, etc., until a 4.7 version is shown. Just keep in mind that you will have to elect to Keep each of these again during subsequent runs of setup.exe, until such time that they are declared stable.