[issue45598] setup.py grep_headers_for() is broken by design

2021-11-02 Thread Ned Deily


Ned Deily  added the comment:

> Ned, what about USING_APPLE_OS_LIBFFI? Is it still relevant?

It was just added a year ago as part of the support for macOS 11 Big Sur and 
Apple Silicon systems.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45598] setup.py grep_headers_for() is broken by design

2021-11-01 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch
pull_requests: +27613
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29352

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45598] setup.py grep_headers_for() is broken by design

2021-10-30 Thread Éric Araujo

Éric Araujo  added the comment:

We could look in distro patch trackers to see they patch CPython’s setup.py to 
evaluate the impact of removing this function.

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45598] setup.py grep_headers_for() is broken by design

2021-10-29 Thread Sam James


Change by Sam James :


--
nosy: +thesamesam

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45598] setup.py grep_headers_for() is broken by design

2021-10-24 Thread Christian Heimes


Christian Heimes  added the comment:

If we remove grep_headers_for(), then we can also close bpo-42325

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45598] setup.py grep_headers_for() is broken by design

2021-10-24 Thread Christian Heimes


New submission from Christian Heimes :

The setup.py helper function grep_headers_for() is used by ctypes build step to 
search header files for functions. The function kinda works on most platforms, 
but only by accident. On my system it opens all header files that match 
/usr/include/*.h and returns true if any (!) header file contains the string 
(!) "ffi_prep_cif_var". The check would also match "ffi_prep_cif_var" in a 
comment of an unrelated header file.

We cannot limit the search to "ffi.h" only, because that would break multiarch 
builds with a header file like this:

#if defined(__i386__)
#include "ffi-i386.h"
#elif defined(__powerpc64__)
#include "ffi-ppc64.h"
...

Solutions:

1) Use "AC_EGREP_HEADER" autoconf macro. It runs a header file through the C 
preprocessor
2) Use AC_LINK_IFELSE autoconf macro. This macro compiles and links code to 
detect if a library exports a function.
3) Re-implement any of the macros in pure Python (ugh!)
4) Just assume that libffi supports ffi_prep_cif_var, ffi_prep_closure_loc, and 
ffi_closure_alloc on our target platforms. According to [1] the functions have 
been around for over a decade.

I favor (4).

Ned, what about USING_APPLE_OS_LIBFFI? Is it still relevant?

[1] 
https://github.com/libffi/libffi/blame/48bdb02867edb7e9f3785ccb4bdff1087fb44246/include/ffi.h.in#L309

--
components: Build, ctypes
messages: 404926
nosy: amaury.forgeotdarc, belopolsky, christian.heimes, meador.inge, ned.deily
priority: normal
severity: normal
status: open
title: setup.py grep_headers_for() is broken by design
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com