-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: Add changes that allow NumPy to compile with clang-cl #20866
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
Conversation
Port over changes needed to compile NumPy using clang-cl from numpy#13816. Desirable to retain these even though distutils is effectively deprecated and so not worth the effort to alter.
Cc @serge-sans-paille FYI - the header changes may be relevant for Pythran perhaps, since it requires |
@@ -41,7 +41,7 @@ | |||
* @param dtype2 Second DType class. | |||
* @return The common DType or NULL with an error set | |||
*/ | |||
NPY_NO_EXPORT NPY_INLINE PyArray_DTypeMeta * | |||
NPY_NO_EXPORT PyArray_DTypeMeta * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the problem with NPY_INLINE
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it is no export and inline, clang-cl only lets it be used in the same translation unit. It is later linked across object files which makes clang-cl error.
Thanks @bashtage. Should this be backported? |
I wouldn't bother. NumPy can't actually be compiled using clang-cl since it requires support in NumPy distutils, which is not deprecated. I have mostly given up on #13816 which contained the distutils choice. I'm hoping that when a new build system is in place that it will automatically setting alternative compilers on Windows (e.g., icc or clang-cl), so that these patches will be useful at that point. |
That actually sounds like a clang-cl problem, the function isn't marked static. OTOH, it might be one of those murky areas. |
@bashtage do you know if the meson build, which is the default on You may need to install pkg-config and set Line 21 in 3881c6f
and here Lines 25 to 33 in 3881c6f
|
I haven't tried usign meson. I'll give it a go this week and let you know if ti works without further modification. It has been a while since I've tried and it is possible that there has been some drift int he code base that might need change. |
I made some progress but not compiling yet. Not very familiar with meson, so some of this might be wrong.
The last step errors with
Looks like some of the wrong types of slashes are bring used and are somehow being eaten. Any idea where these commands are? |
An alternative to an ini file is to set environment variables like No idea what's going on with the file path there, or what a |
Since windows has a line-length limit, msvc has the ability to read more commands from a response file instead. So ignore that and pretend the commands all came from the command line. I don't see any meson open issues around path slash handling. Maybe connected to |
This mostly works
where the
This can be created using the command "[binaries]","c = 'clang-cl'","cpp = 'clang-cl'","ar = 'llvm-lib'","c_ld = 'lld-link'","cpp_ld = 'lld-link'" | Out-File $PWD/clang-cl-build.ini Two tests fail with
which I would bet has something to do with SIMD. |
The int8/uint8 |
Port over changes needed to compile NumPy using clang-cl
from #13816. Desirable to retain these even though distutils is
effectively deprecated and so not worth the effort to alter.