Re: [lfs-support] Please consider adding --with-gcc-arch=native in libffi configure

2018-07-03 Thread Bruce Dubbs

On 07/03/2018 02:51 PM, Don Cross wrote:



On Tue, Jul 3, 2018 at 12:40 PM Bruce Dubbs > wrote:


On 06/29/2018 07:32 PM, Don Cross wrote:
 > I wasn't sure whether to send this to lfs-support or lfs-dev.
Since I'm
 > not a developer on LFS, I guessed the former. Apologies if my
guess is
 > unhelpful.
 >
 > I built LFS using jhalfs and the 8.2 version of the book on a
machine
 > with an Intel G860 processor. The configure script for libffi
guessed
 > wrong about the processor's capabilities, causing Python 3 to
crash with
 > an invalid instruction exception.
 >
 > I fixed this by changing the jhalfs script 115_libffi to let gcc
 > determine the architecture rather than the configure script itself:
 >
 > ./configure --prefix=/usr --disable-static --with-gcc-arch=native

In the libffi source directory, can you pelease tell us what the output
of ./config.guess

In my case it is x86_64-unknown-linux-gnu.

    -- Bruce


Hi Bruce, I see the same thing:

don@neptune:/sources/libffi-3.2.1 $ ./config.guess
x86_64-unknown-linux-gnu

However, I believe the smoking gun is in the output of ./configure when 
I leave out the --with-gcc-arch=native.  If I diff the output of 
./configure without that native option (bad.txt) against the output with 
that option (good.txt) I get:


don@neptune:/sources/libffi-3.2.1 $ ./configure --prefix=/usr 
--disable-static > bad.txt
don@neptune:/sources/libffi-3.2.1 $ ./configure --prefix=/usr 
--disable-static --with-gcc-arch=native > good.txt

don@neptune:/sources/libffi-3.2.1 $ diff bad.txt good.txt
106,110c106,108
< checking for x86 cpuid 0 output... d:756e6547:6c65746e:49656e69
< checking for x86 cpuid 1 output... 206a7:2100800:d9ae3bf:bfebfbff
< checking whether C compiler accepts -march=corei7-avx... yes
< checking for gcc architecture flag... -march=corei7-avx
< checking whether C compiler accepts -O3 -fomit-frame-pointer 
-fstrict-aliasing -ffast-math -march=corei7-avx... yes

---
 > checking whether C compiler accepts -march=native... yes
 > checking for gcc architecture flag... -march=native
 > checking whether C compiler accepts -O3 -fomit-frame-pointer 
-fstrict-aliasing -ffast-math -march=native... yes


I'm not sure how ./configure comes up with corei7-avx, but the Intel 
G860 does not support Advanced Vector eXtension instructions.


I think --with-gcc-arch=native is going to give the vast number of LFS 
builders the correct output. If they are cross-compiling, they are going 
to have to go through the pain of figuring out the target architecture 
settings anyway, so they will be no worse off.


Thanks, that helps.   I'll continue my investigation.  there is a lot 
going on in LFS right now so I will be making multiple updates in the 
next few days.


  -- Bruce

--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] Please consider adding --with-gcc-arch=native in libffi configure

2018-07-03 Thread Don Cross
On Tue, Jul 3, 2018 at 12:40 PM Bruce Dubbs  wrote:

> On 06/29/2018 07:32 PM, Don Cross wrote:
> > I wasn't sure whether to send this to lfs-support or lfs-dev. Since I'm
> > not a developer on LFS, I guessed the former. Apologies if my guess is
> > unhelpful.
> >
> > I built LFS using jhalfs and the 8.2 version of the book on a machine
> > with an Intel G860 processor. The configure script for libffi guessed
> > wrong about the processor's capabilities, causing Python 3 to crash with
> > an invalid instruction exception.
> >
> > I fixed this by changing the jhalfs script 115_libffi to let gcc
> > determine the architecture rather than the configure script itself:
> >
> > ./configure --prefix=/usr --disable-static --with-gcc-arch=native
>
> In the libffi source directory, can you pelease tell us what the output
> of ./config.guess
>
> In my case it is x86_64-unknown-linux-gnu.
>
>-- Bruce
>

Hi Bruce, I see the same thing:

don@neptune:/sources/libffi-3.2.1 $ ./config.guess
x86_64-unknown-linux-gnu

However, I believe the smoking gun is in the output of ./configure when I
leave out the --with-gcc-arch=native.  If I diff the output of ./configure
without that native option (bad.txt) against the output with that option
(good.txt) I get:

don@neptune:/sources/libffi-3.2.1 $ ./configure --prefix=/usr
--disable-static > bad.txt
don@neptune:/sources/libffi-3.2.1 $ ./configure --prefix=/usr
--disable-static --with-gcc-arch=native > good.txt
don@neptune:/sources/libffi-3.2.1 $ diff bad.txt good.txt
106,110c106,108
< checking for x86 cpuid 0 output... d:756e6547:6c65746e:49656e69
< checking for x86 cpuid 1 output... 206a7:2100800:d9ae3bf:bfebfbff
< checking whether C compiler accepts -march=corei7-avx... yes
< checking for gcc architecture flag... -march=corei7-avx
< checking whether C compiler accepts -O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math -march=corei7-avx... yes
---
> checking whether C compiler accepts -march=native... yes
> checking for gcc architecture flag... -march=native
> checking whether C compiler accepts -O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math -march=native... yes

I'm not sure how ./configure comes up with corei7-avx, but the Intel G860
does not support Advanced Vector eXtension instructions.

