Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to make a clean development environment. To do so, I've made a jail shell (using chroot & a few rpm commands) which appears to be working well. I need to get gcc into that jail shell, but don't want to use the one supplied by yum - I need something newer for Qt.
I'm trying to compile gcc 4.2.7 outside of the jail shell with a prefix that's inside the jail shell. This is the only way I know how to compile as it appears you need a compiler to make the compiler. There's no compiler in the jail shell, so I'm doing it outside of the jail shell, using the CentOS 5.4 supplied 4.1.2 to make 4.2.7.
4.2.7 requires more recent versions of gmp, mpfr, and mpc. I've compiled all of those (again with a target of the new root's usr dir) & all seems to go well. My configure line:
The configure for gcc completes now that I point it at the new locations of gmp, etc, however, the build fails. If I look at the configure.log in the offending directory, I see a few errors:
Code:
configure:3407: /home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/xgcc -B/home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/bin/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/lib/ -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/include -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/sys-include -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.
configure:3418: $? = 1
configure:3407: /home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/xgcc -B/home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/bin/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/lib/ -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/include -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/sys-include -qversion >&5
xgcc: error: unrecognized command line option '-qversion'
xgcc: fatal error: no input files
compilation terminated.
configure:3418: $? = 1
configure:3434: /home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/xgcc -B/home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/bin/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/lib/ -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/include -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/sys-include -o conftest -g -O2 conftest.c >&5
/home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
configure:3437: $? = 1
configure:3625: checking for suffix of object files
configure:3647: /home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/xgcc -B/home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/bin/ -B/home/briank/jaildev/usr/x86_64-unknown-linux-gnu/lib/ -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/include -isystem /home/briank/jaildev/usr/x86_64-unknown-linux-gnu/sys-include -c -g -O2 conftest.c >&5
/home/briank/jaildev/home/briank/install/gcc-4.7.0/gcc-build/./gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
configure:3651: $? = 1
It looks like xgcc is getting a '-V', but if I run xgcc --help, I don't see that '-V' is an option ('-v' is, but not '-V').
I also see that it mentions is can't find libmpc.so.2, but libmpc.so.2 lives in the given mpc-lib dir:
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
CentOS5, build prerequisites for gcc-4.7.0 :
ppl(-0.11.2), libmpdclient(-2.7), cloog-ppl(-0.15.11) :
( I have those installed --prefix=/usr/ ).
No gmp, mpfr, mpc needs to be installed for the gcc build.
The sources gmp, mpfr, mpc, unpacked to gcc-4.7.0/ will do.
>>> Rename gmp-5.0.2/, mpfr-3.10/, mpc-0.9/ to gmp/ mpfr/ mpc/.
A valid configure line :
../gcc-4.7.0/configure --prefix=<prefix> --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,fortran --disable-multilib --with-mpfr-include=$(pwd)/../gcc-4.7.0/mpfr/src --with-mpfr-lib=$(pwd)/mpfr/src/.libs
( You will probably not want "gcc java", ada, etc.)
Have same for gcc 4.7.1pre at fedora 16 x64, but without shared library errors.
I try to build a cross-compiler:
Code:
../../gcc/configure --target=mips-elf --prefix=/home/build/gcc && make
and get errors listed below.
Shared libraries errors seems common, but current case contains just errors for xgcc and exec command line options.
As BrianK mentioned, there is no -V option in `xgcc --help` output.
Code:
configure:3398: checking for C compiler version
configure:3408: /mnt/tmp/gcc-obj/./gcc/xgcc -B/mnt/tmp/gcc-obj/./gcc/ -B/home/build/gcc/mips-elf/bin/ -B/home/build/gcc/mips-elf/lib/ -isystem /home/build/gcc/mips-elf/include -isystem /home/build/gcc/mips-elf/sys-include --version >&5
xgcc (GCC) 4.7.1 20120415 (prerelease)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3421: $? = 0
configure:3408: /mnt/tmp/gcc-obj/./gcc/xgcc -B/mnt/tmp/gcc-obj/./gcc/ -B/home/build/gcc/mips-elf/bin/ -B/home/build/gcc/mips-elf/lib/ -isystem /home/build/gcc/mips-elf/include -isystem /home/build/gcc/mips-elf/sys-include -v >&5
Reading specs from /mnt/tmp/gcc-obj/./gcc/specs
COLLECT_GCC=/mnt/tmp/gcc-obj/./gcc/xgcc
COLLECT_LTO_WRAPPER=/mnt/tmp/gcc-obj/./gcc/lto-wrapper
Target: mips-elf
Configured with: ../../gcc/configure --target=mips-elf --prefix=/home/build/gcc
Thread model: single
gcc version 4.7.1 20120415 (prerelease) (GCC)
configure:3421: $? = 0
configure:3408: /mnt/tmp/gcc-obj/./gcc/xgcc -B/mnt/tmp/gcc-obj/./gcc/ -B/home/build/gcc/mips-elf/bin/ -B/home/build/gcc/mips-elf/lib/ -isystem /home/build/gcc/mips-elf/include -isystem /home/build/gcc/mips-elf/sys-include -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.
configure:3421: $? = 1
configure:3408: /mnt/tmp/gcc-obj/./gcc/xgcc -B/mnt/tmp/gcc-obj/./gcc/ -B/home/build/gcc/mips-elf/bin/ -B/home/build/gcc/mips-elf/lib/ -isystem /home/build/gcc/mips-elf/include -isystem /home/build/gcc/mips-elf/sys-include -qversion >&5
xgcc: error: unrecognized command line option '-qversion'
xgcc: fatal error: no input files
compilation terminated.
configure:3421: $? = 1
configure:3437: /mnt/tmp/gcc-obj/./gcc/xgcc -B/mnt/tmp/gcc-obj/./gcc/ -B/home/build/gcc/mips-elf/bin/ -B/home/build/gcc/mips-elf/lib/ -isystem /home/build/gcc/mips-elf/include -isystem /home/build/gcc/mips-elf/sys-include -o conftest -g -O2 conftest.c >&5
/mnt/tmp/gcc-obj/./gcc/as: line 87: exec: -E: invalid option
exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
configure:3440: $? = 1
configure:3628: checking for suffix of object files
configure:3650: /mnt/tmp/gcc-obj/./gcc/xgcc -B/mnt/tmp/gcc-obj/./gcc/ -B/home/build/gcc/mips-elf/bin/ -B/home/build/gcc/mips-elf/lib/ -isystem /home/build/gcc/mips-elf/include -isystem /home/build/gcc/mips-elf/sys-include -c -g -O2 conftest.c >&5
/mnt/tmp/gcc-obj/./gcc/as: line 87: exec: -E: invalid option
exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
configure:3654: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3668: error: in `/mnt/tmp/gcc-obj/mips-elf/libgcc':
configure:3671: error: cannot compute suffix of object files: cannot compile
For the short attention span. LD_LIBRARY_PATH, by default, is not seen when you run make as sudo.
Longer...
First off, qux is right, the "unrecognized command line option" was a red hearing. In fact, when looking through the configure script that made this message, you can see that it tried several different options - -v, -V, -qversion (maybe a couple others). One might think it short-circuits on success, but it doesn't seem to, so you will probably *always* get a few unrecognized option error messages, but they are benign.
The more important error was further down in the log file where it mentioned that it couldn't load one of the required-for-compile libs (mpc, gmp, mpfr), which was surprising as they existed in the path defined by LD_LIBRARY_PATH. This was my biggest head scratcher as it seemed everything it needed was there. I made a little bit of headway by forcibly moving a lib or two into the actual compile dir & realized it must be a pathing issue.
Long story less long... I was building this for a jail shell. I initially planned on building *in* the jail shell but found that to be more difficult than it was worth (the jail shell had *no* compiler), so I build outside the jail shell with a prefix in the jail shell. Being that the source was in the jail shell, I couldn't write to the build directory unless I ran configure & make as sudo. Because I was using new mpc, mpfr, gmp, (that were installed to non-standard locations) I needed to set an LD_LIBRARY_PATH. By default, LD_LIBRARY_PATH is not transfered to a sudo session, so when I was actually compiling, LD_LIB... wasn't set (even though it was set in my shell)... and that's why the compile couldn't see the new libs. The solution was to move the gcc source outside of the jail shell & compile with a target inside the jail shell so that the only thing that needed sudo was the make install.
Lastly, to correct knudfl, mpc, mpfr, and gmp *are* required to build newer gcc (in fact, configure will fail if you don't have newer versions than are supplied by CentOS 5.4). Mpc must be compiled against the newer versions of gmp & mpfr. (edited to change: knudfl said that those libs didn't need to be installed, which is correct. They just need to be made available to the compilation of gcc - which is what knudfl said. My mistake in correcting)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.