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

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

Open
lockstockandbarrel opened this issue Mar 30, 2024 · 7 comments
Open
Labels
bug Something isn't working

Comments

@lockstockandbarrel
Copy link

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 lockstockandbarrel added the bug Something isn't working label Mar 30, 2024
@ivan-pi
Copy link
Member

ivan-pi commented Sep 21, 2024

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
Copy link
Member

ivan-pi commented Sep 21, 2024

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
Copy link
Member

ivan-pi commented Sep 21, 2024

It looks like this is connected to previous issues:

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)

fpm/src/fpm/toml.f90

Lines 59 to 81 in da6d1bf

!> add_table: fpm interface
interface add_table
module procedure add_table_fpm
end interface add_table
!> set_value: fpm interface
interface set_value
module procedure set_logical
module procedure set_integer
module procedure set_integer_64
end interface set_value
interface set_string
module procedure set_character
module procedure set_string_type
end interface set_string
!> get_value: fpm interface
interface get_value
module procedure get_logical
module procedure get_integer
module procedure get_integer_64
end interface get_value

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)

@awvwgk
Copy link
Member

awvwgk commented Sep 22, 2024

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.

@ivan-pi
Copy link
Member

ivan-pi commented Sep 22, 2024

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).

@perazz
Copy link
Contributor

perazz commented Sep 22, 2024

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

@ivan-pi
Copy link
Member

ivan-pi commented Sep 22, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants