[tlbuild] gcc-6.1 and gcc-7.0 build results

Nelson H. F. Beebe beebe at math.utah.edu
Sat Apr 30 00:10:13 CEST 2016


Yesterday, we brought up two new 256GB 48-core x86-64 research boxes
running CentOS 7.2.1511 and after getting them suitably enhanced with
many package installations, I've been doing TeX Live 2016 builds on
them: 9 minutes wall-clock time with "make -j48".

The site

	http://www.math.utah.edu/pub/texlive/

and its bin subdirectory contain the new results.

I was curious to see whether TeX Live itself would have any issues
with the new gcc-6.1.0 and gcc-7-20160424 (== gcc-7.0.0.beta)
compilers: none were detected.

However, when I tried to build asymptote via the usual script, I got
C++ compilation failures like this:

	/usr/uumath/ashare/gcc/gcc-6.1.0/include/c++/6.1.0/bits/c++0x_warning.h:32:2: error:
	#error This file requires compiler and library support for the ISO C++ 2011 standard.
	 This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
	In file included from common.h:35:0,
			 from camperror.h:16,
			 from camperror.cc:14:

I finally tracked down multiple problems with asymptote that cause
those failures:

	* Although asymptote records the values of CC and CXX in
	  the Makefile, it uses passes CFLAGS, rather than CXXFLAGS,
	  to the CXX compiler!  The CFLAGS value, which I had not
	  set, get the -ansi option supplied by configure, and that
	  option sets  __cplusplus = 199711L.  The above header file
	  has the test

		#if __cplusplus < 201103L
		#error This file requires compiler and library support \
		for the ISO C++ 2011 standard. This support must be enabled \
		with the -std=c++11 or -std=gnu++11 compiler options.
		#endif

	  and even though gcc-6.1.0 initializes __cplusplus to 201402L,
	  the subsequent -ansi flag reverts that to 199711L.

	* The Makefile does not use the standard LDFLAGS value to pass
	  linker options; it does that with a variable named LFLAGS which
	  appears in these Makefile assigments:

		LFLAGS =
		LIBS = $(LFLAGS)  -lglut -lGLU -lGL -lreadline -lrt -lz -lm -lncurses  $(GCLIBS)

The problem with g++ is that each version has its own -lstdc++,
usually incompatible with those of other g++ compiler versions.  Thus,
if you use a nonnative g++ compiler, the executables produced will
have references to libstdc++.o in locations likely unknown at other
sites.

I found that this manual adjustment of two Makefile variables to force
use of a static -lstc++ produced a working asy:

	CFLAGS =  -I${prefix}/include -std=c++11 -I${prefix}/include -fno-var-tracking

and

	LFLAGS='/usr/uumath/ashare/gcc/gcc-6.1.0/lib64/libstdc++.a'
or
	LFLAGS=/usr/uumath/ashare/gcc/gcc-7-20160424/lib64/libstdc++.a

The resulting asy then has this library dependency:

	% ldd asy | grep libstdc
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ff1d90b5000)

and that should run on any recent x86-64 GNU/Linux system.

Given that asymptote is likely to be compiled with g++, it might be
sensible to include a final variable on the link command that creates
asy to allow overriding the default -lstdc++, e.g.,

	LIBSTDCXX=-lstdc++
	LIBS = $(LFLAGS)  -lglut -lGLU -lGL -lreadline -lrt -lz -lm -lncurses  $(GCLIBS) $(LIBSTDCXX)

If the CFLAGS and LFLAGS irregularities were fixed, then I could simply write

	make LIBSTDCXX=/usr/uumath/ashare/gcc/gcc-7-20160424/lib64/libstdc++.a all check

to get a build and validation of asymptote.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe at math.utah.edu  -
- 155 S 1400 E RM 233                       beebe at acm.org  beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------


More information about the tlbuild mailing list