-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-33351: (WIP) Patches to build on clang-cl #7680
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
This was mostly: - forward declare struct timeval in pytime (it should have been anyway) - moving struct packing in the correct place - Using a more portable, standard garunteed stringize macro - defining compiler names
Should this PR also add It would only need to change line 245: Also line 960 |
@ahartikainen I think that is likely the next todo I have. I'll get back to this soon hopefully. |
@ethanhs Are you still interested in pushing this forward? If so, can you merge against master and run CI again. |
@zooba, yes! I have been working on other things recently, but it would be helpful to know what a mergable PR should look like. Since clang-cl can fallback to cl, there may be a few modules I will need to use that for, as mentioned in the PR comment there seems to be an issue with how it compiles things (however I should test this with a newer clang to be sure). |
Of the three modules that didn't build, distutils_findvs has been removed and pyshellext is probably optional (it's part of the py.exe launcher, not Python itself). So that will get you closer. You should be able to pass |
Add clang-cl to distutils is just a few lines of change, I added a patch at https://github.com/zufuliu/llvm-utils/blob/master/clang/clang-cl-py3.diff, which works fine for 3.7.3. |
This has been replaced by GH-18371. |
I've been a bit busy so I haven't had time to prepare this, but I wanted to post something people can try, so here's something.
So far I have made changes to:
This builds and passes tests with MSVC, and clang-cl on x64.
If you would like to test this:
then
Everything builds except:
The good news is that clang generates MSVC ABI compatible binaries, so linking clang/msvc binaries together is fine.
The following tests fail under clang-cl:
test_compile test_compileall test_ctypes test_exceptions
test_fileio test_io test_json test_os test_pickle test_pickletools
test_richcmp test_runpy test_script_helper test_sys test_traceback
test_userdict test_userlist test_xml_etree
It seems many of them are failing with a stack overflow, so it seems clang is miscompiling something.
There is however a subset that can compile under clang while still passing the tests.
https://bugs.python.org/issue33351