Skip to content
New issue

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

tox.ini: Add environments for testing with llvm / clang #30835

Closed
mkoeppe opened this issue Oct 27, 2020 · 40 comments
Closed

tox.ini: Add environments for testing with llvm / clang #30835

mkoeppe opened this issue Oct 27, 2020 · 40 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 27, 2020

https://groups.google.com/d/msg/sage-devel/5lzj9n57oRI/09AtJyUBBQAJ

We add

Examples:

  • tox -e local-homebrew-macos-standard-llvm
  • tox -e local-homebrew-macos-standard-usrlocal-llvm (use at your own risk - updates the global homebrew installation)
  • tox -e docker-fedora-34-standard-llvm

Portability issues (solving them should not be a prerequisite for the present ticket):

When it works on at least a few platforms, we will want to create GH Actions workflows that build Sage with llvm on various platforms for each release tag.

CC: @dimpase @jhpalmieri @videlec @kiwifb

Component: porting

Author: Matthias Koeppe

Branch/Commit: 38e3d3e

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/30835

@mkoeppe mkoeppe added this to the sage-9.3 milestone Oct 27, 2020
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 13, 2021

comment:1

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 13, 2021
@mkoeppe mkoeppe changed the title tox.ini: Test with homebrew llvm tox.ini, GH Actions: Add environments for testing with llvm / clang Jul 9, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 9, 2021

comment:3

Is there a need to distinguish several versions of clang / LLVM on the same system for portability testing purposes?

@mkoeppe

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented Jul 10, 2021

comment:4

Replying to @mkoeppe:

Is there a need to distinguish several versions of clang / LLVM on the same system for portability testing purposes?

that's probably too much trouble. There is a distinction w.r.t. which standard C++ library clang uses, GNU's (libstdc++) or LLVM's (libc++), which is more important.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2021

Commit: 3200b93

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2021

comment:6

Here's some preliminary distro package information - just guesswork based on reading https://repology.org/project/llvm/versions

Help with refining it is welcome


New commits:

3200b93build/pkgs/llvm: New

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2021

comment:7

What's the Fortran situation with LLVM? Use flang or gfortran?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 10, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

8b16cf8tox.ini, build/bin/write-dockerfile.sh: Add configuration factor 'llvm'

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 10, 2021

Changed commit from 3200b93 to 8b16cf8

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 10, 2021

Changed commit from 8b16cf8 to 38e3d3e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 10, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

38e3d3etox.ini [homebrew-llvm]: Set CC, CXX to full path

@mkoeppe

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented Jul 10, 2021

comment:11

Replying to @mkoeppe:

What's the Fortran situation with LLVM? Use flang or gfortran?

flang is still not quite ready for prime time
(I managed to build Sage using flang/clang, but it was not stable)

gfortran is good.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 10, 2021

Author: Matthias Koeppe

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title tox.ini, GH Actions: Add environments for testing with llvm / clang tox.ini: Add environments for testing with llvm / clang Jul 10, 2021
@dimpase
Copy link
Member

dimpase commented Jul 13, 2021

comment:15

I tried tox -e local-direct-llvm on Fedora 32, seems to work.

@dimpase
Copy link
Member

dimpase commented Jul 13, 2021

comment:16

How do I actually run tests in such a local setup (I can't use docker on that machine)

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 13, 2021

comment:17

You can do tox -e local-direct-llvm -- ptest, or tox -e local-direct-llvm -- bash if you want a shell

@jhpalmieri
Copy link
Member

comment:18

I feel like I've had this happen before: I ran tox -e local-homebrew-macos-standard-llvm and by yesterday at 18:13 (according to the timestamp on the file in logs/pkgs) it said " [networkx-2.5.1] successfully installed." Then it sat there with no apparent activity until I hit ctrl-C today at 09:56.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 13, 2021

comment:19

Prime suspect is gfan's testsuite - see #32088

@jhpalmieri
Copy link
Member

comment:21

I reran and gfan's testsuite passed. (I had deleted the old log files, so I don't know if that was the problem the first time.) pillow failed to build, though. (This is OS X 11.4.)

@jhpalmieri
Copy link
Member

Attachment: pillow-8.1.2.log

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 13, 2021

comment:22

Replying to @jhpalmieri:

pillow failed to build, though. (This is OS X 11.4.)

I think this is just that some of Apple's system headers can only be compiled with Apple's compiler.

@jhpalmieri
Copy link
Member

comment:23

I asked a question like this before, but should there be a make target (or similar) that cleans up the .tox directory? Or if we are using tox, are we just supposed to know what we're doing? Maybe this is relevant.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 13, 2021

comment:24

I think what you want, in addition to just removing the .tox directory, is #31111 (tox -e local-direct: Clean up the effects of previous tox -e local-....)

@dimpase
Copy link
Member

dimpase commented Jul 15, 2021

comment:25

Replying to @mkoeppe:

Replying to @jhpalmieri:

pillow failed to build, though. (This is OS X 11.4.)

