Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: getauxval declaration invalid, causes compile issues #21386

Closed
jmgurney opened this issue Apr 23, 2022 · 8 comments · Fixed by #21392
Closed

BUG: getauxval declaration invalid, causes compile issues #21386

jmgurney opened this issue Apr 23, 2022 · 8 comments · Fixed by #21392
Labels

Comments

@jmgurney
Copy link
Contributor

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
@jmgurney
Copy link
Contributor Author

Looks like this commit is the problem:
c47e962

Done by @devnexen

@jmgurney
Copy link
Contributor Author

Just for reference, the previous commit works just fine:

pip install 'git+https://github.com/numpy/numpy.git@5c7002926ec8ad12785b36024f9da80b7017ad1c#egg=numpy'

@charris
Copy link
Member

charris commented Apr 24, 2022

Would you like to make a PR?

@seberg
Copy link
Member

seberg commented Apr 24, 2022

Sounds like the issue is that getauxval already exists (presumably correct). Can we just add a check for that, the code assumes that on #ifdef __FreeBSD__ it does not exist.

@jmgurney
Copy link
Contributor Author

I'll do a PR if someone tells me what the correct fix is?

Or are you suggesting that I reverse the change that broke things?

@mattip
Copy link
Member

mattip commented Apr 25, 2022

This came from #18169 which has no comments about the need for this code. Perhaps clang and gcc differ here? In any case, the conservative move would be to fix the current code. It would be nice if @devnexen could explain how they tested #18169 and why they needed to add the wrapper around elf_aux_info. We don't run FreeBSD in our CI.

@devnexen
Copy link
Contributor

I'll do a PR if someone tells me what the correct fix is?

I might suggest to guard for Linux only the line 582.

jmgurney added a commit to jmgurney/numpy that referenced this issue Apr 25, 2022
jmgurney added a commit to jmgurney/numpy that referenced this issue Apr 25, 2022
charris added a commit that referenced this issue Apr 26, 2022
@kevans91
Copy link

This came from #18169 which has no comments about the need for this code. Perhaps clang and gcc differ here? In any case, the conservative move would be to fix the current code. It would be nice if @devnexen could explain how they tested #18169 and why they needed to add the wrapper around elf_aux_info. We don't run FreeBSD in our CI.

FWIW, the wrapper around elf_aux_info is pertinent because we (FreeBSD) can't/won't provide a compatible getauxval() implementation. Some software (I have no idea the magnitude) assumes the presence means some Linux-specific AT_* values are defined. We provide HWCAP/HWCAP2, but beyond that it can get a bit shadier.

re: CI, I don't have time at the moment, but would the numpy project accept the addition of Cirrus CI if a PR comes along that adds it? I think Cirrus is just about the best game in town for FreeBSD runners.

charris pushed a commit to charris/numpy that referenced this issue May 5, 2022
charris added a commit that referenced this issue May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants