python: add C++ compiler support for distutils#19585
Conversation
FRidh
left a comment
There was a problem hiding this comment.
We should of course try to fix the situation on Darwin, while at the same time stick as much as possible to upstream.
It's not yet clear to me whether this situation is being dealt with upstream. Furthermore, if we fix an issue, we should fix it for all versions of the interpreter that are affected.
There was a problem hiding this comment.
Is this patch accepted upstream? How does this affect non-Darwin? Does this fix anything on non-Darwin?
There was a problem hiding this comment.
and how about other Python versions?
There was a problem hiding this comment.
You can see in the original issue http://bugs.python.org/issue1222585 that distutils were considered frozen at the time, so this has became a won't fix. This Arfrever person was maintaining it outside of the source tree. The patch is supposed to fix things that get compiled with non-gcc on any platform, but the main target is of course Darwin.
There are also patches presented for python 3.3 and 3.4, it doesn't look like it made to python 3.5. I personally don't consciously use any python3 software and I don't know if they use distutils or if they use C++ code at all.
There was a problem hiding this comment.
You can see in the original issue http://bugs.python.org/issue1222585 that distutils were considered frozen at the time, so this has became a won't fix. This Arfrever person was maintaining it outside of the source tree. The patch is supposed to fix things that get compiled with non-gcc on any platform, but the main target is of course Darwin.
If its not accepted upstream, then I think we should only use it when it is necessary. If I understand correctly, it is necessary on Darwin, so I suggest using an optional stdenv.isDarwin for appending this patch and the others as well.
There was a problem hiding this comment.
How about optional !(stdenv.cc.isGCC or false)?
There was a problem hiding this comment.
I don't understand the "or false" part. Wouldn't !(stdenv.cc.isGCC) yield the same result?
There was a problem hiding this comment.
or false is a special syntax for the case when isGNU is not defined to prevent evaluation from failing
There was a problem hiding this comment.
has this patch/issue been reported upstream (numpy)?
There was a problem hiding this comment.
I made this patch myself. I don't see the point of reporting the issue before the main distutils patch is merged to python2, which won't happen.
There was a problem hiding this comment.
This patch, which has landed on master, breaks building scipy on Linux.
There was a problem hiding this comment.
it should probably be lib.optionals (isPy27 && !(stdenv.cc.isGNU or false))
pkgs/top-level/python-packages.nix
Outdated
There was a problem hiding this comment.
has this patch/issue been reported upstream (cython)?
f6a5ce3 to
e653490
Compare
This should help with builds against clang
| + 'SO', 'AR', 'ARFLAGS') | ||
| + | ||
| + cflags = '' | ||
| + cxxflags = '' |
There was a problem hiding this comment.
I don't understand this part very well. The hunk of the original patch that I removed, namely:
--- Makefile.pre.in
+++ Makefile.pre.in
@@ -455,7 +455,7 @@
*\ -s*|s*) quiet="-q";; \
*) quiet="";; \
esac; \
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(CFLAGS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
# Build the platform-specific modules
seems to set CFLAGS in these config vars, however this chunk seems to make it so that the CFLAGS value from the makefile is ignored. So this looks like an inconsistency in original patch.
Perhaps a gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=548776 needs to be tried out.
|
Yes, because this patch depends on the other one
|
Motivation for this change
Fix #18729
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandboxinnix.confon non-NixOS)
nix-shell -p nox --run "nox-review wip"./result/bin/)