I think this is just that some of Apple's system headers can only be compiled with Apple's compiler.

No, if you just do

+++ b/build/pkgs/pillow/spkg-install.in
@@ -10,7 +10,7 @@ if [ "$UNAME" = "Darwin" ] ; then
     # #29019
     # https://github.com/python-pillow/Pillow/issues/3438#issuecomment-555019284
     # https://apple.stackexchange.com/questions/372032/usr-include-missing-on-macos-catalina-with-xcode-11/372600#372600
-    export CPATH="$CPATH:`xcrun --show-sdk-path`/usr/include"
+    export CFLAGS="$CFLAGS -DTARGET_OS_IPHONE=0 -DTARGET_OS_OSX=1 -DTARGET_OS_MACCATALYST=0"
 fi
 
 if [ "$CONDA_PREFIX" != "" ]; then

then Pillow builds with Homebrew's clang (perhaps there is a more intelligent way, including some header?).

@dimpase
Copy link
Member

dimpase commented Jul 15, 2021

comment:26

with the patch in comment:25, I can build and doctest Sage on Homebrew llvm/clang/clang++ just fine (modulo few known errors).
(perpending /usr/local/opt/llvm/bin to PATH)

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 15, 2021

comment:27

Upstream report?

@dimpase
Copy link
Member

dimpase commented Jul 15, 2021

comment:28

Replying to @mkoeppe:

Upstream report?

do you have any idea what Pillow is doing in a non-standard way while building Python extensions?
(after all, everything else builds, and these TARGET_OS_... are used in the SDK's stdio.h and stdlib.h)

Perhaps it's a setuptools bug?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 15, 2021

comment:29

Pillow's setup.py does a lot of "discovery", the details are messy. To isolate what is happening here, you could use the PILLOW_BUILD_EXT setting from tox.ini that I use for the macos-nohomebrew environment

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 15, 2021

Replying to @mkoeppe:

Portability issues (solving them should not be a prerequisite for the present ticket):

Let me emphasize that the scope of this ticket should be to add the test environments, which will facilitate testing and porting.

It is not within the scope to do all the porting work.

@dimpase
Copy link
Member

dimpase commented Jul 15, 2021

comment:31

Replying to @mkoeppe:

Pillow's setup.py does a lot of "discovery", the details are messy. To isolate what is happening here, you could use the PILLOW_BUILD_EXT setting from tox.ini that I use for the macos-nohomebrew environment

I am not sure I understand how to
"use the PILLOW_BUILD_EXT setting from tox.ini"

@dimpase
Copy link
Member

dimpase commented Jul 15, 2021

comment:32

If I

export PILLOW_BUILD_EXT="--disable-platform-guessing --disable-jpeg2000 --disable-imagequant --disable-tiff --disable-lcms --disable-webp --disable-webpmux --disable-xcb"

it cannot find zlib. If I remove --disable-platform-guessing it fails with

building 'PIL._imagingmath' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -O2 -g -march=native -g -I/usr/local/Cellar/jpeg/9d/include -I/usr
/local/Cellar/openjpeg/2.4.0/include/openjpeg-2.4 -I/usr/local/Cellar/libtiff/4.3.0/include -I/Users/dima/sage/local/var/tmp/sage/build/pillow-8.1.2/src -I/usr/local/Cellar/freetype/2.10.4/include/freetype2 -I/usr/local/Cellar/little-cms2
/2.12/include -I/Users/dima/sage/local/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/include -I/usr/local/Cellar/freetype/2.10.4/include -I/Users/dima/sag
e/local/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_imagingmath.c -o build/temp.macosx-11-x86_64-3.9/src/_imagingmath.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -O2 -g -march=native -g -DHAVE_LIBZ -DPILLOW_VERSION=\"8.1.2\" -I/
usr/local/Cellar/jpeg/9d/include -I/usr/local/Cellar/openjpeg/2.4.0/include/openjpeg-2.4 -I/usr/local/Cellar/libtiff/4.3.0/include -I/Users/dima/sage/local/var/tmp/sage/build/pillow-8.1.2/src -I/usr/local/Cellar/freetype/2.10.4/include/fr
eetype2 -I/usr/local/Cellar/little-cms2/2.12/include -I/Users/dima/sage/local/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/include -I/usr/local/Cellar/fr
eetype/2.10.4/include -I/Users/dima/sage/local/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_imaging.c -o build/temp.macosx-11-x86_64-3.9/src/_imaging.o
In file included from In file included from src/_imagingft.c:22:
In file included from /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability
-completeness]
        unsigned char   *_base;
                        ^
...
In file included from /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:220:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
    ^
...
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:181:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
   ^

@dimpase
Copy link
Member

dimpase commented Jul 16, 2021

Reviewer: Dima Pasechnik

@dimpase
Copy link
Member

dimpase commented Jul 16, 2021

comment:33

OK, let's deal with Homebrew clang on #32207

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 16, 2021

comment:34

Thanks

@vbraun
Copy link
Member

vbraun commented Jul 23, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants