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

Hdf5 1.14.5 #4940

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

blowekamp
Copy link
Member

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

@hjmjohnson hjmjohnson marked this pull request as draft November 8, 2024 14:17
Copy link
Member

@hjmjohnson hjmjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a WIP commit that indicates this PR is not yet ready for review, so I made it a draft.

@blowekamp blowekamp marked this pull request as ready for review November 8, 2024 14:21
Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good

@@ -64,6 +63,23 @@ set(HDF_TEST_EXPRESS OFF CACHE INTERNAL "Control testing framework (0-3)")
set(BUILD_STATIC_EXECS OFF CACHE INTERNAL "Build Static Executables")
set(BUILD_USER_DEFINED_LIBS OFF CACHE INTERNAL "Build user defined libs")

set (HDF5_DIMENSION_SCALES_NEW_REF OFF CACHE INTERNAL "Use new-style references with dimension scale APIs" )
set (HDF5_EXTERNAL_LIB_PREFIX "itk" CACHE INTERNAL "Use prefix for custom library naming.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcfr this has a potential to interact with Slicer@aacaefd and other Slicer customizations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same of them have made their way into official repo, e.g. #4102.

set( HDF5_ENABLE_MAP_API OFF CACHE INTERNAL "Build the map API")
set( HDF5_ENABLE_WARNINGS_AS_ERRORS OFF CACHE INTERNAL "Interpret some warnings as errors")
#set( HDF5_MINGW_STATIC_GCC_LIBS OFF CACHE INTERNAL "")
set( HDF5_MSVC_NAMING_CONVENTION OFF CACHE INTERNAL "Use MSVC Naming conventions for Shared Libraries")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this matter for Windows/MSVC?

@@ -1,5 +1,11 @@
cmake_minimum_required (VERSION 3.12)
project (HDF5_SRC C)
# ITK --start
set(MANGLE_PREFIX itk)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make MANGLE_PREFIX an ITK top-level option?

@blowekamp
Copy link
Member Author

The following command can be run to show the local changes in the third party library:
$ git rev-list upstream-HDF5 -n 1 83f14e7ecba1f91b4152f692f54e56306ba3e182 $git diff "upstream-HDF5" HEAD:./Modules/ThirdParty/HDF5/src/itkhdf5/

There are only a couple changes that appear to be needed locally still:
bdc5234 @hjmjohnson Did this get contributed upstream?

@blowekamp
Copy link
Member Author

The CI for the builds are passing 🎉

However ghost flow checker as a couple issues:

  • missing newline at the end of file in src/H5Odtype.c.
    • Is there a way to suppress this for this one file, or do we ignore ghost flow here?
  • hdf.icns with size 326012 bytes (318.37 KiB) which is greater than the maximum size 300000 bytes (292.97 KiB).
    • This is just an icon file, not code. It's used with CPack, may not be reachable. Maybe it should be "rm"'d in the UpdateFromUpstream script?
  • H5Ppublic.h with size 404419 bytes (394.94 KiB)
    • So this needs to be added to the .gitattributes file. Does that change need to occur before the commit where it's added?

It's going to be difficult to change the initial sub-tree commit and redo the merge. I want to make sure I have all the necessary changes done in the correct order before going through that process again.

@hjmjohnson
Copy link
Member

Ensure that #4716 modifications are also included in this PR.

@dzenanz
Copy link
Member

dzenanz commented Nov 11, 2024

It is better to make changes to .gitattributes and the update script before before running it. We don't have to fix all the ghostflow warnings.

blowekamp and others added 7 commits November 12, 2024 09:30
Code extracted from:

    https://github.com/HDFGroup/hdf5.git

at commit 106fb56936d1d785ca96147601a3608e433ddc3b (hdf5-1_12_3).
* upstream-HDF5:
  HDF5 2023-11-06 (106fb569)

Using "theirs" to resolve conflicts and prefer upstream changes over
local modifications.
Remove code modifications in library infavor of setting internal cache
variables at top level CMakeLists.txt file.

Update to set HDF5 new BUILD_STATIC_LIBS variable..

Update to set COMP_LIBS for ITK's ZLIB.

Remove local modified cmake policiy changes integrated into upstream.
Code extracted from:

    https://github.com/HDFGroup/hdf5.git

at commit 0fe0459fc24d71be13d5f266513c2832b525671b (hdf5_1.14.5).
* upstream-HDF5:
  HDF5 2024-09-30 (0fe0459f)
@blowekamp blowekamp changed the title Hdf5 1.12.3 Hdf5 1.14.5 Nov 12, 2024
@@ -2,3 +2,5 @@ src/itkhdf5/src/H5C.c hooks-max-size=500000
src/itkhdf5/src/H5Dchunk.c hooks-max-size=500000
src/itkhdf5/src/H5Shyper.c hooks-max-size=600000
src/itkhdf5/src/H5Tconv.c hooks-max-size=500000
src/itkhdf5/src/H5Ppublic.h hooks-max-size=500000
src/H5Odtype.c no-lf-at-eof
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This attribute did not work to remove the Ghostflow checker error. The error comes from the sub tree. Likely the attribute should be in the subtree not the main tree. I don't think it's worth the effort to redo the merge again to address this.

Remove unused HDF5 variables. Used the following command to help
locate CMake variable no longer used in HDF5:

for i in $(grep 'set\s*(' CMakeLists.txt | sed -n
's/set\s*(\s*\(HDF5[^ ]*\).*/\1/p'); do echo $i; git grep -c $i; done
@blowekamp blowekamp force-pushed the hdf5_1.12.3 branch 2 times, most recently from 408628d to ac0abad Compare November 13, 2024 16:34
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
#ifndef H5A_MODULE
#define H5Acreate_async(...) HD5_MANGLE_PREFIX##_H5Acreate_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thewtex @dzenanz These definitions like this are problematic for the name mangling. The current redefinitions work, but produce warnings. Each header ( 8-ish) has a "?_MODULE" conditional so that the definitional are applied externally/publicly but not applied when building the library.

My current thought is to add #undef before each of these secondary definitions. But this will be a lot of local modifications. Any other suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at HDF5 mangling in a long time. Do what you think is best.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, pre-processor updates are added to itk_hdf5_mangle.h.in and this is included first. If this approach can be adapted to apply for this issue (?), this will keep the modifications in one place outside the upstream code, which would ease maintenance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, you can not redefine a definition. It's rather unfortunate that the "internal" function name and the public CPP define are the same symbol and I can not thing of a way to name mangle it without the code modifications in the latest update.

@blowekamp blowekamp force-pushed the hdf5_1.12.3 branch 3 times, most recently from f48fc47 to 4ee1977 Compare November 14, 2024 14:35
@blowekamp blowekamp dismissed hjmjohnson’s stale review November 14, 2024 17:38

no longer WIP in commit messages.

@blowekamp
Copy link
Member Author

This PR is done as far as I am currently aware now.

@thewtex
Copy link
Member

thewtex commented Nov 15, 2024

Were the cross-platform name mangling symbol checks described in itk_hdf5_mangle.h.in run?

@blowekamp
Copy link
Member Author

Were the cross-platform name mangling symbol checks described in itk_hdf5_mangle.h.in run?

I ran the process on OSX arm and linux arm.

@thewtex
Copy link
Member

thewtex commented Nov 15, 2024

We should cover Windows amd64, Linux amd64. There are often new symbols with an update.

@hjmjohnson
Copy link
Member

@thewtex Do you have a windows box for doing the mangling?

@dzenanz
Copy link
Member

dzenanz commented Nov 15, 2024

I have a Windows computer, but I expect to be quite busy on Monday and Tuesday.

@blowekamp
Copy link
Member Author

Merging before the final symbols are updated should not cause problems with the CIs or regular builds. The only issue would be for applications used ITK master and are integrating with other untangled HDF5 libraries.

@thewtex
Copy link
Member

thewtex commented Nov 17, 2024

@thewtex Do you have a windows box for doing the mangling?

I am traveling now, but I could take a look next week.

Merging before the final symbols are updated should not cause problems with the CIs or regular builds. The only issue would be for applications used ITK master and are integrating with other untangled HDF5 libraries.

These symbols have caused crashes in Slicer, and there are likely similar applications out there. I would prefer not to merge until all the platforms have been checked.

CC @jcfr

@seanm
Copy link
Contributor

seanm commented Nov 19, 2024

Merging before the final symbols are updated should not cause problems with the CIs or regular builds. The only issue would be for applications used ITK master and are integrating with other untangled HDF5 libraries.

Some of my nightly ITK builds on cdash build against VTK too, so they might catch any duplicate symbols.

Thanks for working on this. I took a stab at a smaller update here but got stuck on various cmake stuff I did not understand.

I could clone this PR locally and try building my own app & test suite against it...

@seanm
Copy link
Contributor

seanm commented Nov 19, 2024

With ITK_USE_SYSTEM_ZLIB=ON (my typical) it fails to build with:

CMake Error at Modules/ThirdParty/HDF5/src/itkhdf5/src/CMakeLists.txt:1216 (get_target_property):
  get_target_property() called with non-existent target
  "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libz.tbd".

@seanm
Copy link
Contributor

seanm commented Nov 20, 2024

Turning ITK_USE_SYSTEM_ZLIB off, I was able to build my app! My app uses VTK & ITK and I built with ASan too. No link errors. No unit test failures.

So for me, this is in good shape, just needs a fix for ITK_USE_SYSTEM_ZLIB=ON.

@dzenanz
Copy link
Member

dzenanz commented Nov 20, 2024

I extracted symbols. I am not sure whether extraction scripts need an update - there are many symbols with extra closed parenthesis. win_hdf5_mangle.zip

Also, build in Debug mode fails - I included the build log. C:\Misc\ITK-patches2\Modules\ThirdParty\HDF5\src\itkhdf5\src\H5make_libsettings.c indeed does not exist.

@dzenanz
Copy link
Member

dzenanz commented Nov 20, 2024

Building in RelWithDebInfo mode succeeds, after which building in Debug mode also succeeds.

@dzenanz
Copy link
Member

dzenanz commented Nov 20, 2024

win_hdf5_mangle.zip I now also added the (large) intermediate outputs. Brad, can you merge it in?

@blowekamp
Copy link
Member Author

I extracted symbols. I am not sure whether extraction scripts need an update - there are many symbols with extra closed parenthesis.

It looks like there are a bunch go C++ symbols ( HD5 namespace ). The scripts may not work with those. I believe we were creating the C++ library before but not mangling the symbols. We should check if ITK is using the C++ libraries.

Also I updated the docs to indicate that the mangling should be disabled before extracting the symbols. The defines already have the "itk_" prefix on them. I think I can remove those.

Build the HDF5 libraries on OSX, and Linux ARM64, in both debug and
release mode. Then aggregated all the symbols with the exsiting ones.
The HDF5 library is adding a C-Preprocessor redefinitons pf function to
automatically add context based information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants