Skip to content

Compile on debian 11 with python 3.9 and gcc10 #37

Description

@marcelobianchi

I was not able to compile it on a Debian 11 with plain python 3.9 and gcc10. The first issue is a type mismatch on GCC and the second issue is the order to compile the Fortran files. The spectra.f90 should be the first one to be compiled but distutils does not respect that.

Solutions:

  1. Add the option -fallow-argument-mismatch" to the compile flag.
  2. Create a secondary fake library to force distutil to compile spectra.f90 first (this is hackish) but point me to the solution.

What I did to get it installed and compiled in a pretty hackish manner, don't recommend to anyone, but pointing to what should be properly done on distutils:

stavanger:~/mtspec$ git diff
diff --git a/setup.py b/setup.py
index b7ac047..d6ddbd3 100644
--- a/setup.py
+++ b/setup.py
@@ -141,10 +141,20 @@ if arch_flag:
 else:
     extra_link_args = None
 
+liba = MyExtension('mtspeca',
+                  libraries=["gfortran"],
+                  library_dirs=get_libgfortran_dir(),
+                  extra_link_args=extra_link_args,
+                  extra_compile_args = ["-fallow-argument-mismatch"],
+                  sources=[
+                      src + 'spectra.f90'])
+
+
 lib = MyExtension('mtspec',
                   libraries=["gfortran"],
                   library_dirs=get_libgfortran_dir(),
                   extra_link_args=extra_link_args,
+                  extra_compile_args = ["-fallow-argument-mismatch"],
                   sources=[
                       src + 'spectra.f90', src + 'adaptspec.f90',
                       src + 'atanh2.f90',
@@ -187,7 +197,7 @@ setup_config = dict(
         'tests': ['flake8>=3']
     },
     ext_package='mtspec.lib',
-    ext_modules=[lib],
+    ext_modules=[liba, lib],
     classifiers=[
         'Development Status :: 4 - Beta',
         'Environment :: Console',

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions