Bug 277636 - archivers/unrar build error on arm64 with hardware CRC or AES
Summary: archivers/unrar build error on arm64 with hardware CRC or AES
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-11 18:33 UTC by John F. Carr
Modified: 2024-03-11 18:33 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John F. Carr 2024-03-11 18:33:22 UTC
Make /etc/make.conf has

  CPUTYPE?=cortex-a57

This causes a build error in archivers/unrar:

  ===>  Building for unrar-7.00,6
  c++ -DOPENSSL_AES -I/usr/include -O2 -pipe -mcpu=cortex-a57 -fstack-protector-strong -fno-strict-aliasing   -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DUNRAR -c rar.cpp
  In file included from rar.cpp:1:
  In file included from ./rar.hpp:6:
  ./os.hpp:158:10: fatal error: 'asm/hwcap.h' file not found
    158 | #include <asm/hwcap.h>
        |          ^~~~~~~~~~~~~
  1 error generated.
  *** Error code 1

My CPU setting enables the __ARM_FEATURE macros tested in this part of os.hpp added in unrar7.

  #if defined(__aarch64__) && (defined(__ARM_FEATURE_CRYPTO) || defined(__ARM_FEATURE_CRC32))
  #include <arm_neon.h>
  #ifndef _APPLE
  #include <sys/auxv.h>
  #include <asm/hwcap.h>
  #endif
  #ifdef __ARM_FEATURE_CRYPTO
  #define USE_NEON_AES
  #endif
  #ifdef __ARM_FEATURE_CRC32
  #define USE_NEON_CRC32
  #endif
  #endif

The header file assumes the 64 bit world consists entirely of Apple and Linux.