When I try to compile GCC 4.8.0 as a part of a greater system, in a custom directory. I have no sudo rights on this server and therefore I'm building everything from source. However, I can't get the dependencies gmp, mpfr and mpc to work. When running configure it gives me:
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.
config.log gives me:
configure:5619: checking for the correct version of the gmp/mpfr/mpc libraries
configure:5650: gcc -o conftest -g -O2 -Wno-error=unused-value -I$SRC/gmp/ -I$SRC/mpc/src/.libs -lmpc -lmpfr -lgmp >&5
/usr/bin/ld: cannot find -lmpc
collect2: ld returned 1 exit status
So I tried to get mpfr, gmp and mpc and build it manually from source, as I have no rights to install on the system itself. I ran ./contrib/download_prerequisites to get the libraries. I ran configure again, it gave me the same error. So I also compiled them and in my gcc dir I did:
cd mpfr; ./configure; make
cd ../gmp; ./configure; make
cd ../mpc; ./configure --with-mpfr-include=$SRC/mpfr --with-mpfr-lib=$SRC/mpfr/.libs/ --with-gmp=$SRC/gmp; make; cd ..
Note that just using --with-mpfr did not work for some reason.
cd $SRC/build
../configure \
--build=x86_64-linux-gnu \
CC=gcc \
CFLAGS='-g -O2 -Wno-error=unused-value' \
--disable-bootstrap --enable-checking=none \
--disable-multi-arch --disable-multilib \
--enable-languages=c,c++ \
--with-gmp-lib=$SRC/gmp/.libs \
--with-gmp-include=$SRC/gmp/ \
--with-mpc-include=$SRC/mpc/src \
--with-mpc=$SRC/mpc \
--with-mpfr-lib=$SRC/mpfr/.libs \
--with-mpfr-include=$SRC/mpfr \
--prefix=$SRC/prefix
where $SRC is my gcc directory. However, at the last command it gave me this error in the build/config.log:
gcc -o conftest -g -O2 -Wno-error=unused-value -I$SRC/gmp/ -I$SRC/mpfr -I$SRC/mpc/src conftest.c -L$SRC/gmp/.libs -L$SRC/mpfr/.libs -L$SRC/mpc/lib -lmpc -lmpfr -lgmp >&5
/usr/bin/ld: cannot find -lmpc
collect2: ld returned 1 exit status
It is obvious that after running make mpc does not have a lib directory, or anything containing shared object files. So I do not know how I have to link gcc with the mpc library.
Does anyone know what I should do?
Related
I am using MacOS Mojave version 10.14.16 and I am trying to install http://www.rpl2.net/index.php (a programming language using Reverse Polish Notation as found on some HP calculators like the 48GX), supposed to work on MacOSX (they say "MacOS X (Xcode 3.1.4 + gfortran 4.5)").
So I have downloaded the latest stable release, cd to the folder, and wanted to run
./configure
make
make install
But the ./configure is failing due to "configure: error: Can not find libgomp !". There is no libgomp package I can install with brew (I already installed gcc which comes with gfortran and thought it would provide libgomp but apparently not).
Could someone help a poor applied mathematician trying to install a software on its macbook?
Thanks
EDIT
in my config.log I have this, maybe it will help:
configure:7433: checking for vim
configure:7449: found /usr/bin/vim
configure:7461: result: yes
configure:7507: checking for main in -lm
configure:7526: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lm >&5
configure:7526: $? = 0
configure:7535: result: yes
configure:7548: checking for pthread_mutex_init in -lc
configure:7573: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lc -lm >&5
configure:7573: $? = 0
configure:7582: result: yes
configure:7687: checking for omp_get_num_procs in -lgomp
configure:7712: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lgomp -lc -lm >&5
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:7712: $? = 1
You don't say how you installed GCC. If you did it using homebrew, and
brew install gcc
you should be able to see:
/usr/local/Cellar/gcc/10.2.0/lib/gcc/10/libgomp.dylib
which would mean you need to compile with:
gcc ... -L /usr/local/Cellar/gcc/10.2.0/lib/gcc/10 -l gomp ...
Failing that, you can always search for libgomp with:
find /usr -name "lib*gomp*lib"
You can test which gcc you are using with:
type gcc
I was building gnu C/C++ compiler tools under windows 7 using Cygwin environment.
I am getting following errors while building the glibc . I have tried glibc 2.23 through glibc 2.30 sources.
During building all of them linker shows the same error : undefined reference to `_DYNAMIC'
I am trying to build a cross tool that will run under windows that will generate linux elf executables to run on the linux OS.
I was wondering if someone can help
I used bin utils 2.30 and 2.32
Linux headers 3.xx through 5.xx
Gcc 4.9.1 through 9.1.0
Glibc 2.23 through 2.30
target =i686-elf
DUMP from the screen
mv -f /home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/rtld-libc.aT /home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/rtld-libc.a
make[3]: Leaving directory '/home/RahmanA/src/gcc_port_4.9.1/glibc-2.23/elf'
i686-elf-gcc -nostdlib -nostartfiles -r -o /home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/librtld.os '-Wl,-(' /home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/dl-allobjs.os /home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/rtld-libc.a -lgcc '-Wl,-)' \
-Wl,-Map,/home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/librtld.os.map
i686-elf-gcc -nostdlib -nostartfiles -shared -o /home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/ld.so.new \
-Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs \
/home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/librtld.os -Wl,--version-script=/home/RahmanA/src/gcc_port_4.9.1/build-glibc/ld.map \
-Wl,-soname=ld-linux.so.2 \
-Wl,-defsym=_begin=0
/home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/librtld.os: In function `elf_machine_load_address':
**/home/RahmanA/src/gcc_port_4.9.1/glibc-2.23/elf/../sysdeps/i386/dl-machine.h:58: undefined reference to `_DYNAMIC'
/home/RahmanA/src/gcc_port_4.9.1/build-glibc/elf/librtld.os: In function `elf_get_dynamic_info':
/home/RahmanA/src/gcc_port_4.9.1/glibc-2.23/elf/get-dynamic-info.h:45: undefined reference to `_DYNAMIC'**
I'm trying to build Guile 2.2.
I've installed libunistring to /path/to/libunistring.
When I run
./configure --with-libunistring-prefix=/path/to/libunistring/
it fails, because it can't find libunistring.
configure:15954: checking for libunistring
configure:15976: gcc -std=gnu11 -o conftest -g -O2 conftest.c -lunistring >&5
conftest.c:158:21: fatal error: uniconv.h: No such file or directory
#include <uniconv.h>
How do I fix this?
The configure script is searching for /path/to/libunistring/lib64/. I believe you have only /path/to/libunistring/lib/.
% ln -s /path/to/libunistring/lib /path/to/libunistring/lib64
I followed these instructions from github to clone and build the boost libraries.
https://github.com/boostorg/boost/wiki/Getting-Started
The end of the ./b2 command tells me
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/home/user/Desktop/boost
The following directory should be added to linker library paths:
/home/user/Desktop/boost/stage/lib
What should I do with these folders? I would like to put boost in the "regular place it should go in order for gcc to see it".
This is probably /usr/include ? Is it safe for me to move the folder boost to this location? What about the boost/stage/lib folder. Where does this go?
gcc -v /dev/null -o /dev/null
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC)
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/:/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/6.3.1/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/6.3.1/:/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' '/dev/null' '-mtune=generic' '-march=x86-64'
/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/6.3.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/lto-wrapper -plugin-opt=-fresolution=/tmp/cce2dq2i.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /dev/null /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/6.3.1/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1 -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../.. /dev/null -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/6.3.1/crtend.o /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../lib64/crtn.o
/dev/null: file not recognized: File truncated
collect2: error: ld returned 1 exit status
I would like to put boost in the "regular place it should go in order for gcc to see it".
For gcc run cpp -v /dev/null -o /dev/null. In its output there are include search directories and LIBRARY_PATH with a list of library search directories. These are the regular places. Copying the headers and libraries into the regular places normally requires root permissions.
Alternatively, use -I/home/user/Desktop/boost extra command line option when compiling and -L/home/user/Desktop/boost/stage/lib -Wl,-rpath=/home/user/Desktop/boost/stage/lib when linking to use it from the current location.
Another way to build boost (and other 3rd-party libraries) is to have it installed in a separate directory, e.g. /usr/local with versioned directories, e.g. /usr/local/boost-1.60.0.
To build boost into /usr/local/boost-1.60.0 do the following commands in bash:
$ cd boost-1.60.0 # The directory with boost sources.
$ JOBS=8
$ PREFIX=/usr/local/boost-1.60.0
$ mkdir -p ${PREFIX}
$ ./bootstrap.sh --prefix=${PREFIX} --libdir=${PREFIX}/lib64
$ B2FLAGS="-j${JOBS} --layout=system --disable-icu variant=release link=shared threading=multi runtime-link=shared linkflags=-Wl,-rpath,${PREFIX}/lib64 boost.locale.icu=off boost.locale.iconv=on"
$ ./b2 ${B2FLAGS}
$ ./b2 ${B2FLAGS} install
The linkflags=-Wl,-rpath,${PREFIX}/lib64 bit makes sure that when you run your application boost shared libraries that depend on other boost shared libraries find them in that ${PREFIX}/lib64 directory.
And then use the following flags when builing your applications with boost you just built:
Flags for compiling (CPPFLAGS): -I/usr/local/boost-1.60.0/include.
Flags for linking (LDFLAGS): -L/usr/local/boost-1.60.0/lib64 -Wl,-rpath=/usr/local/boost-1.60.0/lib64.
Using RHEL6, kernel version 2.6.32-573.3.1.el6.x86_64.
Configure and make succeed without error. During the make install process, however:
gcc -c -g -O2 -gnatpg -gnatwns -W -Wall -nostdinc -I- -I. -Iada/generated
-Iada -I../../gcc-5.2.0/gcc/ada -I../../gcc-5.2.0/gcc/ada/gcc-interface
../../gcc-5.2.0/gcc/ada/gnat1drv.adb -o ada/gnat1drv.o
gnatbind -nostdinc -I- -I. -Iada/generated -Iada -I../../gcc-5.2.0/gcc/ada
-I../../gcc-5.2.0/gcc/ada/gcc-interface -o b_gnat1.adb -n ada/gnat1drv.ali
fatal error: file s-stalib.ali is incorrectly formatted
make sure you are using consistent versions of gcc/gnatbind
==================================
[root#server1 ~]# which gcc
/usr/bin/gcc
[root#server1 ~]# which gnatbind
/usr/bin/gnatbind
[root#server1 Notes]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16
[root#server1 Notes]# gnatbind --version
GNATBIND 4.4.7 20120313 (Red Hat 4.4.7-16)
==================================
configure, make, make install are all executed from a separate build directory, NOT the source directory
==================================
wget http://mirrors-usa.go-parts.com/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.gz
tar -xvf gcc-5.2.0.tar.gz
mkdir gcc-5.2.0-build
cd gcc-5.2.0-build
==================================
../gcc-5.2.0/configure --prefix=/usr/local/pkg/gcc/5.2.0 \
--enable-bootstrap \
--enable-shared \
--enable-threads=posix \
--enable-checking=release \
--with-system-zlib \
--enable-__cxa_atexit \
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go \
--enable-java-awt=gtk \
--with-tune=generic \
--with-arch_32=i686 \
--build=x86_64-redhat-linux 2>&1 | tee CONFIGURE.OUT
==================================
I'm pretty stumped on this. We used these same configuration options when we installed gcc 4.9.2, on the same server, also this year (no major updates or changes since then), and didn't get this error.
I'm happy to update this question with any other info that may be relevant, please let me know.
Probably your 4.4.7 hosted gcc is too old to directly build 5.2.0. You should try to build first an intermediate version, say 4.8.4, then build the 5.2.0 with the newly built compiler. I succeeded in building 5.2.0 with a 4.7.1 on Slackware.