Skip to content

allow specifying non-default Fortran compiler with FC env var #13462

Closed

Description

@rgommers

Using flang via setting the FC environment variable is reported not to be working at scipy/scipy#10125. A -lgfortran flag is added, when gfortran isn't installed on the system. This is due to the config stage not knowing about FC and always picking up GnuFortranCompiler if --fcompiler is not used.

Activity

  1. isuruf commented on May 3, 2019

    @isuruf
    Contributor

    flang is not added to default_compiler

    _default_compilers = (

    and is only defined for python 3 for some weird reason,
    if sys.version_info >= (3, 5):

  2. dimpase commented on May 12, 2020

    @dimpase
    Contributor

    Another error I am getting with flang in OpenBSD 6.6 (based on clang 8.0.1) is that it attempts to use it with -g flag, which results in inability to compile anything with a named COMMON block (a known flang bug), e.g. an attempt to build scipy ends with

        compiling Fortran sources
        Fortran f77 compiler: flang -Wall -g -ffixed-form -fno-second-underscore -I/usr/local/include -fPIC
        Fortran f90 compiler: flang -Wall -g -fno-second-underscore -I/usr/local/include -fPIC
        Fortran fix compiler: flang -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -I/usr/local/include -fPIC
        creating build/temp.openbsd-6.6-amd64-3.7/scipy/integrate
        creating build/temp.openbsd-6.6-amd64-3.7/scipy/integrate/mach
        compile options: '-I/home/dima/sagetrac-mirror/local/lib/python3.7/site-packages/numpy/core/include -c'
        flang:f77: scipy/integrate/mach/d1mach.f
        flang: warning: argument unused during compilation: '-fno-second-underscore' [-Wunused-command-line-argument]
        /tmp/d1mach-f87f56.ll:894:17: error: expected metadata type
        !121 = distinct !DICommonBlock(scope: !17, declaration: !126, name: "d9mach")
                        ^
    

    Given that the only other Fortran provided on OpenBSD is g95 (very old), it's a show-stopper.

    Is there a graceful way to remove -g? If not, what should I patch?

  3. dimpase commented on May 12, 2020

    @dimpase
    Contributor

    A related question - what is the need for that COMMON block? It does not seem to be used anywhere in scipy. Can it just be removed?

  4. rgommers commented on Nov 21, 2022

    @rgommers
    MemberAuthor

    This is another feature request for numpy.distutils. Bug reports about numpy.distutils are still needed until it is completely removed from numpy, however feature requests we can close now.

  5. rgommers commented on Nov 21, 2022

    @rgommers
    MemberAuthor

    I'll also note that Meson already does the right thing here.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions