Discussion:
[lfs-support] Libffi 455 tests fail. Step 6.49. Libffi-3.2.1 in the book lfs-8.2 systemd version.
Filip Banák
2018-05-20 06:59:08 UTC
Permalink
Hi again!
I think I finally got it right.
*"export CFLAGS=-march=corei7-avx -mno-avx -mno-aes"*
Then apply the patches specified in the lfs book in libffi step.
Then do *./configure --prefix=/usr --disable-static
--with-gcc-arch=corei7-avx*
Then *make*
And *make check* passed all of the tests.
So it was just that I needed to set CFLAGS before configure.
It also works when i do *./configure --prefix=/usr --disable-static*
(when i do not specify the arch in configure).
Then i just unset CFLAGS. Continued with the book. Meson built successfuly.
Thanks so much !
Hello!
This is the output of ./configure from config.log >>
configure:16308: checking for gcc architecture flag
configure:16332: checking for x86 cpuid 0 output
configure:16361: gcc -o conftest -O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math conftest.c >&5
configure:16361: $? = 0
configure:16361: ./conftest
configure:16361: $? = 0
configure:16371: result: d:756e6547:6c65746e:49656e69
configure:16387: checking for x86 cpuid 1 output
configure:16416: gcc -o conftest -O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math conftest.c >&5
configure:16416: $? = 0
configure:16416: ./conftest
configure:16416: $? = 0
configure:16426: result: 206a7:100800:d9ae3bf:bfebfbff
configure:16650: checking whether C compiler accepts -march=corei7-avx
configure:16669: gcc -c -O3 -fomit-frame-pointer -fstrict-aliasing
-ffast-math -march=corei7-avx conftest.c >&5
configure:16669: $? = 0
configure:16678: result: yes
configure:16695: checking for gcc architecture flag
configure:16697: result: *-march=corei7-avx*
configure:16720: checking whether C compiler accepts -O3
-fomit-frame-pointer -fstrict-aliasing -ffast-math -march=corei7-avx
configure:16739: gcc -c -O3 -fomit-frame-pointer -fstrict-aliasing
-ffast-math -march=corei7-avx -O3 -fomit-frame-pointer -fstrict-aliasing
-ffast-math -march=corei7-avx conftest.c >&5
configure:16739: $? = 0
configure:16748: result: yes
configure:16781: : CFLAGS="$CFLAGS "
configure:16784: $? = 0
configure:16799: checking CFLAGS for maximum warnings
Console output of make >> make 'AR_FLAGS=' 'CC_FOR_BUILD=' 'CFLAGS=-O3
-fomit-frame-pointer -fstrict-aliasing -ffast-math *-march=corei7-avx*
-Wall -fexceptions' 'CXXFLAGS=-g -O2' 'CFLAGS_FOR_BUILD='
'CFLAGS_FOR_TARGET=' 'INSTALL=/usr/bin/install -c'
'INSTALL_DATA=/usr/bin/install -c -m 644' 'INSTALL_PROGRAM=/usr/bin/install
-c' 'INSTALL_SCRIPT=/usr/bin/install -c' 'JC1FLAGS=' 'LDFLAGS='
'LIBCFLAGS=' 'LIBCFLAGS_FOR_TARGET=' 'MAKE=make' 'MAKEINFO=/bin/sh
/sources/libffi-3.2.1/missing makeinfo ' 'PICFLAG=' 'PICFLAG_FOR_TARGET='
'RUNTESTFLAGS=' 'SHELL=/bin/sh' 'exec_prefix=/usr'
'infodir=/usr/share/info' 'libdir=/usr/lib' 'mandir=/usr/share/man'
'prefix=/usr' 'AR=ar' 'AS=as' 'CC=gcc' 'CXX=g++' 'LD=/usr/bin/ld -m
elf_x86_64' 'NM=/usr/bin/nm -B' 'RANLIB=ranlib' 'DESTDIR=' all-recursive
So I think it builds with -march=corei7-avx. But my cpu doesn't support
avx instructions.
I have tried this "./configure --with-gcc-arch=corei7-avx
and then add
"-mno-avx -mno-aes"
to your CFLAGS to remove support for the avx and aes instructions."
./configure --prefix=/usr --disable-static --with-gcc-arch=corei7-avx
Then
export "CFLAGS=-mno-avx -mno-aes"
Then
make
But nothing changed
On Thu, 17 May 2018 16:41:12 +0200
=> 0x7ffff601dce4 <ffi_closure_alloc+4196>: vmovq %r13,%xmm3 <<<
OK, good, vmovq is an avx instruction. Your CPU flags don't list avx
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt
tsc_deadline_timer xsave lahf_lm epb pti tpr_shadow vnmi flexpriority
ept vpid xsaveopt ibpb ibrs stibp dtherm arat pln pts
And here
https://en.wikipedia.org/wiki/Advanced_Vector_Extensions
it is stated
"Note: Not all CPUs from the listed families support AVX.
Generally, CPUs with the commercial denomination 'Core i3/i5/i7'
support them, whereas 'Pentium' and 'Celeron' CPUs don't."
So, libffi has a bug with regard to the configuration of Celeron G530
CPUs. When you build libffi, what do you see it is using for the
gcc -march option? e.g.,
make 'AR_FLAGS=' 'CC_FOR_BUILD=' 'CFLAGS=-O3 -fomit-frame-pointer
-fstrict-aliasing -ffast-math -march=amdfam10 -Wall -fexceptions'
'CXXFLAGS=-g -O2' 'CFLAGS_FOR_BUILD=' 'CFLAGS_FOR_TARGET='
Inside the libffi source tree there will be an architecture specific
directory "..linux-gnu". Inside there will be a config.log file. In
that file, what does it say on the lines from
"checking for gcc architecture flag"
to
"checking CFLAGS for maximum warnings"
which corresponds to configure:16308 to configure:16799, approx log
lines 690-716 ?
This bug should be reported to the libffi developers.
However, in the meantime, ./configure has an architecture override
option: --with-gcc-arch=
The question then becomes what to put there for your CPU.
https://forums.gentoo.org/viewtopic-t-722765-start-0.html
e.g., ./configure --with-gcc-arch=pentium4
You could try native and see if gcc gets it right.
-march=corei7-avx -mtune=corei7-avx -mno-avx -mno-aes
https://stackoverflow.com/questions/15576817/what-is-the-proper-architecture-specific-options-m-for-sandy-bridge-based-pen/35049035
which would require you to do
./configure --with-gcc-arch=corei7-avx
and then add
"-mno-avx -mno-aes"
to your CFLAGS to remove support for the avx and aes instructions.
Do let us know what you tried and how it turned out.
Cheers,
Mike
Loading...