I think --with-gcc-arch=native is going to give the vast number of LFS
builders the correct output. If they are cross-compiling, they are going to
have to go through the pain of figuring out the target architecture
settings anyway, so they will be no worse off.

Don
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] Please consider adding --with-gcc-arch=native in libffi configure

2018-07-03 Thread Bruce Dubbs

On 06/29/2018 07:32 PM, Don Cross wrote:
I wasn't sure whether to send this to lfs-support or lfs-dev. Since I'm 
not a developer on LFS, I guessed the former. Apologies if my guess is 
unhelpful.


I built LFS using jhalfs and the 8.2 version of the book on a machine 
with an Intel G860 processor. The configure script for libffi guessed 
wrong about the processor's capabilities, causing Python 3 to crash with 
an invalid instruction exception.


I fixed this by changing the jhalfs script 115_libffi to let gcc 
determine the architecture rather than the configure script itself:


./configure --prefix=/usr --disable-static --with-gcc-arch=native


In the libffi source directory, can you pelease tell us what the output 
of ./config.guess


In my case it is x86_64-unknown-linux-gnu.

  -- Bruce
--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] Please consider adding --with-gcc-arch=native in libffi configure

2018-06-30 Thread Michael Shell
On Fri, 29 Jun 2018 20:32:37 -0400
Don Cross  wrote:
 
> I built LFS using jhalfs and the 8.2 version of the book on a machine with
> an Intel G860 processor. The configure script for libffi guessed wrong
> about the processor's capabilities, causing Python 3 to crash with an
> invalid instruction exception.


FWIW, I did file a bug report with libffi's developers:

https://sourceware.org/ml/libffi-discuss/2018/msg00033.html

Mailing list and contact info here:
https://sourceware.org/libffi/

However, there hasn't been any reply, so far.

At the very least, maybe there should be a warning message about this
issue on the LFS libffi page, including noting that it will typically
manifest as a python illegal instruction crash, which can happen
when building meson.


  Cheers,

  Mike Shell

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] Please consider adding --with-gcc-arch=native in libffi configure

2018-06-29 Thread William Harrington
On Fri, 29 Jun 2018 22:47:26 -0500
Bruce Dubbs  wrote:

> >
> > ./configure --prefix=/usr --disable-static --with-gcc-arch=native

When was this added? From what I can tell from a search is that ImageMagick 
also has the configure option, but I can't find it in a GCC document. GCC has 
always used -march and -mtune. Is this an application specific option?

Sincerely,

William Harrington
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


Re: [lfs-support] Please consider adding --with-gcc-arch=native in libffi configure

2018-06-29 Thread Bruce Dubbs



On 06/29/2018 07:32 PM, Don Cross wrote:
I wasn't sure whether to send this to lfs-support or lfs-dev. Since 
I'm not a developer on LFS, I guessed the former. Apologies if my 
guess is unhelpful.


I built LFS using jhalfs and the 8.2 version of the book on a machine 
with an Intel G860 processor. The configure script for libffi guessed 
wrong about the processor's capabilities, causing Python 3 to crash 
with an invalid instruction exception.


I fixed this by changing the jhalfs script 115_libffi to let gcc 
determine the architecture rather than the configure script itself:


./configure --prefix=/usr --disable-static --with-gcc-arch=native

See here for reference:
http://linuxfromscratch.org/lfs/view/development/chapter06/libffi.html

I would like to ask that the developers consider making this change to 
the LFS book.  This might possibly cause incorrect behavior on other 
CPU types, although I would think gcc would do a better job than this 
buggy script.  So at the very least, it would be helpful to mention 
this problem and solution on the libffi step (where the problem 
originates) and the Python 3 step (where it manifests itself as an 
"invalid instruction" exception).


It took me a couple of days to figure this out because I kept thinking 
the problem was in Python 3.  Now that I know what happened, search 
shows that at least one other person has been bitten by this (Celeron 
G530 in their case):


I'll think abou this, but perhaps a note inserted may be better.  In 
some cases, users want to
build on one system and copy it to a lsesser system.  Using native may 
not be the best fir

that case.

I've created a ticket so we don't forget.

  -- Bruce



--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style


[lfs-support] Please consider adding --with-gcc-arch=native in libffi configure

2018-06-29 Thread Don Cross
I wasn't sure whether to send this to lfs-support or lfs-dev. Since I'm not
a developer on LFS, I guessed the former. Apologies if my guess is
unhelpful.

I built LFS using jhalfs and the 8.2 version of the book on a machine with
an Intel G860 processor. The configure script for libffi guessed wrong
about the processor's capabilities, causing Python 3 to crash with an
invalid instruction exception.

I fixed this by changing the jhalfs script 115_libffi to let gcc determine
the architecture rather than the configure script itself:

./configure --prefix=/usr --disable-static --with-gcc-arch=native

See here for reference:
http://linuxfromscratch.org/lfs/view/development/chapter06/libffi.html

I would like to ask that the developers consider making this change to the
LFS book.  This might possibly cause incorrect behavior on other CPU types,
although I would think gcc would do a better job than this buggy script.
So at the very least, it would be helpful to mention this problem and
solution on the libffi step (where the problem originates) and the Python 3
step (where it manifests itself as an "invalid instruction" exception).

It took me a couple of days to figure this out because I kept thinking the
problem was in Python 3.  Now that I know what happened, search shows that
at least one other person has been bitten by this (Celeron G530 in their
case):

http://lists.linuxfromscratch.org/pipermail/lfs-support/2018-May/052008.html

Thanks for all the great work you guys do!  This is a fantastic educational
resource.
- Don
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style