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

Unable to build 1.12.1 when already installed (Error: Symbol ‘h5i_invalid_hid_f’ at (1) has no IMPLICIT type) #1027

Closed
thesamesam opened this issue Sep 19, 2021 · 3 comments
Assignees
Labels
Component - Fortran Fortran wrappers Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub

Comments

@thesamesam
Copy link

thesamesam commented Sep 19, 2021

Hi!

This is a forward of a downstream report of a bug in Gentoo.

When hdf5 1.10.5 is already installed, one gets when building 1.12.1 with fortran support like:

FAILED: fortran/src/CMakeFiles/hdf5_fortran-static.dir/H5Lff.F90.o bin/static/h5l.mod 
/usr/bin/x86_64-pc-linux-gnu-gfortran -I/var/tmp/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1/fortr
an/src -I/usr/include -I/var/tmp/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1/fortran/src -I/var/tm
p/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1_build/bin/static -I/var/tmp/portage/sci-libs/hdf5-1.
12.1/work/hdf5-1.12.1_build/fortran -I/var/tmp/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1_build/f
ortran/src -I/var/tmp/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1_build/src -I/var/tmp/portage/sci
-libs/hdf5-1.12.1/work/hdf5-1.12.1/src -O2 -march=native -pipe -O2 -march=native -pipe -fdiagnostics
-urls=never -fno-diagnostics-color -Jbin/static -fPIC -Waliasing -Wall -Wcharacter-truncation -Wextr
a -Wimplicit-interface -Wsurprising -Wunderflow -pedantic -ffree-form -fimplicit-none -std=f2008 -Wa
rray-temporaries -Wintrinsics-std -Wimplicit-procedure -Wreal-q-constant -Wfunction-elimination -Wre
alloc-lhs -Wrealloc-lhs-all -Wno-c-binding-type -fpreprocessed -o fortran/src/CMakeFiles/hdf5_fortra
n-static.dir/H5Lff.F90.o -c fortran/src/CMakeFiles/hdf5_fortran-static.dir/H5Lff.F90-pp.f90
/var/tmp/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1/fortran/src/H5Lff.F90:49:28:
   49 |      TYPE(H5O_TOKEN_T_F) :: token
      |                            1
Error: Derived type at (1) has not been previously defined and so cannot appear in a derived type definition
/var/tmp/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1/fortran/src/H5Lff.F90:644:24:
  644 |     TYPE(H5O_TOKEN_T_F), INTENT(OUT), TARGET :: token ! If the link is a hard link, token specifies the object token that the link points to
      |                        1
Error: Derived type ‘h5o_token_t_f’ at (1) is being used before it is defined
/var/tmp/portage/sci-libs/hdf5-1.12.1/work/hdf5-1.12.1/fortran/src/H5Lff.F90:660:47:
[...]

The same exact build configuration works if hdf5 is uninstalled from the system first.

One of the commenters on the bug in gentoo noticed that the include order may be wrong:

Thus, according to comment #13 and comment #14, h5global.mod from system takes the precedence over the new one; looking at the generated build.ninja, is it possible that -I/usr/include appears too early in the relative INCLUDES?

@brtnfld
Copy link
Contributor

brtnfld commented Oct 11, 2021

Does setting CMAKE_INCLUDE_DIRECTORIES_BEFORE help?

@thesamesam
Copy link
Author

thesamesam commented Oct 12, 2021

Thanks for the tip!

It looks like CMAKE_INCLUDE_DIRECTORIES_BEFORE doesn't help, but I looked it up and I found CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE which does.

With CMAKE_INCLUDE_DIRECTORIES_BEFORE (doesn't work; you can see it's kind of there but it's still injecting /usr/include too early):

[946/993] /usr/bin/x86_64-pc-linux-gnu-gfortran -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1/fortran/src -I/usr/include -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1/fortran/src -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/bin/shared -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/fortran -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/fortran/src -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/src -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1/src -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches   -ggdb3 -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches     -ggdb3 -fdiagnostics-urls=never -fno-diagnostics-color -Jbin/shared -fPIC -Waliasing -Wall -Wcharacter-truncation -Wextra -Wimplicit-interface -Wsurprising -Wunderflow -pedantic -ffree-form -fimplicit-none -std=f2008 -Warray-temporaries -Wintrinsics-std -Wimplicit-procedure -Wreal-q-constant -Wfunction-elimination -Wrealloc-lhs -Wrealloc-lhs-all -Wno-c-binding-type -fpreprocessed -o fortran/src/CMakeFiles/hdf5_fortran-shared.dir/H5fortkit.F90.o -c fortran/src/CMakeFiles/hdf5_fortran-shared.dir/H5fortkit.F90-pp.f90

And with CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE (works):

[946/993] /usr/bin/x86_64-pc-linux-gnu-gfortran -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1/fortran/src -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1/fortran/src -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/bin/shared -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/fortran -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/fortran/src -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1_build/src -I/tmp/portage/sci-libs/hdf5-1.12.1-r1/work/hdf5-1.12.1/src -I/usr/include -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches   -ggdb3 -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches     -ggdb3 -fdiagnostics-urls=never -fno-diagnostics-color -Jbin/shared -fPIC -Waliasing -Wall -Wcharacter-truncation -Wextra -Wimplicit-interface -Wsurprising -Wunderflow -pedantic -ffree-form -fimplicit-none -std=f2008 -Warray-temporaries -Wintrinsics-std -Wimplicit-procedure -Wreal-q-constant -Wfunction-elimination -Wrealloc-lhs -Wrealloc-lhs-all -Wno-c-binding-type -fpreprocessed -o fortran/src/CMakeFiles/hdf5_fortran-shared.dir/H5fortkit.F90.o -c fortran/src/CMakeFiles/hdf5_fortran-shared.dir/H5fortkit.F90-pp.f90

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Oct 12, 2021
Thanks to upstream for the helpful suggestion!

Bug: HDFGroup/hdf5#1027
Closes: https://bugs.gentoo.org/808633
Signed-off-by: Sam James <[email protected]>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue May 31, 2022
An attempt to build hdf5-1.12.2-r1 with USE='fortran' on a system where
an older version of the package has already been installed will fail due
to system headers taking precedence over the ones present in the source
directory.

This exact issue (#808633) has already been fixed in 225b7ee for 1.12.1,
though the workaround somehow hadn't made it into the new ebuild. This
commit brings it in.

Bug: HDFGroup/hdf5#1027
Closes: https://bugs.gentoo.org/808633
Signed-off-by: Roman Beranek <[email protected]>
Closes: #25712
Signed-off-by: Sam James <[email protected]>
@derobins derobins added Priority - 1. High 🔼 These are important issues that should be resolved in the next release Component - Fortran Fortran wrappers Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub labels May 3, 2023
@derobins derobins assigned brtnfld and unassigned glennsong09 Oct 9, 2023
@brtnfld
Copy link
Contributor

brtnfld commented Apr 4, 2024

Everything related to this issue has been resolved, so I will close it. Thanks for your help!

@brtnfld brtnfld closed this as completed Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Fortran Fortran wrappers Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug / Bugfix Please report security issues to [email protected] instead of creating an issue on GitHub
Projects
None yet
Development

No branches or pull requests

4 participants