setuptools using CC for compiling C++ files
See original GitHub issueWhen compiling an extension like
ext_modules = [
Extension(
"_foobar",
[
# ...
],
language="C++",
)
]
setuptools appears to use the CC
environment variable when compiling the project. E.g.,
CC=clang++ pip3 install . --user --verbose
will switch to clang++
. Since this is a C++ project (as specified in the extension), I would have expected CXX
to have an effect, and not CC
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Compiling & installing C executable using python's setuptools ...
The source for that external executable is part of my python module, distributed as a .tar.gz file. Is there a way of unzipping,...
Read more >4. Building C and C++ Extensions — Python 3.11.1 ...
A C extension for CPython is a shared library (e.g. a.so file on Linux,.pyd on Windows), which exports an initialization function. To be...
Read more >Building Extension Modules - Setuptools
To instruct setuptools to compile the foo.c file into the extension module ... CC , CPP , CXX , and LDSHARED are set,...
Read more >Setuptools can't find my GCC compiler - Numba Discussion
I am attempting to include my AOT-compiled extensions in my setup.py. from ... since I definitely have a C/C++ compiler on my system,...
Read more >Building a Python C Extension Module
This is a basic C program that uses fputs() to write a string to a file stream: ... use gcc or any other...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So is there something that projects need to configure in order to get C++ files compiled with a C++ compiler, or is that simply not possible in setuptools right now, just as it is not possible in distutils? If it’s just not possible, can it please be made possible? (Maybe the patches in the distutils bug report are a starting point?) It is imperative that users (and package management systems acting on their behalf) be able to tell setuptools which C++ compiler to use to compile C++ files and what additional CXXFLAGS to set when doing so.
Can you make a separate issue for this, @filippo82? I don’t want the discussion to be lost in the shuffle of this ticket investigation. I think we need to discuss whether it is feasible to be stricter about the specified language and if so what that would look like.