Skip to content

BUG: getauxval declaration invalid, causes compile issues #21386

@jmgurney

Description

@jmgurney

Describe the issue:

Trying to install numpy, (main branch) on FreeBSD/aarch64 (aka arm64), using clang, and I get the following compile error:

      INFO: cc: numpy/core/src/common/npy_argparse.c                                                                                                                                [133/1808]      INFO: cc: numpy/core/src/common/npy_hashtable.c                                                                                                                                               INFO: cc: numpy/core/src/common/npy_longdouble.c                                                                                                                                              INFO: cc: numpy/core/src/common/ucsnarrow.c                                                                                                                                                   INFO: cc: numpy/core/src/common/ufunc_override.c                                                                                                                                              INFO: cc: numpy/core/src/common/numpyos.c                                                                                                                                                     INFO: cc: build/src.freebsd-14.0-CURRENT-arm64-3.9/numpy/core/src/common/npy_cpu_features.c                                                                                             
      numpy/core/src/common/npy_cpu_features.c.src:586:22: error: static declaration of 'getauxval' follows non-static declaration                                                            
      static unsigned long getauxval(unsigned long k)                                                                                                                                         
                           ^                                                                                                                                                                  
      numpy/core/src/common/npy_cpu_features.c.src:582:37: note: previous declaration is here                                                                                                 
      __attribute__((weak)) unsigned long getauxval(unsigned long); // linker should handle it                                                                                                
                                          ^                                                                                                                                                   
      1 error generated.                                                                                                                                                                      

It is very clear that this is the case by code inspection:
https://github.com/numpy/numpy/blob/main/numpy/core/src/common/npy_cpu_features.c.src#L582

Reproduce the code example:

# I can't install numpy so there is no code to reproduce.

Error message:

# see above.

NumPy/Python version information:

Main branch as of a few minutes before I filed this issue, the install was attempted via:

pip install git+https://github.com/numpy/numpy.git

Python version:

Python 3.9.12 (main, Mar 27 2022, 01:58:04) 
[Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a on freebsd14

FreeBSD version info:

FreeBSD generic 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n254105-d53927b0bae: Thu Mar 31 09:26:31 UTC 2022     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions