Closed mkoeppe closed 3 years ago
Branch pushed to git repo; I updated commit sha1. New commits:
914ea58 | build/pkgs/python3/spkg-configure.m4: Get rid of stray AC_SUBST |
Branch pushed to git repo; I updated commit sha1. New commits:
986739b | m4/sage_check_python_for_venv.m4: Fix reason |
Thanks for spotting these mistakes!
Otherwise, this looks very plausible.
I updated https://github.com/kliem/sage/pull/36/ (not the last two commits, but they are cosmetic).
This works for me on OS X Catalina. If I also include #31204, it passes most doctests. I see a few failures I don't remember seeing before:
sage -t --long --random-seed=0 src/sage_setup/find.py
**********************************************************************
File "src/sage_setup/find.py", line 278, in sage_setup.find.installed_files_by_module
Failed example:
f1
Expected:
'sage/structure/__init__.py'
Got:
'/Users/jpalmier/Library/Caches/com.apple.python/Users/jpalmier/Desktop/Sage/git/sage/local/lib/python3.8/site-packages/sage/structure/__init__.cpython-38.pyc'
**********************************************************************
File "src/sage_setup/find.py", line 280, in sage_setup.find.installed_files_by_module
Failed example:
f2
Expected:
'sage/structure/....pyc'
Got:
'sage/structure/__init__.py'
and
sage -t --long --random-seed=0 src/sage_setup/clean.py
**********************************************************************
File "src/sage_setup/clean.py", line 95, in sage_setup.clean._find_stale_files
Failed example:
for f in stale_iter:
if f.endswith(skip_extensions): continue
if '/ext_data/' in f: continue
print('Found stale file: ' + f)
Expected nothing
Got:
Found stale file: /Users/jpalmier/Library/Caches/com.apple.python/Users/jpalmier/Desktop/Sage/git/sage/local/lib/python3.8/site-packages/sage/all_cmdline.cpython-38.pyc
Found stale file: /Users/jpalmier/Library/Caches/com.apple.python/Users/jpalmier/Desktop/Sage/git/sage/local/lib/python3.8/site-packages/sage/version.cpython-38.pyc
[ and many more lines of such messages ]
Why is it looking in $HOME/Library
? Also, the files there look from their dates as if they were created during this build of Sage.
This does not work for me with OS X Big Sur, though: many packages (cython, pynac, gmpy2, psutil, pillow, kiwisolver, cffi) fail to build with the error "clang: error: the clang compiler does not support '-march=native'".
Hold on, I have to run ./bootstrap
and try again.
Confirmed, these packages all fail after
make distclean && ./bootstrap && ./configure --with-python=/usr/bin/python3 && make -k
Replying to @jhpalmieri:
This works for me on OS X Catalina. If I also include #31204, it passes most doctests. I see a few failures I don't remember seeing before [...] Why is it looking in
$HOME/Library
? Also, the files there look from their dates as if they were created during this build of Sage.
Is PYTHONPYCACHEPREFIX
set on your system? https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX
(#31314)
config.log
from the big sur system please
Replying to @mkoeppe:
Replying to @jhpalmieri:
This works for me on OS X Catalina. If I also include #31204, it passes most doctests. I see a few failures I don't remember seeing before [...] Why is it looking in
$HOME/Library
? Also, the files there look from their dates as if they were created during this build of Sage.Is
PYTHONPYCACHEPREFIX
set on your system? https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX (#31314)
No, not normally and not after running ./sage --sh
.
Attachment: config.2.log
config.log for failed Big Sur build
Replying to @jhpalmieri:
Replying to @mkoeppe:
Replying to @jhpalmieri:
This works for me on OS X Catalina. If I also include #31204, it passes most doctests. I see a few failures I don't remember seeing before [...] Why is it looking in
$HOME/Library
? Also, the files there look from their dates as if they were created during this build of Sage.Is
PYTHONPYCACHEPREFIX
set on your system? https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX (#31314)No, not normally and not after running
./sage --sh
.
However:
% /usr/bin/python3
Python 3.8.2 (default, Dec 21 2020, 15:06:04)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.pycache_prefix
'/Users/jpalmier/Library/Caches/com.apple.python'
This is not how /usr/local/bin/python3
behaves: sys.pycache_prefix
is None
there. The Python documentation suggests that the default setting should be None
since I am not passing a -X
argument nor am I setting PYTHONPYCACHEPREFIX
.
hm... config.2.log does not look like it's coming from this branch...
Replying to @jhpalmieri:
% /usr/bin/python3 Python 3.8.2 (default, Dec 21 2020, 15:06:04) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.pycache_prefix '/Users/jpalmier/Library/Caches/com.apple.python'
Same here. Looks like Apple has preconfigured their build to do this. I'll update the description of #31314.
Replying to @mkoeppe:
hm... config.2.log does not look like it's coming from this branch...
Sorry, you're right. Typo on my part: I checked out #31127 instead of #31227. Trying again now.
Now with Big Sur, cysignals
and scipy
fail. For scipy
, the error looks like this:
/Users/palmieri/Desktop/Sage/sage_builds/TESTING/clean/sage-9.3.beta6/local/lib/python3.8/site-packages/numpy/distutils/system_info.py:838: UserWarning: Specified path /usr/local/include/python3.8 is invalid.
Somehow it's picking up /usr/local
. I'm not sure what's going on with cysignals
. Logs attached.
config.log for failed Big Sur build
Attachment: config.3.log
Attachment: cysignals-1.10.2.log
Replying to @jhpalmieri:
Now with Big Sur,
cysignals
andscipy
fail. Forscipy
, the error looks like this:/Users/palmieri/Desktop/Sage/sage_builds/TESTING/clean/sage-9.3.beta6/local/lib/python3.8/site-packages/numpy/distutils/system_info.py:838: UserWarning: Specified path /usr/local/include/python3.8 is invalid.
I think the actual error is this one:
ar: adding 50 object files to build/temp.macosx-10.14.6-x86_64-3.8/libsuperlu_src.a
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: build/temp.macosx-10.14.6-x86_64-3.8/libsuperlu_src.a will be fat and ar(1) will not be able to operate on it
ar: adding 50 object files to build/temp.macosx-10.14.6-x86_64-3.8/libsuperlu_src.a
ar: build/temp.macosx-10.14.6-x86_64-3.8/libsuperlu_src.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
ar: build/temp.macosx-10.14.6-x86_64-3.8/libsuperlu_src.a: Inappropriate file type or format
Is MACOSX_DEPLOYMENT_TARGET
set to something on your big sur system?
Replying to @mkoeppe:
Is
MACOSX_DEPLOYMENT_TARGET
set to something on your big sur system?
No, but who knows what Xcode and/or homebrew are doing these days.
from cysignals.log:
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -O2 -g -Wp,-U_FORTIFY_SOURCE -DCYTHON_CLINE_IN_TRACEBACK=0 -U_FORTIFY_SOURCE -Isrc/cysignals -Isrc -I/Users/palmieri/Desktop/Sage/sage_builds/TESTING/clean/sage-9.3.beta6/local/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c build/src/cysignals/signals.c -o build/temp.macosx-10.14.6-x86_64-3.8/build/src/cysignals/signals.o -pthread
In file included from build/src/cysignals/signals.c:1570:
In file included from build/src/cysignals/implementation.c:58:
In file included from /Users/palmieri/Desktop/Sage/sage_builds/TESTING/clean/sage-9.3.beta6/local/include/pari/pari.h:49:
../src/kernel/none/divll_pre.h:30:10: error: invalid output constraint '=a' in asm
return divll(~0UL, n);
^
This is trying to build for -arch arm64 -arch x86_64
and is tripping over the installed pari header ... which is arch-specific!
Before I source .homebrew-build-env
, I only set these environment variables:
BIBINPUTS=/Users/palmieri/iCloud/Documents/tex/bibtex:.:
EDITOR=emacs
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
MAKE='make -j6'
MAKEFLAGS=-j6
PAGER=less
PATH=/Users/palmieri/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
(If I run export
at the start of my .zshrc file and also comment out the line that runs .homebrew-build-env
, and then run export
again with an actual running terminal, these are the differences.) Nothing strange there, nothing that I think should cause any problems. This is on the Big Sur system, but the Catalina system has a very similar configuration.
It seems that we need to set ARCHFLAGS=""
in more situations. The default set by /usr/bin/python3
, trying to build for both architectures, is unrealistic to support -- this would require major changes to how we install libraries.
Branch pushed to git repo; I updated commit sha1. New commits:
0b3e70d | build/pkgs/python3/spkg-configure.m4: If PYTHON_FOR_VENV is configured to build multiarch extensions, set SAGE_ARCHFLAGS to disable it |
Here's a new version to try on big sur
Branch pushed to git repo; I updated commit sha1. New commits:
372adcb | .github/workflows/tox.yml: Update xcode versions |
Started tests at https://github.com/mkoeppe/sage/actions/runs/526769308 but it looks like there is a long wait time to get macos instances
Description changed:
---
+++
@@ -14,9 +14,9 @@
$ /usr/bin/python3 -m sysconfig |grep '\bCFLAGS =' CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64" -ARCHFLAGS="" /usr/bin/python3 -m sysconfig |grep '\bCFLAGS =' + +$ ARCHFLAGS="" /usr/bin/python3 -m sysconfig |grep '\bCFLAGS =' CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch x86_64 " -egret:~/s/sage/sage-rebasing/worktree-algebraic-2018-spring (t/31132/homebrewunusedpackagessingularpari____in__usr_local_leak_into_build_when_using_homebrew_s_python3 *
In this ticket, if the distutils test fails, we try if setting `ARCHFLAGS=""` fixes it. In that case, we store a configuration variable that causes `sage-env` to set `ARCHFLAGS` as well.
Description changed:
---
+++
@@ -19,7 +19,10 @@
CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch x86_64 "
-In this ticket, if the distutils test fails, we try if setting ARCHFLAGS=""
fixes it. In that case, we store a configuration variable that causes sage-env
to set ARCHFLAGS
as well.
+In this ticket, if the distutils test fails, we try if setting ARCHFLAGS=""
fixes it. Also, after accepting a system python and ARCHFLAGS
so far has not been set, we test whether the system python wants to do the multi-arch build.
+In either of these two cases, we store a configuration variable that causes sage-env
to set ARCHFLAGS
as well.
+This is somewhat complicated logic - we are tiptoeing around previous breakage that had been caused by setting ARCHFLAGS
unconditionally (#29408).
+
+
Branch pushed to git repo; I updated commit sha1. New commits:
fc8b676 | SAGE_CHECK_PYTHON_FOR_VENV: Rework with less nesting |
For the record, I was able to successfully build sage and documentation with this ticket on Big Sur using
--with-python=/usr/bin/python3
Thanks for testing!
Works for me with the system Python 3 on both Big Sur and Catalina.
Thanks for testing!
Let's deal with issue #31314 (messages from find_stale_files
) in a follow up.
Ready for review?
Replying to @mkoeppe:
Started tests at https://github.com/mkoeppe/sage/actions/runs/526769308 but it looks like there is a long wait time to get macos instances
Some results have been coming in:
local-homebrew-macos-10.15-xcode-11.7-{minimal,standard}
: cleanlocal-homebrew-macos-11.0-xcode-11.7-{minimal,standard}
: Homebrew complains that xcode is too oldStill waiting for the tests with other xcode versions (12.2, 12.3, 12.4). No failures so far.
Note all runs are on x86_64
- we do not have test infrastructor for macos-arm64
yet.
Changed reviewer from https://github.com/kliem/sage/pull/36/checks, Jonathan Kliem to Jonathan Kliem
I'm happy with this ticket, but I would like another opinion on this.
Ok, I give it another 24 hours. If nobody speaks up, I'll give a positive review (after taking a final look of course).
I don't feel like I have enough experience to review this, but it certainly built on Big Sur and Catalina. I'm going to upgrade Big Sur to 11.2 later and see if this builds on 11.2 as well.
Replying to @mkoeppe:
Started tests at https://github.com/mkoeppe/sage/actions/runs/526769308 but it looks like there is a long wait time to get macos instances
Some more results:
local-homebrew-macos-10.15-xcode-{12.2,12.3,12.4}-{minimal,standard}
: clean except for doctest errors from ld: warning
(#31204)local-homebrew-macos-11.0-xcode-{12.2,12.3}-minimal
: scipy
build fails (https://github.com/mkoeppe/sage/runs/1804239019?check_suite_focus=true)local-homebrew-macos-11.0-xcode-12.3-standard
: clean except for doctest errors from ld: warning
(#31204)Let's take care of the scipy
build failures in #31326.
I think this is sufficient improvement for one ticket.
Seems to work well on Big Sur 11.2 with standard homebrew packages. When running make ptest I get the annoying warnings:
ld: warning: dylib (/usr/local/lib/libgmp.dylib) was built for newer macOS version (10.15) than being linked (10.14.6)
which is probably because the MACOSX_DEPLOYMENT_TARGET for /usr/bin/python3 is set to 10.14.6 which doesn't match what Homebrew sets. It's easy enough to eliminate the warnings by setting MACOSX_DEPLOYMENT_TARGET=11.0 before doing all the testing.
Otherwise, everything seems to build/test correctly.
(from #31132)
27122 determines whether CC accepts
-march=native
and then adds it globally toCFLAGS
inbuild/bin/sage-build-env
.30725 fixes this for macOS, where some packages are explicitly built with
clang
.However, there is another mechanism how
clang
can come in: Python extension modules are compiled with the compiler listed in sysconfig. On macOS with homebrew, using/usr/bin/python3
, this could again beclang
, which does not accept-march=native
in combination with-arch arm64
(which is provided even on x86_64 ifARCHFLAGS
is unset).In this ticket, we fix this by checking whether the compiler used by distutils accepts
-march=native
(or more generally, the flags determined earlier byconfigure
). If it does not, then we disable the use of these flags.In order to test this with
/usr/bin/python3
from XCode 12.3 (on macOS 10.15 (Catalina)), we fix another issue: This python3 (3.8.2) is not able to build extension modules because it emits-arch arm64 -arch x86_64
unlessARCHFLAGS
is set explicitlyIn this ticket, if the distutils test fails, we try if setting
ARCHFLAGS=""
fixes it. Also, after accepting a system python andARCHFLAGS
so far has not been set, we test whether the system python wants to do the multi-arch build.In either of these two cases, we store a configuration variable that causes
sage-env
to setARCHFLAGS
as well.This is somewhat complicated logic - we are tiptoeing around previous breakage that had been caused by setting
ARCHFLAGS
unconditionally (#29408).Depends on #31132 Depends on #30725
CC: @jhpalmieri @zlscherr @dimpase @kliem @vbraun
Component: build: configure
Author: Matthias Koeppe
Branch/Commit:
fc8b676
Reviewer: Jonathan Kliem
Issue created by migration from https://trac.sagemath.org/ticket/31227