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

Add Windows SHLWAPI lib to public interface #4701

Merged
merged 5 commits into from
Aug 8, 2024

Conversation

byrnHDF
Copy link
Contributor

@byrnHDF byrnHDF commented Aug 7, 2024

This addresses the missing dependency for Windows of the shlwapi library, this will close #3663

@byrnHDF byrnHDF added Merge - To 1.14 This needs to be merged to HDF5 1.14 Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Component - C Library Core C library issues (usually in the src directory) Component - Build CMake, Autotools Type - Bug Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub labels Aug 7, 2024
@byrnHDF byrnHDF self-assigned this Aug 7, 2024
@jhendersonHDF
Copy link
Collaborator

I'd definitely still like to know if we're doing something wrong since I don't understand the reason why this needs to be in the public link interface. I'm guessing that it has to do with functions which are meant to be library-private not having restricted visibility so they're in the link interface for anything which links to HDF5.

@lrknox
Copy link
Collaborator

lrknox commented Aug 7, 2024

This addresses the missing dependency for Windows of the shlwapi library, this will close #3663

I believe it will close #3663 automatically if the description includes "Fixes #3663". Otherwise it may need to be closed manually.

@byrnHDF
Copy link
Contributor Author

byrnHDF commented Aug 7, 2024

I'd definitely still like to know if we're doing something wrong since I don't understand the reason why this needs to be in the public link interface. I'm guessing that it has to do with functions which are meant to be library-private not having restricted visibility so they're in the link interface for anything which links to HDF5.

see https://stackoverflow.com/questions/26037954/cmake-target-link-libraries-interface-dependencies

@jhendersonHDF
Copy link
Collaborator

I'd definitely still like to know if we're doing something wrong since I don't understand the reason why this needs to be in the public link interface. I'm guessing that it has to do with functions which are meant to be library-private not having restricted visibility so they're in the link interface for anything which links to HDF5.

see https://stackoverflow.com/questions/26037954/cmake-target-link-libraries-interface-dependencies

That just seems to reinforce the idea that this shouldn't be a public link because there's no reason the functions that use the SHLWAPI lib should be in the public link interface. The library was linked against due to use of StrStrIA, but this is used in a function that isn't meant to be used publicly. It's in H5private.h through H5system.c and is meant for internal library use. But since we don't restrict the visibility of library-wide private functions, I'm guessing it ends up in the link interface unintentionally.

@brtnfld
Copy link
Contributor

brtnfld commented Aug 7, 2024

If we want a definitive answer, we should ask on CMake's discourse https://discourse.cmake.org/

@byrnHDF
Copy link
Contributor Author

byrnHDF commented Aug 7, 2024

I could make it an INTERFACE instead of PUBLIC.

@jhendersonHDF
Copy link
Collaborator

jhendersonHDF commented Aug 7, 2024

I could make it an INTERFACE instead of PUBLIC.

We need to link against the shlwapi lib anyway, so I don't think INTERFACE is correct since "Libraries following INTERFACE are appended to the link interface and are not used for linking <target>."

@jhendersonHDF
Copy link
Collaborator

This will likely have to remain a PUBLIC link for now since it would take some time to figure out why shlwapi is a transitive dependency currently and some work to resolve. However, I'm not convinced that PUBLIC is ultimately correct and can't see how shlwapi is anything but a private dependency.

@jhendersonHDF
Copy link
Collaborator

This addresses the missing dependency for Windows of the shlwapi library, this will close #3663

I believe it will close #3663 automatically if the description includes "Fixes #3663". Otherwise it may need to be closed manually.

You can see the GitHub issue linked on the right side under the "Development" section. Here's the list of GitHub keywords in a description that will automatically link an issue: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

@byrnHDF
Copy link
Contributor Author

byrnHDF commented Aug 7, 2024

INTERFACE didn't work - reverting back to PUBLIC

@@ -1099,7 +1099,7 @@ if (BUILD_STATIC_LIBS)
TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_LIB_TARGET}
PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}
PUBLIC "$<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>" "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>"
PUBLIC "$<$<PLATFORM_ID:Windows>:${SHLWAPI_LIB}>" "$<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>" "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we have a LINK_LIBS-style variable for public libs, just so we don't have to introduce unnecessary extra variables like SHLWAPI_LIB above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like a good idea

Copy link
Collaborator

@jhendersonHDF jhendersonHDF left a comment

Choose a reason for hiding this comment

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

Approving, though I hope two things come after at some point in the future:

  • We should figure out why this dependency had to be made public since the library is really only used by library-internal functions and not exposed publicly in any way (at least not intentionally)
  • Would be nice to have a public LINK_LIBS style variable for public libraries, but that should probably come in a separate PR

@byrnHDF
Copy link
Contributor Author

byrnHDF commented Aug 8, 2024

  • Would be nice to have a public LINK_LIBS style variable for public libraries, but that should probably come in a separate PR
    I'll do it in this PR.
    I'll leave it dependent on Windows since it seems to be the one platform that is affected.

@lrknox lrknox merged commit 46a3a20 into HDFGroup:develop Aug 8, 2024
55 checks passed
@byrnHDF byrnHDF deleted the develop-win-shlwapi branch August 13, 2024 12:29
lrknox pushed a commit to lrknox/hdf5 that referenced this pull request Aug 21, 2024
lrknox added a commit that referenced this pull request Aug 22, 2024
* Warning fix (#4682)

* warning fix

* warning fix

* CMake link line needs to use new HDF5_ENABLE_THREADS (#4685)

* Correct the properties for using THREADS library (#4690)

* Bump the github-actions group with 5 updates (#4688)

Bumps the github-actions group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `4.1.7` | `4.1.8` |
| [DoozyX/clang-format-lint-action](https://github.com/doozyx/clang-format-lint-action) | `0.13` | `0.17` |
| [softprops/action-gh-release](https://github.com/softprops/action-gh-release) | `2.0.6` | `2.0.8` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.3.3` | `2.4.0` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.25.11` | `3.25.15` |


Updates `actions/download-artifact` from 4.1.7 to 4.1.8
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@65a9edc...fa0a91b)

Updates `DoozyX/clang-format-lint-action` from 0.13 to 0.17
- [Release notes](https://github.com/doozyx/clang-format-lint-action/releases)
- [Commits](DoozyX/clang-format-lint-action@v0.13...v0.17)

Updates `softprops/action-gh-release` from 2.0.6 to 2.0.8
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](softprops/action-gh-release@a74c6b7...c062e08)

Updates `ossf/scorecard-action` from 2.3.3 to 2.4.0
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](ossf/scorecard-action@dc50aa9...62b2cac)

Updates `github/codeql-action` from 3.25.11 to 3.25.15
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@b611370...afb54ba)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: DoozyX/clang-format-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

* Fix segfault when closing datatype during failure in H5Topen2 (#4683)

* Rework Dynamic Analysis and sanitize testing (#4681)

* Ignore predetermined failing test and check pointer before use

* Rework Analysis process

* Remove another H5E_BEGIN/END_TRY within the library (#4675)

* Update logic for (deprecated) H5Gget_objinfo() call to eliminate H5E_BEGIN_TRY

* Handle case for '.' at the end of a path

* Drop H5E_BEGIN/END_TRY and just check the error return from H5I_clear_types() (#4694)

Original case that the change in commit 2dc738a
no longer applies.

* Add check of returned value from API calls. (#4702)

These were found while investigating GH-4672, but they were not related
to GH-4672.

* Add mac dmg binary and remove old macos-13 workflows (#4699)

* Add Windows SHLWAPI lib to public interface (#4701)

* Use local variable in btree2 and print value (#4679)

* Correct logic

* Technically, level 1 Express could skip tests

* Add windows signing (#4703)

* Add tests for H5R get name APIs (#4657)

Added functionality tests for the following APIs:
H5Rget_file_name
H5Rget_obj_name
H5Rget_attr_name

Also removed "+1" when returning a name length in H5R__get_attr_name().
The exter "+1" gave an incorrect value for the length of the referenced
object's attribute name.

Fixed GH-4447

* Fix Fortran test

The C API H5Rget_attr_name incorrectly added 1 to the length of the
referenced object's attribute name, so the Fortran API h5rget_attr_name_f
removed 1 from the returned value to accommodate the incorrectness.
This PR fixes H5Rget_attr_name so this workaround in h5rget_attr_name_f
is no longer needed.

* Add test H5Aget_name against H5Rget_attr_name

* Replace Visual Studio ???? with 2022 in MSI README file (#4709)

* Change logic for checking secrets exists (#4711)

* Change osx refs to macos (#4707)

* Replace alias \Code with \TText (#4714)

Fixed GH-2151

* Correct signing names and variables (#4713)

* Add secrets to release workflow (#4719)

* Add missing blosc2 info (#4717)

* Fix error return types in H5Rdeprec.c (#4722)

Copy-pasted code from elsewhere used FAIL instead of H5G_UNKNOWN
and H5I_INVALID_HID.

* Fix the release reference name (#4721)

* Test creating unseekable file (#4720)

* Cleanup up tests (#4724)

* Add arch name to dmg file name (#4732)

The binaries in snapshot dmg file do not work on x86_64.

* Fix snapshot CI failure by adding arch name to dmg file (#4734)

See also #4732.

* Fix incorrect VOL vs. non-VOL calls partially (#4733)

* Fix incorrect VOL vs. non-VOL calls

H5Lget_info2() called H5I_object() instead of H5VL_vol_object() crashed
user application.
This is a wide-spread issue (GH-4730) but this PR only addresses GH-4705.

* Remove an incorrect change

* Fix segfault in ROS3 credential parsing (#4736)

* Fix segfault in s3 credential parsing

* Fix AWS cred parsing when >1 profile provided

* Revert gh-pages action hash to fix daily build (#4735)

* Revert gh-pages action hash to fix daily build

See also #4734

* Revert gh-pages action hash to fix daily build

* Eliminate another use of H5E_clear_stack() within the library (#4726)

* Remove call to H5E_clear_stack()

Also clean up a bunch of error macros and the return value from H5B_valid()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Build CMake, Autotools Component - C Library Core C library issues (usually in the src directory) Merge - To 1.14 This needs to be merged to HDF5 1.14 Priority - 0. Blocker ⛔ This MUST be merged for the release to happen Type - Bug Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub
Projects
Status: Needs Merged
Development

Successfully merging this pull request may close these issues.

The cmake configuration should provide transitive dependencies (like shlwapi on MSVC)
4 participants