sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.47k stars 487 forks source link

`openblas` and `blas` when running `./sage --testall` after fresh installation from source on Arch #35606

Open BenjaminMoraga opened 1 year ago

BenjaminMoraga commented 1 year ago

Is there an existing issue for this?

Did you read the documentation and troubleshoot guide?

Environment

- **OS**: Arch Linux with kernel 6.2.13-arch1-1
- **Sage Version**: develop

Steps To Reproduce

  1. I succesfully installed Sage from the source as stated in https://doc.sagemath.org/html/en/installation/source.html#step-by-step-installation-procedure.
  2. When installing recommended packages from arch repository it asked me if I want to replace blas with openblas, I answered yes.
  3. The compilation went on with no problems during the night.
  4. The I tested it with ./sage --test-all and it raise an ImportError, the problem was undefined symbol: cblas_ctrmv.
  5. I replaced openblas with blas just by intuition, and now the testing is going on with no problems.

Expected Behavior

The testing should go on with packages listed in https://doc.sagemath.org/html/en/installation/source.html#step-by-step-installation-procedure.

Alternatively, the documentation for Arch should recommend installing blas instead of openblas.

Actual Behavior

Running ./sage --test-all after a fresh installation from source in Arch as recommended on https://doc.sagemath.org/html/en/installation/source.html#step-by-step-installation-procedure raise an ImportError, the problem was undefined symbol: cblas_ctrmv.

The testing goes with no problems after replacing openblas with blas.

Additional Information

No response

mkoeppe commented 1 year ago

@antonio-rojas This is similar to but perhaps not the same as #34779

antonio-rojas commented 1 year ago

What is the full error message?

antonio-rojas commented 1 year ago

@antonio-rojas This is similar to but perhaps not the same as #34779

scipy doesn't use cblas AFAIK, so it doesn't look to be the same.

BenjaminMoraga commented 1 year ago

What is the full error message?

Traceback (most recent call last):
  File "/home/benjamin/git/sage/src/bin/sage-runtests", line 154, in <module>
    err = DC.run()
  File "/home/benjamin/git/sage/src/sage/doctest/control.py", line 1385, in run
    self.run_doctests()
  File "/home/benjamin/git/sage/src/sage/doctest/control.py", line 1055, in run_doctests
    self.dispatcher = DocTestDispatcher(self)
  File "/home/benjamin/git/sage/src/sage/doctest/forker.py", line 1622, in __init__
    init_sage(controller)
  File "/home/benjamin/git/sage/src/sage/doctest/forker.py", line 193, in init_sage
    controller.load_environment()
  File "/home/benjamin/git/sage/src/sage/doctest/control.py", line 592, in load_environment
    return import_module(self.options.environment)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/benjamin/git/sage/src/sage/repl/ipython_kernel/all_jupyter.py", line 5, in <module>
    from sage.all_cmdline import *
  File "/home/benjamin/git/sage/src/sage/all_cmdline.py", line 17, in <module>
    from sage.all import *
  File "/home/benjamin/git/sage/src/sage/all.py", line 75, in <module>
    from sage.misc.all       import *         # takes a while
  File "/home/benjamin/git/sage/src/sage/misc/all.py", line 72, in <module>
    from .functional import (additive_order,
  File "/home/benjamin/git/sage/src/sage/misc/functional.py", line 26, in <module>
    from sage.rings.complex_double import CDF
ImportError: /home/benjamin/git/sage/local/lib/libgsl.so.27: undefined symbol: cblas_ctrmv
antonio-rojas commented 1 year ago

So the problem is that gsl didn't get linked to cblas. Did you have cblas installed when you built sage?

antonio-rojas commented 1 year ago

Also, gsl should have been picked up from the system and not built. It seems that you didn't actually have all recommended packages from https://doc.sagemath.org/html/en/installation/source.html#step-by-step-installation-procedure installed when you built sage.

BenjaminMoraga commented 1 year ago

Also, gsl should have been picked up from the system and not built. It seems that you didn't actually have all recommended packages from https://doc.sagemath.org/html/en/installation/source.html#step-by-step-installation-procedure installed when you built sage.

As I said before, I installed every package in the link you gave me; moreover, the problem seems to be with the recomended package openblas, because when I installed blas the testing goes on with no problems (but the guide recomends openblas). Besides, cblas was installed in both tests, the successful with blas and the failed one.

antonio-rojas commented 1 year ago

Please attach your config.log

BenjaminMoraga commented 1 year ago

Please attach your config.log

I tried a clean install, and now sagemath don't compile anymore. The problem is with openblas, but changing to blas didn't solve the problem as before. I think that the problem may be the version? I get openblas 0.3.23-1 form Arch repository, and sagemath tries to compile openblas 0.3.21 (and don't recognize the installed version). I attach you the config file. I also attach you the openblas log file.

Maybe this is also important: all the packages eclib, fflas-ffpack, gsl, iml, linbox, openblas, lapack, cblas, suitesparse, coin-or-cbc, gnupg, openssh and igraph are installed form the Arch repository but when I run ./configure they aren't recognized.

config.log openblas-0.3.21.log

BenjaminMoraga commented 1 year ago

Please attach your config.log

Also I've got some new info: there are two different problems:

  1. The sage compiler doesn't recognize the Arch version of openblas, as I said before.
  2. The sage compiler can't compile openblas with the suggested global MAKE="make -j4", when I went back to MAKE="make -j1" I finally get a successful compilation. Although I'm a beginner, I think the issue is the order in which the packages are compiled.
antonio-rojas commented 1 year ago
  1. The sage compiler doesn't recognize the Arch version of openblas, as I said before.
  2. The sage compiler can't compile openblas with the suggested global MAKE="make -j4", when I went back to MAKE="make -j1" I finally get a successful compilation. Although I'm a beginner, I think the issue is the order in which the packages are compiled.

(1) is https://github.com/sagemath/sage/pull/35524 which is merged in the latest rc. (2) is tracked in https://github.com/sagemath/sage/issues/34899. But those are unrelated to your original issue, where you said compilation finished successfully. If you can't reproduce that and don't keep a configure log of it, there is not much that can be done.

mkoeppe commented 1 year ago

keep a configure log of it

This is an unfortunate shortcoming of our logging. We keep package installation logs forever (appending), but config.log is overwritten. I had a solution for this in #33262, which I'll have to rebase

BenjaminMoraga commented 1 year ago
  1. The sage compiler doesn't recognize the Arch version of openblas, as I said before.
  2. The sage compiler can't compile openblas with the suggested global MAKE="make -j4", when I went back to MAKE="make -j1" I finally get a successful compilation. Although I'm a beginner, I think the issue is the order in which the packages are compiled.

(1) is #35524 which is merged in the latest rc. (2) is tracked in #34899. But those are unrelated to your original issue, where you said compilation finished successfully. If you can't reproduce that and don't keep a configure log of it, there is not much that can be done.

Thank you very much for your help. Now that I install sage successfuly, I run make ptest, and I get the same error as before, so I unisntalled openblas and installed blas and re-run make ptest and it went on with no problems. Which log file in especific should I attach? I'm sorry for asking that, but It's my first time installing sage from source and using git/github.

antonio-rojas commented 1 year ago

Please attach config.log