solaris - compile 64bit gcc - elf class error - gcc

I'm installing a modern version of gcc on solaris. I compiled gmp, mpfr and mpc, they're all 64bit. When I try to configure gcc as follows I get an error complaining that mpc,mpfr and gmp are the wrong elf class. What gives?
./../gcc-4.5.1/configure --prefix=/opt/OurAppDir/gcc --with-gmp=/opt/OurAppDir/gmp --with-mpfr=/opt/OurAppDir/mpfr --with-gnu-as --with-gnu-ld --build=sparc-sun-solaris2.10
checking build system type... sparc-sun-solaris2.10
checking host system type... sparc-sun-solaris2.10
checking target system type... sparc-sun-solaris2.10
checking for a BSD-compatible install... ./../gcc-4.5.1/install-sh -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp $$f1 $$f2 16 16
checking for objdir... .libs
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... yes
checking for the correct version of the gmp/mpfr/mpc libraries... 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.
config.log errors
configure:5474: checking for the correct version of gmp.h
configure:5494: gcc -c -g -O2 -I/opt/OurAppDir/gmp/include -I/opt/OurAppDir/mpfr/include conftest.c >&5
configure:5494: $? = 0
configure:5512: gcc -c -g -O2 -I/opt/OurAppDir/gmp/include -I/opt/OurAppDir/mpfr/include conftest.c >&5
configure:5512: $? = 0
configure:5513: result: yes
configure:5529: checking for the correct version of mpfr.h
configure:5547: gcc -c -g -O2 -I/opt/OurAppDir/gmp/include -I/opt/OurAppDir/mpfr/include conftest.c >&5
configure:5547: $? = 0
configure:5564: gcc -c -g -O2 -I/opt/OurAppDir/gmp/include -I/opt/OurAppDir/mpfr/include conftest.c >&5
configure:5564: $? = 0
configure:5565: result: yes
configure:5582: checking for the correct version of mpc.h
configure:5599: gcc -c -g -O2 -I/opt/OurAppDir/gmp/include -I/opt/OurAppDir/mpfr/include conftest.c >&5
configure:5599: $? = 0
configure:5615: gcc -c -g -O2 -I/opt/OurAppDir/gmp/include -I/opt/OurAppDir/mpfr/include conftest.c >&5
configure:5615: $? = 0
configure:5616: result: yes
configure:5634: checking for the correct version of the gmp/mpfr/mpc libraries
configure:5665: gcc -o conftest -g -O2 -I/opt/OurAppDir/gmp/include -I/opt/OurAppDir/mpfr/include -R/usr/sfw/lib/sparcv9 conftest.c -L/opt/OurAppDir/gmp/lib -L/opt/OurAppDir/m
pfr/lib -lmpc -lmpfr -lgmp >&5
ld: fatal: file /opt/OurAppDir/mpfr/lib/libmpc.so: wrong ELF class: ELFCLASS64
ld: fatal: file /opt/OurAppDir/mpfr/lib/libmpfr.so: wrong ELF class: ELFCLASS64
ld: fatal: file /opt/OurAppDir/gmp/lib/libgmp.so: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to conftest

With the default configure line, GCC will not be built as a 64-bit binary, but as 32-bit. So, you need to rebuild GMP, MPFR and MPC in 32-bit mode, by forcing configure ABI=32.
Alternatively, you can configure GCC with a sparc64-sun-solarisX build triplet. In that case, there are additional instructions on the GCC website.

