Skip to content

Disable the shorten-64-to-32 warning in Package.swift #14

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

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Feb 18, 2025

Without this flag, we get about 40 warnings when building swift-lmdb in Xcode. I don’t think there is an immediate plan to address them in upstream lmdb, so let’s disable them.

Without this flag, we get about 40 warnings when building `swift-lmdb` in Xcode. I don’t think there is an immediate plan to address them in upstream lmdb, so let’s disable them.
@@ -26,6 +26,7 @@ let package = Package(
// Windows does not use POSIX mutex
.when(platforms: [.linux, .macOS])),
.define("MDB_USE_ROBUST", to: "0"),
.unsafeFlags(["-Wno-shorten-64-to-32"])

Choose a reason for hiding this comment

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

If I understand the unsafeFlags(_:_:) documentation correctly, this change would prevent other packages from using the CLMDB library product:

As some build flags can be exploited for unsupported or malicious behavior, the use of unsafe flags makes the products containing this target ineligible for use by other packages.

Copy link

@d-ronnqvist d-ronnqvist left a comment

Choose a reason for hiding this comment

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

IIUC this will prevent other packages from using the only product in this package.

Please verify that other packages can still use the CLMDB library product with this change.

@ahoppen
Copy link
Member Author

ahoppen commented Feb 19, 2025

People won’t be able to depend on swift-lmdb with a version-based dependency but swift-lmdb doesn’t have any versioned releases, so this should be fine. Toolchain builds passed in swiftlang/swift#37710 and I am able to have a branch-based dependency on swift-lmdb with this change.

Copy link

@d-ronnqvist d-ronnqvist left a comment

Choose a reason for hiding this comment

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

Thanks for verifying that other packages can continue to use the CLMDB library product with this change. That addresses my concerns.

@ahoppen ahoppen merged commit 1ad9a2d into swiftlang:main Feb 26, 2025
@vsarunas
Copy link

This is actually very confusing actually. LMDB does have versioning, but Github copy is only a a mirror and those tags are lagging behind the self hosted Gitlab where development is being done: https://git.openldap.org/openldap/openldap/-/tags?sort=updated_desc&search=lmdb_ , which also has CHANGES.

The Swift package doesn't have versioning which follows LMDB, but only follows Swift toolchain versioning.

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.

3 participants