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

Compilation error with gfortran 11.1 on macOS with homebrew #82

Closed
mkoeppe opened this issue Jun 16, 2021 · 13 comments
Closed

Compilation error with gfortran 11.1 on macOS with homebrew #82

mkoeppe opened this issue Jun 16, 2021 · 13 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jun 16, 2021

Installing ttpy (latest on PyPI or current git master) on macOS Big Sur (Intel) with homebrew leads to multiple compilation errors like the following:

  Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/COMPLEX(8)).
  tt/tt-fort/ort.f90:273:22:
  
    273 |    call dgemv('n',n,r,-1.d0,yy,n,gv,1, 1.d0,x,1)
        |                      1
  ......
    346 |     call dgemv('n',n,ru,-one,u,n,gu,1, one,x,1)
        |                        2
@dimpase
Copy link
Contributor

dimpase commented Jun 18, 2021

The errors are in a git submodule, I've opened the issue in the corresponding repo: oseledets/tt-fort#6

@oseledets
Copy link
Owner

Should we update the submodule now?

@dimpase
Copy link
Contributor

dimpase commented Jun 19, 2021

The submodule is updated, but the fix is in its Makefile.in, which is not used here.

One has to figure out how to tell
tt/setup.py to use the flag --fallow-argument-mismatch while calling gfortran in config.add_library('mytt', sources=...)

@dimpase
Copy link
Contributor

dimpase commented Jun 19, 2021

the submodule actually even has working github actions test now :-)

@dimpase
Copy link
Contributor

dimpase commented Jun 19, 2021

But for the life of me, I don't grok numpy.distutils, it's such a pile of ....
Something like this:

config.add_library('mytt', sources=[join(TTFORT_DIR, x) for x in TTFORT_SRC], extra_f90_compiler_args=['--fallow-argument-mismatch'])

doesn't work.

@dimpase
Copy link
Contributor

dimpase commented Jun 19, 2021

OK, I got it to build with gfortran 11, with the following changes:

diff --git a/tt/core/setup.py b/tt/core/setup.py
index 8f28de6..26a4f3f 100644
--- a/tt/core/setup.py
+++ b/tt/core/setup.py
@@ -40,6 +40,7 @@ def configuration(parent_package='', top_path=None):
     config.add_extension(
         'core_f90',
         sources=ttcore_src,
+        extra_f90_compile_args=['-fallow-argument-mismatch'],
     )
 
     return config
diff --git a/tt/eigb/setup.py b/tt/eigb/setup.py
index dd6240b..87d7a77 100644
--- a/tt/eigb/setup.py
+++ b/tt/eigb/setup.py
@@ -39,6 +39,7 @@ def configuration(parent_package='', top_path=None):
             'mytt',
             'print_lib',
         ],
+        extra_f90_compile_args=['-fallow-argument-mismatch'],
     )
 
     return config
diff --git a/tt/ksl/setup.py b/tt/ksl/setup.py
index 3bc950f..a9d9857 100644
--- a/tt/ksl/setup.py
+++ b/tt/ksl/setup.py
@@ -37,6 +37,8 @@ def configuration(parent_package='', top_path=None):
     config.add_library(
         'expokit',
         sources=expokit_src,
+            extra_f90_compile_args=['-fallow-argument-mismatch'],
+            extra_f77_compile_args=['-fallow-argument-mismatch'],
     )
     config.add_extension(
         'dyn_tt',
@@ -51,6 +53,7 @@ def configuration(parent_package='', top_path=None):
             'expokit',
             'mytt',
         ],
+        extra_f90_compile_args=['-fallow-argument-mismatch'],
     )
 
     return config
diff --git a/tt/setup.py b/tt/setup.py
index 277f90f..b4fc38a 100644
--- a/tt/setup.py
+++ b/tt/setup.py
@@ -59,9 +59,12 @@ def configuration(parent_package='', top_path=None):
         delegate_options_to_subpackages=True,
         quiet=False,
     )
-
+    buildinfo={}
+    buildinfo['extra_f90_compiler_args']=['--fallow-argument-mismatch']
     config.add_library('print_lib', sources=[join(PRINT_DIR, x) for x in PRINT_SRC])
-    config.add_library('mytt', sources=[join(TTFORT_DIR, x) for x in TTFORT_SRC])
+    config.add_library('mytt', sources=[join(TTFORT_DIR, x) for x in TTFORT_SRC],
+            extra_f90_compile_args=['-fallow-argument-mismatch'],
+    )
 
     config.add_subpackage('core')
     config.add_subpackage('amen')

this needs more work to make it conditional on the version of gfortran, as this option is not understood by version 9 or earlier.

@dimpase
Copy link
Contributor

dimpase commented Jun 19, 2021

The diff above is here: dimpase@ba9619f

@daskol
Copy link
Collaborator

daskol commented Jul 21, 2021

PR #85 solves the issue. Also, I have created an issue oseledets/tt-fort#12 in the upstream repo in order to remember issue and track progress.

oseledets added a commit that referenced this issue Jul 21, 2021
Allow argument mismatch for GCC Fortran 11  (#82)
oseledets added a commit that referenced this issue Jul 22, 2021
Inject tt.distutils to python path (#82)
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 23, 2021

Thank you, I can confirm that it solves the issue.

I'm using pip install with ttpy @ the specific commit in https://trac.sagemath.org/ticket/31998 now; do you have plans to release a new version of ttpy on PyPI any time soon?

@ocbx33
Copy link

ocbx33 commented Dec 17, 2021

Hello,
I still have the problem with python 3.8 and gcc-11(macos 11.6). The test on line 8 of the file distutils.py
if fcompiler.get_version() >= '11.0':
does not work, because fcompiler.get_version() returns 11
Could you change '11.0' in '11' ?

@dimpase
Copy link
Contributor

dimpase commented Dec 17, 2021

this sounds familiar...

@dimpase
Copy link
Contributor

dimpase commented Dec 17, 2021

Please see #90

@daskol
Copy link
Collaborator

daskol commented Dec 18, 2021

Merged.

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

No branches or pull requests

5 participants