Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120422201221.GA5360@openwall.com>
Date: Mon, 23 Apr 2012 00:12:21 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Build failure

Richard,

I think this is more of a topic for john-users, but I'll reply in here
for the already started thread.

On Fri, Apr 20, 2012 at 04:50:36PM -0400, Richard Farina wrote:
> He cannot build john with CFLAGS="-march=native" but has no issues with CFLAGS="-mtune=native".

In short, if you add certain flags to CFLAGS, you must also add these
flags to ASFLAGS and/or LDFLAGS.  In the case of -march=native (and
certain other -march=... settings), it must be in both CFLAGS and
ASFLAGS, so that the .c and .S files from JtR are compiled for a
consistent target architecture (not two different ones).  In the case of
-fopenmp, it must be in all three of CFLAGS, ASFLAGS, and LDFLAGS -
which is readily achieved with OMPFLAGS.  Thus, as an option, you may
specify -march=native in OMPFLAGS instead of in CFLAGS.

I understand that in your case -march=native might come from a
distro-wide setting that you use for packages' CFLAGS.  If so, you may
try including that entire string in ASFLAGS as well - most of the
options will be no-ops while assembling, but that's OK.

> make -j1 -C src/ CPP=i686-pc-linux-gnu-g++ CC=i686-pc-linux-gnu-gcc AS=i686-pc-linux-gnu-gcc LD=i686-pc-linux-gnu-gcc 'CFLAGS=-c -Wall -include \"/var/tmp/portage/app-crypt/johntheripper-1.7.9-r2/work/john-1.7.9\"/config.gentoo -O2 -march=native -pipe -fPIC -fPIE -fopenmp' 'LDFLAGS=-Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed' OPT_NORMAL= OMPFLAGS=-fopenmp linux-x86-sse2

You dropped -fomit-frame-pointer and added -fPIC -fPIE there.  These
changes relative to JtR's default flags may have performance impact
(likely exceeding the possible advantage of -march=native).  It would be
better to just use JtR's defaults.

Starting with gcc 4.6.x, -fomit-frame-pointer became the default for -O2
when building for 32-bit x86, though.  Since Gentoo uses fresh stuff,
you're probably lucky to benefit from this.  Yet a while ago it was a
real problem (distros overriding CFLAGS, thus not including
-fomit-frame-pointer and incurring performance hits of up to 10% or so).

-fPIC -fPIE are still a bit problematic, although I understand why
Gentoo is doing that.  You may try a relbench of a Gentoo build vs.
default build of jumbo.  I suspect that the Gentoo build would run
slower on average.  You may try it separately for x86_64 and i686 (also
for different make targets and OpenMP or not if you like).

I hope this helps.

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.