fpm icon indicating copy to clipboard operation
fpm copied to clipboard

fails with non-standard Fortran usage using ifx(1) compiler

Open lockstockandbarrel opened this issue 1 year ago • 7 comments

Description

fpm install --profile debug --compiler ifx --c-compiler gcc|tee bug.txt

   <ERROR> Compilation failed for object " src_fpm_settings.f90.o "
   <ERROR> stopping due to failed compilation
   STOP 1
   
   /dev/shm/ifx1425271755ljyzYS/ifxxPqn5R.i90: error #6405: 
   The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
   /dev/shm/ifx1425271755ljyzYS/ifxxPqn5R.i90(246): catastrophic error: Too many errors, exiting
   compilation aborted for ././src/fpm_settings.f90 (code 1)

ifx --version

 ifx (IFX) 2023.2.0 20230721
 Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

Expected Behaviour

lgo

Version of fpm

0.10.1

Platform and Architecture

Linux

Additional Information

No response

lockstockandbarrel avatar Mar 30 '24 21:03 lockstockandbarrel

Just bumped into the same error. My setup:

  • MacOS Sonoma 14.6.1
  • Compiler: ifort (IFORT) 2021.9.0 20230302
  • fpm: Version: 0.8.1, alpha

The errors at time of failure:

toml.f90                               done.
git.f90                                failed.
fpm_settings.f90                       failed.
meta.f90                               failed.
build.f90                              failed.
library.f90                            failed.
preprocess.f90                         failed.
profiles.f90                           failed.
install.f90                            failed.
fortran.f90                            failed.
[ 77%] Compiling...
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortky7ctR.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortky7ctR.i90(246): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm_settings.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortuJPoSH.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortuJPoSH.i90(457): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/git.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortELuwDq.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortELuwDq.i90(1241): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/manifest/profiles.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortlRKlY6.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortlRKlY6.i90(171): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/manifest/install.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortk6TahD.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortk6TahD.i90(344): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/manifest/preprocess.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifort7oIo0c.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifort7oIo0c.i90(329): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/manifest/build.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortle97Ld.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortle97Ld.i90(216): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/manifest/library.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortuHB78U.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortuHB78U.i90(229): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/manifest/meta.f90 (code 1)
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortSFVWWS.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortSFVWWS.i90(180): catastrophic error: Too many errors, exiting
compilation aborted for build/dependencies/fpm/src/fpm/manifest/fortran.f90 (code 1)
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_settings.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_git.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_manifest_profiles.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_manifest_install.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_manifest_preprocess.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_manifest_build.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_manifest_library.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_manifest_meta.f90.o "
<ERROR> Compilation failed for object " build_dependencies_fpm_src_fpm_manifest_fortran.f90.o "
<ERROR>stopping due to failed compilation
STOP 1

ivan-pi avatar Sep 21 '24 22:09 ivan-pi

I get the same error trying to build fpm from a clean copy of the repo:

~/fortran$ git clone https://github.com/fortran-lang/fpm fpm-debug
Cloning into 'fpm-debug'...
remote: Enumerating objects: 90040, done.
remote: Counting objects: 100% (16834/16834), done.
remote: Compressing objects: 100% (985/985), done.
remote: Total 90040 (delta 15982), reused 16457 (delta 15799), pack-reused 73206 (from 1)
Receiving objects: 100% (90040/90040), 41.71 MiB | 1.85 MiB/s, done.
Resolving deltas: 100% (83015/83015), done.
~/fortran$ cd fpm-debug/
~/fortran/fpm-debug$ echo $FPM_FC 
ifort
~/fortran/fpm-debug$ fpm build
...
toml.f90                               done.
fpm_settings.f90                       failed.
profiles.f90                           failed.
library.f90                            failed.
build.f90                              failed.
install.f90                            failed.
fortran.f90                            failed.
meta.f90                               failed.
preprocess.f90                         failed.
git.f90                                failed.
[ 74%] Compiling...
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortJH70HR.i90: error #6405: The same named entity from different modules and/or program units cannot be referenced.   [TOML_TABLE]
/var/folders/5h/txm_8yhd2n721_w7gsrvlkj8p3bpj9/T/ifortJH70HR.i90(246): catastrophic error: Too many errors, exiting
compilation aborted for ././src/fpm_settings.f90 (code 1)

ivan-pi avatar Sep 21 '24 22:09 ivan-pi

It looks like this is connected to previous issues:

  • https://github.com/fortran-lang/fpm/issues/324
  • https://github.com/fortran-lang/fpm/issues/520

As @urbanjost suggested there, importing toml_table directly from tomlf makes the issue dissappear:

! BEFORE
  use fpm_toml, only : toml_table, toml_key, toml_stat, get_value, set_value, serializable_t

! FIXED
  use tomlf, only: toml_table
  use fpm_toml, only: toml_key, toml_stat, get_value, set_value, serializable_t

Was there ever a better explanation of why ifort can't re-export the toml_table type?

Could it be that one of the generic procedures added in fpm/src/fpm/toml.f90 (module fpm_toml)

https://github.com/fortran-lang/fpm/blob/da6d1bf89a241cd87d640b889ab1e570e8be5f35/src/fpm/toml.f90#L59-L81

has an equal interface to one of the existing procedures add_table, set_value, get_value procedures, that are part of the original toml-f library?

Edit: Nvm, I think that cannot be the case, because the procedures in fpm_toml have an additional error_t dummy argument, so their interfaces should be distinguishable. Also the compiler error in this case would be this one:

/app/example.f90(34): error #5286: Ambiguous generic interface BAR: previously declared specific procedure A::FOOBAR is not distinguishable from this declaration. [BFOOBAR] subroutine bfoobar(f)

ivan-pi avatar Sep 21 '24 23:09 ivan-pi

I am surprised that this issue is limited to reexporting the table type and does not affect for example the key type, notably the tomlf module already provides a reexported table type. Overall this looks like a bug in the Intel compiler, so maybe worth reporting in the Intel community forum.

awvwgk avatar Sep 22 '24 14:09 awvwgk

Intel deprecated ifort meaning that Mac users with Intel processors are stuck with the old versions of ifort. I will check if the bug disappears with a 2024 version of ifx on my Ubuntu machine.

I managed to get a working build with use tomlf, only: toml_table everywhere it was needed (between 10-15 places in the fpm source).

ivan-pi avatar Sep 22 '24 15:09 ivan-pi

This issue has been discussed several times, and Intel has reported to be working on a fix:

https://fortran-lang.discourse.group/t/the-same-named-entity-from-different-modules-and-or-program-units-cannot-be-referenced-bug/7387

perazz avatar Sep 22 '24 15:09 perazz

Thanks for pointing the thread out. Even if Intel provides a fix for ifx, it won't help me because of the Deprecation of Intel Fortran Compiler Classic on MacOS. It's a pity because this also means fpm can't be used as a dependency:

[dependencies]
fpm.git = "https://github.com/fortran-lang/fpm"

ivan-pi avatar Sep 22 '24 15:09 ivan-pi