You don't need 64-bit gcc binaries in order to build 64-bit application. The OpenCSW Solaris packages provide 32-bit compiler with 32-bit and 64-bit targets.
I assume you care more about being able to generate 64-bit binaries from your gcc, and less about gcc itself being 64-bit.
The way to build both 32-bit and 64-bit targets, you need to build gmp two times, once 32-bit and once 64-bit. Then you have the following layout (the example is taken from package's pkgmap):
1 f none /opt/csw/include/gmp-32.h 0644 root bin 86213 38841 1316878625
1 f none /opt/csw/include/gmp-64.h 0644 root bin 86218 39139 1316879685
1 f none /opt/csw/include/gmp.h 0755 root bin 159 12880 1316879688
1 f none /opt/csw/include/gmpxx-32.h 0644 root bin 114646 51865 1316878625
1 f none /opt/csw/include/gmpxx-64.h 0644 root bin 114646 51865 1316879685
1 f none /opt/csw/include/gmpxx.h 0755 root bin 163 13360 1316879688
1 s none /opt/csw/lib/libgmp.so=libgmp.so.10.0.2
1 s none /opt/csw/lib/libgmpxx.so=libgmpxx.so.4.2.2
1 s none /opt/csw/lib/libgmp.so.10=libgmp.so.10.0.2
1 f none /opt/csw/lib/libgmp.so.10.0.2 0755 root bin 462552 51359 1316878625
1 s none /opt/csw/lib/sparcv9/libgmp.so.10=libgmp.so.10.0.2
1 f none /opt/csw/lib/sparcv9/libgmp.so.10.0.2 0755 root bin 503424 11223 1316879684
The GCC build system is smart enough to know to look into /opt/csw/lib/sparcv9 for the 64-bit libraries and into /opt/csw/lib for the 32-bit libraries.
The gmp.h header file is a wrapper, which contains an #ifdef statement, including gmp-32.h or gmp-64.h depending on the compilation mode requested.
/* Allow 32 and 64 bit headers to coexist */
#if defined __amd64 || defined __x86_64 || defined __sparcv9
#include "gmp-64.h"
#else
#include "gmp-32.h"
#endif
The gmp library is the only one which requires this kind of header file wrapper; the mpc, mpfr, ppl and cloog libraries don't vary the header files depending on the architecture / word length.
When you compile gcc with 64-bit targets, you get a layout with two crt1.o files:
/opt/csw/lib/gcc/sparc-sun-solaris2.9/4.6.2/crt1.o
/opt/csw/lib/gcc/sparc-sun-solaris2.9/4.6.2/sparcv9/crt1.o
This way, when you pass -m64, gcc will produce a 64-bit binary.

Related

problems when configure omnet (omnetpp-5.4.1)

I have run into probelms when configure omnetpp-5.1.1 on windows10
I have installed gcc sucessfully as showed below:
PS C:\Users\admin> gcc -v
specs
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe
mingw32
../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls
win32
gcc 6.3.0 (MinGW.org GCC-6.3.0-1)
2.when I follow the instructions and Type "./configure"
the problem ouccurs: here is my log
/d/softwares/omnet/omnetpp/omnetpp-5.4.1$ ./configure
configure: loading site script /mingw64/etc/config.site
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
configure: -----------------------------------------------
configure: reading configure.user for your custom settings
configure: -----------------------------------------------
checking for clang... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking for clang++... clang++
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ accepts -g... yes
checking for clang++... clang++
checking for ranlib... ranlib
checking whether clang++ supports -fno-stack-protector... yes
checking whether clang++ supports -Wl,--no-as-needed... yes
checking whether clang++ supports -Wl,--as-needed... yes
checking for swapcontext... no
checking if shared libs need -fPIC... no
checking for dlopen with CFLAGS="" LIBS=""... no
checking if --export-dynamic linker option is supported/needed... test failed
checking for flags needed to link with static libs containing simple modules... --whole-archive
configure: NOTE: Use the following syntax when linking with static libraries
configure: containing simple modules and other dynamically registered components:
configure: clang++ ... -Wl,--whole-archive <libs> -Wl,--no-whole-archive ...
checking whether linker supports -rpath... yes
checking for bison... bison -y
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for make... make
checking for perl... perl
checking for swig... not found
checking for math with CFLAGS="" LIBS=""... yes
**checking for standard C++ lib with CFLAGS="" LIBS="-lstdc++"... no
checking for standard C++ lib with CFLAGS="" LIBS="-lc++"... no
checking for standard C++ lib with CFLAGS="" LIBS="-lcxa"... no**
configure: error: Standard C++ library -lstdc++_s or -lstdc++ or -lcxx or -lcxa or -lc++ not found
# here is the probelm
It always shows the probelms missing C++ lib, but I don't know if it's the broken lib's problem. If so, what should I do to fix this problem.
Please help me. Thanks a lot!
OMNeT++ for Windows does not require installing external GCC from MinGW. All necessary tools and libraries are already present in the ZIP package.
Make sure that real-time protection in your antivirus is turned off during calling ./configure and make.

1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed

I have php 7.3.4 installed on my macbook pro and I am trying to enable a php extension which composer requires (intl). I have enabled the extension intl in php.ini, to which I received an error message saying it can not be found - so I'm assuming this means I need to install it. I found a tutorial online on how to install the extensions (link at bottom), and I followed this.
At the stage where when I run sudo pecl install intl, I receive an error;
make: *** [php_intl.lo] Error 1
ERROR: `make' failed
Does anyone have a solution?
Jamess-MBP:~ work$ sudo pecl install intl
Password: .........
PHP Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0
downloading intl-3.0.0.tgz ...
Starting to download intl-3.0.0.tgz (248,200 bytes)
....................................................done: 248,200 bytes
150 source files, building
running: phpize
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
Specify where ICU libraries and headers can be found [DEFAULT] : /usr/local/Cellar/icu4c/63.1/
building in /private/tmp/pear/temp/pear-build-rootf9ZgsV/intl-3.0.0
running: /private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/Cellar/php/7.3.4/bin/php-config --with-icu-dir=/usr/local/Cellar/icu4c/63.1/
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin17.7.0
checking host system type... x86_64-apple-darwin17.7.0
checking target system type... x86_64-apple-darwin17.7.0
checking for PHP prefix... /usr/local/Cellar/php/7.3.4
checking for PHP includes... -I/usr/local/Cellar/php/7.3.4/include/php -I/usr/local/Cellar/php/7.3.4/include/php/main -I/usr/local/Cellar/php/7.3.4/include/php/TSRM -I/usr/local/Cellar/php/7.3.4/include/php/Zend -I/usr/local/Cellar/php/7.3.4/include/php/ext -I/usr/local/Cellar/php/7.3.4/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php/7.3.4/pecl/20180731
checking for PHP installed headers prefix... /usr/local/Cellar/php/7.3.4/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable internationalization support... yes, shared
checking for location of ICU headers and libraries... checking for pkg-config... /usr/local/bin/pkg-config
/usr/local/Cellar/icu4c/63.1
checking for ICU 4.0 or greater... found 63.1
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by cc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.7.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common
checking if g++ PIC flag -fno-common works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.7.0 dyld
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootf9ZgsV/intl-3.0.0/libtool --mode=compile cc -I/usr/local/Cellar/icu4c/63.1/include -Wno-write-strings -I. -I/private/tmp/pear/temp/intl -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootf9ZgsV/intl-3.0.0/include -I/private/tmp/pear/temp/pear-build-rootf9ZgsV/intl-3.0.0/main -I/private/tmp/pear/temp/intl -I/usr/local/Cellar/php/7.3.4/include/php -I/usr/local/Cellar/php/7.3.4/include/php/main -I/usr/local/Cellar/php/7.3.4/include/php/TSRM -I/usr/local/Cellar/php/7.3.4/include/php/Zend -I/usr/local/Cellar/php/7.3.4/include/php/ext -I/usr/local/Cellar/php/7.3.4/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/63.1/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/intl/php_intl.c -o php_intl.lo
mkdir .libs
cc -I/usr/local/Cellar/icu4c/63.1/include -Wno-write-strings -I. -I/private/tmp/pear/temp/intl -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootf9ZgsV/intl-3.0.0/include -I/private/tmp/pear/temp/pear-build-rootf9ZgsV/intl-3.0.0/main -I/private/tmp/pear/temp/intl -I/usr/local/Cellar/php/7.3.4/include/php -I/usr/local/Cellar/php/7.3.4/include/php/main -I/usr/local/Cellar/php/7.3.4/include/php/TSRM -I/usr/local/Cellar/php/7.3.4/include/php/Zend -I/usr/local/Cellar/php/7.3.4/include/php/ext -I/usr/local/Cellar/php/7.3.4/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/63.1/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/intl/php_intl.c -fno-common -DPIC -o .libs/php_intl.o
In file included from /private/tmp/pear/temp/intl/php_intl.c:25:
In file included from /private/tmp/pear/temp/intl/php_intl.h:34:
/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error: 'ext/standard/php_smart_str.h' file not found
#include <ext/standard/php_smart_str.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [php_intl.lo] Error 1
ERROR: `make' failed
I followed an online tutorial to get to this stage, this was http://budiirawan.com/install-php-intl-extension-os-x/
Please follow the process (from https://medium.com/#agaetis/solved-install-intl-php-extension-for-xampp-and-magento-for-macos-mojave-41fa42336fc6)
Steps to install intl.so: correct intl ships with PHP source, not available in PECL.
Make sure Xcode and autoconf is installed
Download PHP version used in XAMPP from php.net and run series of command
tar -xzvf php-7.3.10.tar.gz; cd php-7.3.10/ext/intl
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
add below line in php.ini (/Applications/XAMPP/xamppfiles/etc/php.ini)
extension=intl.so
I’ve solved this myself by installing the extension with macports rather than pecl.

Debugging glibc build process

I am am trying to install glibc on Clear Linux, and am having difficulty debugging (or even which of the many makefiles to debug).
My previous attempts are in these two threads:
How do I build into a specified directory using the "prefix" option of configure?
Errors building glibc: what is wrong with the make/confgure files?
So now my problem is that when I run make, the build stops with:
-I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/x86_64 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multiarch -I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu -I../sysdeps/x86_64/multiarch -I../sysdeps/x86_64 -I../sysdeps/x86 -I../sysdeps/ieee754/float128 -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/james/Downloads/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DTOP_NAMESPACE=glibc -I../soft-fp -o /home/james/Downloads/glibc-build/math/s_modfl.o -MD -MP -MF /home/james/Downloads/glibc-build/math/s_modfl.o.dt -MT /home/james/Downloads/glibc-build/math/s_modfl.o
cc1: error: -fassociative-math disabled; other options take precedence [-Werror]
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:791: /home/james/Downloads/glibc-build/math/s_modfl.o] Error 1
make[2]: Leaving directory '/home/james/Downloads/glibc/math'
make[1]: *** [Makefile:215: math/subdir_lib] Error 2
make[1]: Leaving directory '/home/james/Downloads/glibc'
make: *** [Makefile:9: all] Error 2
I suspect a clue might be in this thread, but it's a little over my head.
associative-math with GCC
I'm also guessing that the later errors from the makefiles are the result of whatever went wrong with associative math.
Edit
As requested, I ran
james#clr ~/Downloads/glibc-build $ make -j
and this was the end of the output
-I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/james/Downloads/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -I../soft-fp -DASSEMBLER -g -Werror=undef -Wa,--noexecstack -o /home/james/Downloads/glibc-build/math/s_signbit.os -MD -MP -MF /home/james/Downloads/glibc-build/math/s_signbit.os.dt -MT /home/james/Downloads/glibc-build/math/s_signbit.os
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:791: /home/james/Downloads/glibc-build/math/s_modfl.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:825: /home/james/Downloads/glibc-build/math/s_modf.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:893: /home/james/Downloads/glibc-build/math/s_modff.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:757: /home/james/Downloads/glibc-build/math/s_modff128.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:807: /home/james/Downloads/glibc-build/math/s_modfl.os] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:841: /home/james/Downloads/glibc-build/math/s_modf.os] Error 1
make[2]: Leaving directory '/home/james/Downloads/glibc/math'
make[1]: *** [Makefile:215: math/subdir_lib] Error 2
make[1]: Leaving directory '/home/james/Downloads/glibc'
make: *** [Makefile:9: all] Error 2
edit 2: more information in response to comments by Basile:
I need glibc to run some modules for Phoronix Test Suite, and in the future I will probably need it to build libraries for R. As far as I can tell, it is not included with Clear Linux (at least PTS doesn't think I have it installed), and I do not see it among the list of available bundles.
Versions:
james#clr ~/Downloads $ uname -r
4.17.1-582.native
james#clr ~/Downloads $ gcc --version
gcc (Clear Linux OS for Intel Architecture) 8.1.1 20180514
Copyright (C) 2018 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 commands
james#clr ~/Downloads $ git clone git://sourceware.org/git/glibc.git
james#clr ~/Downloads $ cd glibc
james#clr ~/Downloads/glibc $ git checkout --track -b local_glibc-2.27 origin/release/2.27/master
Branch 'local_glibc-2.27' set up to track remote branch 'release/2.27/master' from 'origin'.
Switched to a new branch 'local_glibc-2.27'
james#clr ~/Downloads/glibc $ mkdir /home/james/Downloads/glibc-build/
james#clr ~/Downloads/glibc $ cd /home/james/Downloads/glibc-build/
james#clr ~/Downloads/glibc-build $ ~/Downloads/glibc/configure --prefix=/home/james/Downloads/glibc-build
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ can link programs... yes
checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc tile x86_64 checking whether gcc compiles in -mx32 mode by default... no
checking for use of fpu sysdeps directories... yes
checking for -fstack-protector... yes
checking for -fstack-protector-strong... yes
checking for -fstack-protector-all... yes
checking for assembler and linker STT_GNU_IFUNC support... yes
checking for gcc attribute ifunc support... yes
checking if compiler warns about alias for function with incompatible types... yes
checking sysdep dirs... sysdeps/unix/sysv/linux/x86_64/64 sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/x86 sysdeps/x86/nptl sysdeps/unix/sysv/linux/wordsize-64 sysdeps/x86_64/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/x86_64 sysdeps/unix sysdeps/posix sysdeps/x86_64/64 sysdeps/x86_64/fpu/multiarch sysdeps/x86_64/fpu sysdeps/x86/fpu sysdeps/x86_64/multiarch sysdeps/x86_64 sysdeps/x86 sysdeps/ieee754/float128 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64/wordsize-64 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/wordsize-64 sysdeps/ieee754 sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether as is GNU as... yes
checking whether ld is GNU ld... yes
checking for as... as
checking version of as... 2.30, ok
checking for ld... ld
checking version of ld... 2.30, ok
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 4.2.1, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.19.8.1, ok
checking for makeinfo... makeinfo
checking version of makeinfo... 6.5, ok
checking for sed... sed
checking version of sed... 4.5, ok
checking for gawk... gawk
checking version of gawk... 4.2.1, ok
checking for bison... bison
checking version of bison... 3.0.5, ok
checking if gcc is sufficient to build libc... yes
checking for nm... gcc-nm
checking for python3... python3
checking LD_LIBRARY_PATH variable... ok
checking for bash... /usr/bin/bash
checking for perl... /usr/bin/perl
checking for install-info... /usr/bin/install-info
checking for .set assembler directive... yes
checking linker support for protected data symbol... yes
checking linker support for INSERT in linker script... yes
checking for broken __attribute__((alias()))... no
checking whether to put _rtld_local into .sdata section... no
checking whether to use .ctors/.dtors header and trailer... no
checking for libunwind-support in compiler... no
checking whether --noexecstack is desirable for .S files... yes
checking for -z combreloc... yes
checking for linker that supports -z execstack... yes
checking for linker that supports --no-dynamic-linker... yes
checking for -static-pie... yes
checking for -fpie... yes
checking for --hash-style option... yes
checking for sufficient default -shared layout... no
checking for GLOB_DAT reloc... yes
checking linker output format... elf64-x86-64
checking for -fno-toplevel-reorder -fno-section-anchors... yes
checking for -mtls-dialect=gnu2... yes
checking whether cc puts quotes around section names... no
checking for __builtin_memset... no
checking for redirection of built-in functions... yes
checking for compiler option to disable generation of FMA instructions... -ffp-contract=off
checking if gcc accepts -fno-tree-loop-distribute-patterns with __attribute__ ((__optimize__))... yes
checking for libgd... yes
checking for is_selinux_enabled in -lselinux... no
checking for _FORTIFY_SOURCE predefine... yes
checking whether the linker provides working __ehdr_start... yes
checking for __builtin_trap with no external dependencies... yes
checking whether the C++ compiler supports thread_local... yes
running configure fragment for sysdeps/unix/sysv/linux/x86_64/64
running configure fragment for sysdeps/unix/sysv/linux/x86_64
running configure fragment for sysdeps/unix/sysv/linux
checking installed Linux kernel header files... 3.2.0 or later
checking for kernel header at least 3.2.0... ok
checking for symlinks in /home/james/Downloads/glibc-build/include... ok
running configure fragment for sysdeps/gnu
running configure fragment for sysdeps/unix/inet
running configure fragment for sysdeps/x86_64
checking for AVX512DQ support in assembler... yes
checking for AVX512 support... yes
checking for Intel MPX support... yes
checking whether -fPIC is default... no
checking whether -fPIE is default... no
configure: creating ./config.status
config.status: creating config.make
config.status: creating Makefile
config.status: creating config.h
config.status: executing default commands
Edit 3: The FULL output of make was too long to include, so I put it on pastebin:
https://pastebin.com/H3yGC5aj
The compiler command line you posed contains these flags:
-fassociative-math -fasynchronous-unwind-tables -feliminate-unused-debug-types -fexceptions -ffat-lto-objects -fmerge-all-constants -fno-semantic-interposition -fno-signed-zeros -fno-stack-protector -fno-trapping-math -frounding-math -fstack-protector -ftree-loop-distribute-patterns
However, -fassociative-math is one of the unsafe math optimizations, and glibc cannot be built with them because with such optimizations, the math library would produce wrong results—and as you found out, some of the required compiler flags for parts of the math library are even incompatible with them.
You did not pass these flags to configure or make explicitly, so it is most likely they come from the CFLAGS environment variable. You need to unset that before calling configure and make.

X11 headers not in El Capitan 10.11 SDK?

In OSX versions prior to Lion, I built X11 applications with the /usr/X11 path. It worked fine in Tiger and Snow Leopard.
After Lion, and because of a reason I no longer remember (I believe it was related to avoiding header mismatches from different SDK versions), I changed this approach and compiled all X11 apps avoiding /usr at all and using instead this: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.x.sdk (where the 'x' in 'MacOSX10.x.sdk' was the SDK version being used). This approach for building X11 apps has worked fine for me in Mountain Lion and Yosemite.
However, now I updated my system to El Capitan, and X11 applications configure scripts cannot find X11 anymore with -isysroot.
See, this is what I'm getting now with El Capitan, doing exactly the same that worked fine in Mountain Lion and Yosemite:
creating cache ./config.cache
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal-1.4... missing
checking for working autoconf... missing
checking for working automake-1.4... missing
checking for working autoheader... missing
checking for working makeinfo... found
checking for gcc... gcc
checking whether the C compiler (gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -L/usr/X11R6/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11) works... yes
checking whether the C compiler (gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -L/usr/X11R6/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ANSI C... none needed
checking for Cygwin environment... no
checking for mingw32 environment... no
checking host system type... i386-apple-darwin15.0.0
checking build system type... i386-apple-darwin15.0.0
checking for ld used by GCC... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking for a sed that does not truncate output... /usr/bin/sed
checking whether ln -s works... yes
checking how to recognise dependent libraries... file_magic Mach-O dynamically linked shared library
checking for object suffix... o
checking for executable suffix... no
checking command to parse /usr/bin/nm output... ok
checking for dlfcn.h... yes
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -fno-common
checking if gcc PIC flag -fno-common works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking how to hardcode library paths into programs... unsupported
checking whether stripping libraries is possible... no
checking dynamic linker characteristics... darwin15.0.0 dyld
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
creating libtool
checking for executable suffix... (cached) no
checking for byacc... no
checking for flex... flex
checking for flex... (cached) flex
checking for yywrap in -lfl... no
checking lex output file root... lex.yy
checking whether yytext is a pointer... no
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln -s works... (cached) yes
checking whether make sets ${MAKE}... (cached) yes
checking for X... no
I see however that /usr/X11 exists in my system (it's actually a link to /opt/X11 because El Capitan disallows /usr for non-Apple users, but /opt/X11 is correctly there, with all the X11 headers and libs).
Does this mean that X11 applications cannot be built with -isysroot anymore? Do I need to build them with the system root include path (which exists in /usr/include, BTW) ? (my system even has /usr/include/stdio.h and all standard headers, I've no idea why, because I believed all headers had been moved to the SDKs).
If affirmative, I don't feel confident with including from /usr/include instead of from the SDK include path... it makes me feel fear of SDK mismatches...
Thanks!!
Not sure if this solution is correct from an SDK-correctness perspective, but in 10.11 El Capitan it seems setting '-isysroot' is no longer enough for compiling X11 applications.
So, trying to use headers only from the SDK, and complementing them with X11 headers only (so the only "outsiders" are the X11 headers), I found that this solution works:
Options for the compile line: -I/opt/X11/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
Options for the link line: -L/opt/X11/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
As I said, I don't know if this is the correct way of doing it, but it (seems to) work. I'm using XQuartz 2.7.7, which is the latest release at the time of writing this.

configure fails with "C compiler cannot create executables"

Right now I'm trying to compile the google protocol buffers from source with MinGW but when I try:
Matthew#RaRemoz-8 /e/workspace/protobuf-2.5.0
$ ./configure
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/e/workspace/protobuf-2.5.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
and the config says: This
it seems to fail around this
configure:3474: checking whether the C compiler works
configure:3496: gcc conftest.c >&5
gcc.exe: error: CreateProcess: No such file or directory
configure:3500: $? = 1
configure:3538: result: no
heres the output of -v:
$ gcc -v helloworld.c
Using built-in specs.
COLLECT_GCC=E:\MinGW\bin\gcc.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=m
ingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto
--enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++
,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-l
ibstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gm
p-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --
with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-
libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/
mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=pentiumpro'
cc1 -quiet -v -iprefix E:\MinGWmingw32/4.8.1/ helloworld.c -quiet -dumpbase hel
loworld.c -mtune=generic -march=pentiumpro -auxbase helloworld -version -o C:\Us
ers\Matthew\AppData\Local\Temp\ccVVxhTh.s
gcc.exe: error: CreateProcess: No such file or directory
anyone encountered this or can help with this?
There's something wrong with your MinGW install, or maybe it's just that your PATH environment variable isn't set up quite right.
COLLECT_GCC indicates that gcc is in E:\MinGW\bin\gcc.exe
COLLECT_GCC_OPTIONS indicates that gcc couldn't locate cc1.exe, so it's trying to execute it as a simple cc1 command hoping that the system will find it by a normal PATH search. The system doesn't find it, so you get the CreateProcess error. Because the Target that GCC is built for is mingw32, I'd expect that cc1.exe would be located in E:\MinGW\libexec\gcc\mingw32\4.8.1\cc1.exe.
There's something else interesting about the cc1 invocation: it specifies the option -iprefix E:\MinGWmingw32/4.8.1/.
I'd expect it to look like: -iprefix E:\MinGW\bin\../lib/gcc/mingw32/4.8.1/
Something is munging the -iprefix option, but I'm not sure what.
I'd suggest reinstalling MinGW. As mentioned in one of my comments, I'd choose one of the following distributions since they've always installed in a straightforward manner for me. I can't say the same thing for the standard MinGW distribution installer, though I hear it's been greatly improved over the past few years.
nuwen.net's MinGW Distro - note that recent versions of this are 64-bit native, so it will only run on 64-bit machines and apparently will only build 64-bit binaries (distro versions before 11.0 were 32-bit native and only built 32-bit binaries). One very nice thing about nuwen MinGW is that installation is simply unpacking the archive and setting the path appropriately. There's a set_distro_paths.bat that will add it to the path for you. Nuwen's distribution also includes several libraries, including Boost. Unfortunately C++11 threads don't seem to be supported just yet.
TDM MinGW - you have a choice of 32-bit or 64-bit versions. The 64-bit version will build either 32 or 64-bit targets. The toolchain itself is a 32-bit build, so it doesn't need a 64-bit machine to perform the compile/link steps. Use the -m32 option to build a 32-bit target. The installer for TDM is a wizard-style installer. C++ 11 threads are supported, but Boost isn't included.

Resources