Can't build C++11 libraries with distutils.command.build_clib because it lacks extra_compile_args
Hi! I am trying to use distutils.command's build_clib to compile C++11 code but had to monkey patch build_clib to support the extra_compile_args "-std=c++11", see my_build_libraries in http://sageregina.unhyperbolic.org/setup.py . As you can see, it was only adding the line extra_postargs = build_info.get('extra_compile_args')) to objects = self.compiler.compile( sources, output_dir=self.build_temp, macros=macros, include_dirs=include_dirs, ...) in build_clib.py. Could you make this change to distutils so that is available for everyone and I can eventually stop monkey-patching? Best wishes, Matthias Goerner
On Tue, Feb 23, 2016 at 1:53 AM, Matthias Goerner <enischte@gmail.com> wrote:
Hi!
I am trying to use distutils.command's build_clib to compile C++11 code but had to monkey patch build_clib to support the extra_compile_args "-std=c++11", see my_build_libraries in http://sageregina.unhyperbolic.org/setup.py .
As you can see, it was only adding the line
extra_postargs = build_info.get('extra_compile_args'))
to
objects = self.compiler.compile( sources, output_dir=self.build_temp, macros=macros, include_dirs=include_dirs, ...)
in build_clib.py. Could you make this change to distutils so that is available for everyone and I can eventually stop monkey-patching?
Hi, I don't believe build_clib is really supported. You can't even find much reference to it or how to use it in the documentation. I believe it's a legacy of distutils' earlier naive attempts to claim to support compilation of C/C++ libraries, but that's too lacking in flexibility to really be useful beyond the most trivial cases. Hence a decade+ of frustration with using distutils/setuptools to build projects that rely on non-Python libraries and various outcroppings of third-party projects intending to improve on that and the like. You probably won't get distutils patched, but what you can always do is subclass commands to add additional functionality. This is less hacky the monkey-patching and is generally well supported. The long tradition of this is why distutils is nearly impossible to change :) Erik
participants (2)
-
Erik Bray
-
Matthias Goerner