Summary: | app-crypt/johntheripper-1.8.0[custom-cflags] fails to compile: (with -mavx or -mxop): john.c: undefined reference to `CPU_detect' | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Agostino Sarubbo <ago> |
Component: | Current packages | Assignee: | Rick Farina (Zero_Chaos) <zerochaos> |
Status: | CONFIRMED --- | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | build.log |
Description
Agostino Sarubbo
![]() Created attachment 646030 [details]
build.log
build log and emerge --info
This bug is reproducible (with both GCC and Clang) if -mavx flag is used explicitly or implicitly through -march=... flag (at least on x86_64 architecture). Another flag allowing to reproduce this bug is -mxop. src/x86-64.h: [[[ #define CPU_DETECT 0 #ifdef __XOP__ #define JOHN_XOP #endif #if defined(__AVX__) || defined(JOHN_XOP) #define JOHN_AVX #endif ... #if 0 #define DES_BS_VECTOR 0 #define DES_BS_ALGORITHM_NAME "DES 64/64" #elif defined(JOHN_AVX) && (defined(__GNUC__) || defined(_OPENMP)) /* * Require gcc for AVX/XOP because DES_bs_all is aligned in a gcc-specific way, * except in OpenMP-enabled builds, where it's aligned by different means. */ #undef CPU_DETECT #define CPU_DETECT 1 ]]] So either __AVX__ or __XOP__ results in defining CPU_DETECT=1. Otherwise CPU_DETECT=0. src/john.c: [[[ #if CPU_DETECT extern int CPU_detect(void); #endif ... #if CPU_DETECT static void CPU_detect_or_fallback(char **argv, int make_check) { if (!CPU_detect()) { ]]] What's the solution to this? The solution to this if you are using -march=... system-wide, is to create a file named e.g. nonative.conf in /etc/portage/env with the following contents: ``` COMMON_FLAGS="-O3 -pipe" CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${COMMON_FLAGS}" FCFLACS="${COMMON_FLAGS}" FFLAGS="${COMMON_FLAGS}" ``` Then create a file in /etc/portage/package.env with the following contents: ``` app-crypt/johntheripper nonative.conf ``` johntheripper should then compile without issue The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18189332f06a98ab06657cfc661ab2f4c9b106cb commit 18189332f06a98ab06657cfc661ab2f4c9b106cb Author: Sam James <sam@gentoo.org> AuthorDate: 2025-02-16 13:12:00 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-02-16 13:17:10 +0000 app-crypt/johntheripper-jumbo: add 1.9.0_p20250216 Add a workaround for bug #729422 which isn't complete but should help with building in common configurations. Keeping the bug open so we can sort it out properly. Bug: https://bugs.gentoo.org/729422 Closes: https://bugs.gentoo.org/948330 Closes: https://bugs.gentoo.org/943973 Signed-off-by: Sam James <sam@gentoo.org> app-crypt/johntheripper-jumbo/Manifest | 1 + .../johntheripper-jumbo-1.9.0_p20250216.ebuild | 161 +++++++++++++++++++++ .../johntheripper-jumbo-9999.ebuild | 12 +- 3 files changed, 171 insertions(+), 3 deletions(-) |