Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20160716155223.GA18653@openwall.com>
Date: Sat, 16 Jul 2016 18:52:23 +0300
From: Solar Designer <solar@...nwall.com>
To: owl-users@...ts.openwall.com
Subject: building new gcc

Hi,

I just thought I'd share:

Building recent gcc (with ASan) on Owl-current or 3.1-stable currently
requires two hacks:

1. Adding new PT_* defines to /usr/include/sys/ptrace.h from newer
glibc, or alternatively adding them into the gcc tree:

  /* Set ptrace filter options.  */
  PTRACE_SETOPTIONS = 0x4200,
#define PT_SETOPTIONS PTRACE_SETOPTIONS

  /* Get last ptrace message.  */
  PTRACE_GETEVENTMSG = 0x4201,
#define PT_GETEVENTMSG PTRACE_GETEVENTMSG

  /* Get siginfo for process.  */
  PTRACE_GETSIGINFO = 0x4202,
#define PT_GETSIGINFO PTRACE_GETSIGINFO

  /* Set new siginfo for process.  */
  PTRACE_SETSIGINFO = 0x4203
#define PT_SETSIGINFO PTRACE_SETSIGINFO

Of course, don't forget to add a comma after "PTRACE_SYSCALL = 24",
which is the last definition in that enum currently.

2. Passing "--disable-nls" to configure, although this might be working
around a bug in recent gcc snapshots rather than an Owl compatibility
issue.  My gcc build script contains:

---
#!/bin/sh

set -ex

V=$1
D=gcc-$V
F=gcc-$V.tar.bz2
I=/home/gcc/$D

rm -r $D || :
tar xf $F
cd $D

mkdir objdir
cd objdir
rmdir $I || :
mkdir $I
../configure --prefix=$I --disable-multilib --enable-languages=c --disable-nls
nice -n 19 time make -j8
nice -n 19 time make install
---

and a wrapper script for building multiple gcc versions:

---
#!/bin/sh

for V in 7-20160710 5.4.0 6.1.0 5.3.0 5.2.0 5.1.0 4.9.3; do
	time ./build-gcc $V 2>&1 | tee $V.log
done
---

These scripts successfully built the listed gcc versions (including the
latest gcc 7 snapshot) on Owl yesterday.  I tested x86_64 only.

This is for building and installing under a "gcc" pseudo-user.  To use
gcc built in this way, you'll likely need to modify PATH and optionally
LD_LIBRARY_PATH (such as to use ASan).  Some commands I used for
building and testing passwdqc utilities with ASan:

PATH=~gcc/gcc-7-20160710/bin:$PATH make
LD_LIBRARY_PATH=.:~gcc/gcc-7-20160710/lib64 ./pwqgen

I included "." in LD_LIBRARY_PATH as well because of passwdqc
specifics: it has a library of its own.  For many other programs it'd be
just "LD_LIBRARY_PATH=~gcc/gcc-7-20160710/lib64".

Maybe someone will find this helpful.

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.