Building Sage 9.2 on Mac fails due to cysignals

196 views
Skip to first unread message

modp...@gmail.com

unread,
Oct 26, 2020, 9:45:28 AM10/26/20
to sage-devel

I'm building Sage 9.2 from source on macOS Catalina 10.15.7, however, it fails 
when trying to install cysignals. More precisely, it throws the following error:

gcc -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/myUser/app/sage-9.2/local/lib -Wl,-rpath,/Users/myUser/app/sage-9.2/local/lib -L/usr/local/opt/llvm/lib -I/usr/local/opt/llvm/include -Wp,-U_FORTIFY_SOURCE build/temp.macosx-10.15-x86_64-3.8/build/src/cysignals/signals.o -L/usr/local/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.15-x86_64-3.8/cysignals/signals.cpython-38-darwin.so -lpari -pthread
  ld: illegal thread local variable reference to regular symbol _PARI_SIGINT_block for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'gcc' failed with exit status 1
  Building wheel for cysignals (setup.py): finished with status 'error'
  ERROR: Failed building wheel for cysignals

This is my compiler version:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.21)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Any idea what the problem might be, and how to solve it?

Dima Pasechnik

unread,
Oct 26, 2020, 9:50:42 AM10/26/20
to sage-devel
please post the top-level config.log here

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/38ff74b7-a4bf-4118-8519-9f57736ba532n%40googlegroups.com.

Dima Pasechnik

unread,
Oct 26, 2020, 10:15:53 AM10/26/20
to sage-devel
also, if you have Homebrew, you should run 

source .homebrew-build-env

before

./configure

Dima Pasechnik

unread,
Oct 26, 2020, 10:23:38 AM10/26/20
to sage-devel
also note that you apparently have something in
-L/usr/local/opt/llvm/lib (installed from Homebrew ?) which might lead
to surprises.
Do you have some LDFLAGS set?
It would help if you also post logs/pkgs/cysignals-1.10.2.log

modp...@gmail.com

unread,
Oct 27, 2020, 4:42:54 AM10/27/20
to sage-devel
Please find config.log and cysignals-1.10.2.log attached. I already run "source .homebrew-build-env" before configuring.
And yes I also have llvm installed through Homebrew.

config.log
cysignals-1.10.2.log

Dima Pasechnik

unread,
Oct 27, 2020, 6:46:10 AM10/27/20
to sage-devel
I'd have tried removing llvm and trying again. Perhaps this is a conflict between Homebrew packages.

Matthias Koeppe

unread,
Oct 27, 2020, 12:10:58 PM10/27/20
to sage-devel
From config.log:

configure:5906: gcc -v >&5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.21)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:5917: $? = 0
...
configure:6029: gcc -o conftest  -I/usr/local/opt/llvm/include -L/usr/local/opt/llvm/lib conftest.c  >&5

This looks like an unsupported configuration - injecting these -L and -I flags via environment variables, but continuing to use Apple's gcc.
If you are trying to compile with homebrew's llvm, you should probably configure by setting CC and CXX as well. But this is also untested - I have created https://trac.sagemath.org/ticket/30835#ticket for testing such a configuration.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-...@googlegroups.com.

modp...@gmail.com

unread,
Oct 28, 2020, 5:57:06 AM10/28/20
to sage-devel

I tried uninstalling LLVM and building it again, but it fails again for cysignals. 
But the problem now seems that it still sets -I and -L flags with non-existent LLVM directories.
cysignals-1.10.2.log

Dima Pasechnik

unread,
Oct 28, 2020, 7:27:27 AM10/28/20
to sage-devel
try 
make distclean

and the build 

Zachary Scherr

unread,
Oct 28, 2020, 10:04:01 AM10/28/20
to sage-devel
Just wanted to make a couple of comments.  First off, brew installs llvm as keg-only meaning that sage shouldn't even be able to find it unless you manually added something like:

export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"

to your profile.  But even after I tried that myself, I failed to reproduce your error on my own Mac machine.  This makes me think that you might want to have a look at the version of Pari you installed on your computer.  I noticed that ./configure finds a copy of Pari in /usr/local on your computer.  You can see that the specific error it references mentions:

 ld: illegal thread local variable reference to regular symbol _PARI_SIGINT_block for architecture x86_64

If removing llvm and make distclean doesn't solve your problem then you may want to look into where you got your Pari.  It seems plausible that Pari might have been built in some funky way and that is what's causing your issue. 

modp...@gmail.com

unread,
Oct 28, 2020, 10:12:35 AM10/28/20
to sage-devel
Yes, I have manually installed Pari 2.11.4 after configuring it with:
Confgure --mt=pthread --tune

Dima Pasechnik

unread,
Oct 28, 2020, 10:32:01 AM10/28/20
to sage-devel


On Wed, 28 Oct 2020, 14:12 modp...@gmail.com, <modp...@gmail.com> wrote:
Yes, I have manually installed Pari 2.11.4 after configuring it with:
Confgure --mt=pthread --tune

this it the cause of your problem, as Sage doesn't work with threaded libpari.

Message has been deleted

Dima Pasechnik

unread,
Oct 28, 2020, 3:01:43 PM10/28/20
to sage-devel


On Wed, 28 Oct 2020, 14:33 Zachary Scherr, <zsc...@gmail.com> wrote:
Hopefully somebody with more experience can weigh in, but for the record I have pari installed via homebrew and there the configure is only with --with-gmp and --with-readline and that works with building sage.  It's plausible that the -mt=pthread is what's causing the issues.

Hombrew does not provide Pari packages. Unless you install them manually (these are just data files)
it will not be used by Sage.

If you install Pari with  -mt=pthread
into /usr/local, with its packages, it will be accepted by Sage, causing this problem.

Patches to fix this are welcome.
Ideally it can be a short C program to link against libpari, which would fail with the error message reported on this thread.



modp...@gmail.com

unread,
Oct 29, 2020, 12:34:30 PM10/29/20
to sage-devel
Okay rebuilding PARI without -mt=pthread option worked. 
But now building the documentation fails. Please find the log file attached.
Anyway, I currently build it without documentation by running 'make build' only.
But was curious why documentation fails.

dochtml.log

Zachary Scherr

unread,
Oct 29, 2020, 12:45:42 PM10/29/20
to sage-devel
Did you by any chance install fortran via:

brew cask install gfortran?

from your config.log file it finds gfortran version 8, but the most recent homebrew fortran is 10.2.

Maybe try uninstalling gfortran and then either brew install gcc or brew reinstall gcc to get a more up to date fortran.  For example on my Mac when I run gfortran --version I get:

GNU Fortran (Homebrew GCC 10.2.0) 10.2.0

Reply all
Reply to author
Forward
0 new messages