8000 BUG: f2py cannot find Fortran Compiler correctly while using flang · Issue #22910 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG: f2py cannot find Fortran Compiler correctly while using flang #22910
Closed
@helloworld664

Description

@helloworld664

Describe the issue:

When I use flang to compile RTTOV-11.3 with f2py, it will report a compilation ERROR: numpy.distutils.fcompiler.CompilerNotFound. But before the ERROR, it also prints: Found executable /path/to/compiler/bin/flang.

Reproduce the code example:

export FC=flang
f2py -c --help-fcompiler

Error message:

In "Fortran compilers found" part, it will print:

  --fcompiler=gnu95  GNU Fortran 95 compiler (12.0.0)

Actually, "12.0.0" is flang compiler's version, not GNU95's. So if I specify fcompiler as "flang", numpy will raise CompilerNotFound EXCEPTION. So I have to specify fcompiler as "gnu95" to continue to compile RTTOV.

Runtime information:

Found executable /path/to/compiler/bin/flang
Traceback (most recent call last):
  File "/path/to/python3/bin/f2py", line 8, in <module>
    sys.exit(main())
  File "/path/to/python3/lib/python3.6/site-packages/numpy/f2py/f2py2e.py", line 692, in main
    run_compile()
  File "/path/to/python3/lib/python3.6/site-packages/numpy/f2py/f2py2e.py", line 659, in run_compile
    setup(ext_modules=[ext])
  File "/path/to/python3/lib/python3.6/site-packages/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)
  File "/path/to/python3/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/path/to/python3/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/path/to/python3/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/path/to/python3/lib/python3.6/site-packages/numpy/distutils/command/build.py", line 40, in run
    old_build.run(self)
  File "/path/to/python3/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/path/to/python3/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/path/to/python3/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/path/to/python3/lib/python3.6/site-packages/numpy/distutils/command/build_ext.py", line 238, in run
    if fcompiler and fcompiler.get_version():
  File "/path/to/python3/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 428, in get_version
    raise CompilerNotFound()
numpy.distutils.fcompiler.CompilerNotFound
make[1]: *** [Makefile:56: ../.././/lib/rttov_gui_f2py.so] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/path/to/RTTOV-11.3/src/gui'
make: *** [Makefile:163: gui/bin] Error 2

Context for the issue:

No response

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

      0