Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 815775 - dev-libs/ntl-11.5.1-r1 fails to compile: ../include/NTL/FFT_impl.h:12:2: error: #error "NTL_ENABLE_AVX_FFT: not supported on this platform"
Summary: dev-libs/ntl-11.5.1-r1 fails to compile: ../include/NTL/FFT_impl.h:12:2: erro...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Mathematics related packages
URL: https://github.com/libntl/ntl/issues/22
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-02 06:12 UTC by Agostino Sarubbo
Modified: 2023-06-14 11:15 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,55.96 KB, text/plain)
2021-10-02 06:12 UTC, Agostino Sarubbo
Details
build.log (build.log,26.40 KB, text/plain)
2023-06-05 09:41 UTC, Joonas Niilola
Details
ntl-11.5.1-r3 failed build log (build.log.gz,3.50 KB, application/gzip)
2023-06-13 07:08 UTC, François Bissey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2021-10-02 06:12:27 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-libs/ntl-11.4.4 fails to compile.
Discovered on: amd64 (internal ref: tinderbox)

NOTE:
If you think this is a GCC-11 related issue, please block bug 732706.
Comment 1 Agostino Sarubbo gentoo-dev 2021-10-02 06:12:29 UTC
Created attachment 742491 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2021-10-02 06:12:30 UTC
Possible context of error(s):

../include/NTL/FFT_impl.h:12:2: error: #error "NTL_ENABLE_AVX_FFT: not supported on this platform"
Comment 3 Agostino Sarubbo gentoo-dev 2021-11-09 07:43:35 UTC
ci has reproduced this issue with version 11.4.4-r1 - Updating summary.
Comment 4 Michael Orlitzky gentoo-dev 2022-01-18 14:38:18 UTC
This one looks fun. NTL determines that you don't have AVX2 support:

  *** Checking for feature: AVX2 [no]

But that check consists of,

  #if (!defined(__GNUC__) || !defined(__x86_64__) || !defined(__AVX2__))
  #error "AVX2 not supported"
  #endif

  #if (NTL_BITS_PER_LONG != 64 || NTL_BITS_PER_INT != 32 
                               || NTL_DOUBLE_PRECISION != 53)
  #error "AVX2 not supported"
  // sanity check -- code that uses this feature also relies on this              
  #endif

  #ifndef NTL_HAVE_ALIGNED_ARRAY
  #error "AVX2 not supported"
  #endif

and to me it looks like all the sub-checks are satisfied. From the build log again,

  bits per long = 64
  bits per int = 32
  double precision = 53
  *** Checking for feature: ALIGNED_ARRAY [yes]

So I guess it must be defined(__GNUC__) or defined(__x86_64__) that is causing the problem? Can you check?
Comment 5 Michael Orlitzky gentoo-dev 2022-01-18 14:44:30 UTC
Or I guess your CPU flags could be wrong (no avx2?)...
Comment 6 Agostino Sarubbo gentoo-dev 2022-01-18 19:47:43 UTC
ci has reproduced this issue with version 11.5.1 - Updating summary.
Comment 7 Agostino Sarubbo gentoo-dev 2022-01-24 07:53:51 UTC
ci has reproduced this issue with version 11.5.1-r1 - Updating summary.
Comment 8 Joonas Niilola gentoo-dev 2023-06-05 09:40:43 UTC
I wonder if avx2 should just be disabled anytime x86 is used?
Comment 9 Joonas Niilola gentoo-dev 2023-06-05 09:41:20 UTC
Created attachment 863321 [details]
build.log
Comment 10 Michael Orlitzky gentoo-dev 2023-06-05 12:40:10 UTC
(In reply to Joonas Niilola from comment #8)
> I wonder if avx2 should just be disabled anytime x86 is used?

On your machine I can at least explain why

  *** Checking for feature: AVX2 [no]

It's because your longs are 32-bits and the implementation relies on them being 64-bit. I suppose that does justify disabling the AVX FFT on x86, because I don't know how to check it easily in the ebuild.
Comment 11 Larry the Git Cow gentoo-dev 2023-06-05 13:02:57 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac9bae7a4256bb2ac15232d4d9a5a5f9a72430f9

commit ac9bae7a4256bb2ac15232d4d9a5a5f9a72430f9
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2023-06-05 12:49:51 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2023-06-05 12:50:25 +0000

    dev-libs/ntl: new revision to fix the x86 build (and drop static-libs).
    
    Bug: https://bugs.gentoo.org/815775
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 .../{ntl-11.5.1-r2.ebuild => ntl-11.5.1-r3.ebuild} | 26 +++++++++++++---------
 1 file changed, 16 insertions(+), 10 deletions(-)
Comment 12 Michael Orlitzky gentoo-dev 2023-06-05 13:03:32 UTC
juippis, please retry with the -r3 of NTL. If that builds, we can add it to the stabilization list.
Comment 13 Joonas Niilola gentoo-dev 2023-06-06 16:53:19 UTC
(In reply to Michael Orlitzky from comment #12)
> juippis, please retry with the -r3 of NTL. If that builds, we can add it to
> the stabilization list.

Yes, can confirm it works on ~x86 container!

>>> Emerging (1 of 1) dev-libs/ntl-11.5.1-r3::gentoo
>>> Installing (1 of 1) dev-libs/ntl-11.5.1-r3::gentoo
Comment 14 Michael Orlitzky gentoo-dev 2023-06-06 21:26:01 UTC
Thank! The new stabilization request is bug #907964.
Comment 15 François Bissey 2023-06-11 22:47:43 UTC
I have bad news. ntl-11.5.1-r3 fails for me with exactly the message in the title of this bug. ntl-11.5.1-r1 works for me.
For reference, here are my cpu flags
*/* CPU_FLAGS_X86: aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3
Comment 16 Michael Orlitzky gentoo-dev 2023-06-12 12:39:56 UTC
(In reply to François Bissey from comment #15)
> I have bad news. ntl-11.5.1-r3 fails for me with exactly the message in the
> title of this bug. ntl-11.5.1-r1 works for me.
> For reference, here are my cpu flags
> */* CPU_FLAGS_X86: aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand
> sse sse2 sse3 sse4_1 sse4_2 ssse3

On x86 or some other arch?

The same underlying issue could affect (say amd64 if you have values other than

  bits per long = 64
  bits per int = 32
  double precision = 53

In that case I might have to disable the AVX FFT completely, and try to get the mess sorted out upstream.
)
Comment 17 François Bissey 2023-06-12 19:46:06 UTC
I am on amd64.
Comment 18 Michael Orlitzky gentoo-dev 2023-06-13 05:51:02 UTC
Can you post your build log? It should (I hope) reveal why NTL doesn't want to use your avx2.
Comment 19 François Bissey 2023-06-13 07:08:39 UTC
Created attachment 863757 [details]
ntl-11.5.1-r3 failed build log

The detection and configuration part is different for 11.5.1-r1
*** GOOD NEWS: compatible machine.
summary of machine characteristics:
bits per long = 64
bits per int = 32
bits per size_t = 64
arith right shift = yes
double precision = 53
long double precision = 64
NBITS (maximum) = 50
WNBITS (maximum) = 62
double rounding detected = no
FMA detected = no
big pointers = no


mv mach_desc.h ../include/NTL/mach_desc.h
make[1]: Leaving directory '/home/portage/dev-libs/ntl-11.5.1-r3/work/ntl-11.5.1/src'
make setup2
make[1]: Entering directory '/home/portage/dev-libs/ntl-11.5.1-r3/work/ntl-11.5.1/src'
echo "*** CheckFeatures log ***" > CheckFeatures.log
sh MakeGetTime "x86_64-pc-linux-gnu-g++ -I../include -I.  -O2 -pipe  -Wl,-O1 -Wl,--as-needed" "-lm"
does anybody really know what time it is?
using GetTime1.cpp
sh MakeGetPID  "x86_64-pc-linux-gnu-g++ -I../include -I.  -O2 -pipe  -Wl,-O1 -Wl,--as-needed" "-lm"
who am I?
using GetPID1.cpp
sh MakeCheckFeatures "ALIGNED_ARRAY BUILTIN_CLZL LL_TYPE SSSE3 AVX PCLMUL AVX2 FMA AVX512F COPY_TRAITS1 COPY_TRAITS2 CHRONO_TIME MACOS_TIME POSIX_TIME AES_NI KMA" "x86_64-pc-linux-gnu-g++ -I../include -I.  -O2 -pipe  -Wl,-O1 -Wl,--as-needed" "-lm"
*** Checking for feature: ALIGNED_ARRAY [yes]
*** Checking for feature: BUILTIN_CLZL [yes]
*** Checking for feature: LL_TYPE [yes]
*** Checking for feature: SSSE3 [no]
*** Checking for feature: AVX [no]
*** Checking for feature: PCLMUL [no]
*** Checking for feature: AVX2 [no]
*** Checking for feature: FMA [no]
*** Checking for feature: AVX512F [no]
*** Checking for feature: COPY_TRAITS1 [yes]
*** Checking for feature: COPY_TRAITS2 [yes]
*** Checking for feature: CHRONO_TIME [yes]
*** Checking for feature: MACOS_TIME [no]
*** Checking for feature: POSIX_TIME [yes]
*** Checking for feature: AES_NI [no]
*** Checking for feature: KMA [no]

FMA detection fails in 11.5.1-r3 and feature check fails for SSSE3, AVX, PCLMUL, AVX2, FMA and AES_NI when they are detected and checked properly in 11.5.1-r1.
Comment 20 François Bissey 2023-06-13 07:10:20 UTC
Darn copied a bit of the wrong log, this is the bit from 11.5.1-r1 that is relevant
*** GOOD NEWS: compatible machine.
summary of machine characteristics:
bits per long = 64
bits per int = 32
bits per size_t = 64
arith right shift = yes
double precision = 53
long double precision = 64
NBITS (maximum) = 50
WNBITS (maximum) = 62
double rounding detected = no
FMA detected = yes
big pointers = no


mv mach_desc.h ../include/NTL/mach_desc.h
make[1]: Leaving directory '/home/portage/dev-libs/ntl-11.5.1-r1/work/ntl-11.5.1/src'
make setup2
make[1]: Entering directory '/home/portage/dev-libs/ntl-11.5.1-r1/work/ntl-11.5.1/src'
echo "*** CheckFeatures log ***" > CheckFeatures.log
sh MakeGetTime "x86_64-pc-linux-gnu-g++ -I../include -I.  -O2 -pipe -march=native -Wl,-O1 -Wl,--as-needed" "-lm"
does anybody really know what time it is?
using GetTime1.cpp
sh MakeGetPID  "x86_64-pc-linux-gnu-g++ -I../include -I.  -O2 -pipe -march=native -Wl,-O1 -Wl,--as-needed" "-lm"
who am I?
using GetPID1.cpp
sh MakeCheckFeatures "ALIGNED_ARRAY BUILTIN_CLZL LL_TYPE SSSE3 AVX PCLMUL AVX2 FMA AVX512F COPY_TRAITS1 COPY_TRAITS2 CHRONO_TIME MACOS_TIME POSIX_TIME AES_NI KMA" "x86_64-pc-linux-gnu-g++ -I../include -I.  -O2 -pipe -march=native -Wl,-O1 -Wl,--as-needed" "-lm"
*** Checking for feature: ALIGNED_ARRAY [yes]
*** Checking for feature: BUILTIN_CLZL [yes]
*** Checking for feature: LL_TYPE [yes]
*** Checking for feature: SSSE3 [yes]
*** Checking for feature: AVX [yes]
*** Checking for feature: PCLMUL [yes]
*** Checking for feature: AVX2 [yes]
*** Checking for feature: FMA [yes]
*** Checking for feature: AVX512F [no]
*** Checking for feature: COPY_TRAITS1 [yes]
*** Checking for feature: COPY_TRAITS2 [yes]
*** Checking for feature: CHRONO_TIME [yes]
*** Checking for feature: MACOS_TIME [no]
*** Checking for feature: POSIX_TIME [yes]
*** Checking for feature: AES_NI [yes]
*** Checking for feature: KMA [no]
Comment 21 Michael Orlitzky gentoo-dev 2023-06-13 19:44:00 UTC
I think the only difference between the two builds is "-march=native" in your CXXFLAGS. Do the AVX, FMA, etc. tests work if you add "-march=native" back manually in -r3?
Comment 22 Michael Orlitzky gentoo-dev 2023-06-13 19:46:11 UTC
I'm just now noticing that doc/config.txt says of the AVX FFT, "this is experimental at moment, and may lead to worse performance." So I think I'll turn it off regardless.

But it would still be nice to know if a bunch of NTL's checks fail without -march=native.
Comment 23 François Bissey 2023-06-13 20:44:34 UTC
I can confirm, manually adding -march=native to my CFLAGS and CXXFLAGS fix all the issues of detection and compilation. The testsuite pass and install goes OK.
Comment 24 Michael Orlitzky gentoo-dev 2023-06-14 06:15:42 UTC
I opened a GH issue about the CPU feature detection. In the meantime, I'll put back NATIVE=on, which adds -march=native when it's missing. I'll also disable the AVX FFT which should hopefully hide all of those build failures.
Comment 25 Larry the Git Cow gentoo-dev 2023-06-14 11:15:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ed8c182abf1232c57446017da57b24c4351a34c

commit 9ed8c182abf1232c57446017da57b24c4351a34c
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2023-06-14 06:26:26 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2023-06-14 11:14:31 +0000

    dev-libs/ntl: another AVX FFT build fix, this time on amd64.
    
    Even on amd64, detection of the CPU features needed for AVX FFT can
    fail. In particular, it can fail when -march=native is absent from
    CXXFLAGS. Since the upstream documentation calls the AVX FFT
    experimental, we disable it entirely. We also bring back NATIVE=on,
    which should somewhat hide the CXXFLAGS issue until it can be addressed
    upstream.
    
    Closes: https://bugs.gentoo.org/815775
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 dev-libs/ntl/ntl-11.5.1-r4.ebuild | 91 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)