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

Suppress redundant linkage warnings due to dependency linkage propagation #7404

Merged
merged 16 commits into from Mar 19, 2024

Conversation

pusukuri
Copy link
Contributor

Suppress redundant linkage warnings due to dependency linkage propagation rdar://112671586

Motivation:

Improve user experience by suppressing redundant linkage warnings

Modifications:

Pass "-no_warn_duplicate_libraries" to linker.

Result:

We should not see warnings such as "ld: warning: ignoring duplicate libraries: '-lsqlite3'"

@pusukuri
Copy link
Contributor Author

@swift-ci test

@pusukuri
Copy link
Contributor Author

@swift-ci test macos

@pusukuri pusukuri added the build system Changes to interactions with build systems label Mar 15, 2024
@@ -672,6 +672,11 @@ final class PackagePIFProjectBuilder: PIFProjectBuilder {
impartedSettings[.OTHER_LDFLAGS, default: ["$(inherited)"]].append("-lc++")
}

// radar://112671586 supress unnecessary warnings
#if os(macOS)
Copy link
Member

Choose a reason for hiding this comment

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

I think the #if is redundant here because this is essentially dead code on non-macOS today.

@@ -25,7 +25,7 @@ final class BuildSystemDelegateTests: XCTestCase {
try XCTSkipIf(true, "test is only supported on macOS")
#endif
let (fullLog, _) = try executeSwiftBuild(fixturePath)
XCTAssertTrue(fullLog.contains("ld: warning: ignoring duplicate libraries: '-lz'"), "log didn't contain expected linker diagnostics")
XCTAssertFalse(fullLog.contains("ld: warning: ignoring duplicate libraries: '-lz'"), "log contains unnecessary linker warnings")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's correct to change this test, it was supposed to ensure that linker warnings are properly propagated. We'll need to find a different linker warning that we can check for here or remove the test if appropriate.

Copy link
Contributor Author

@pusukuri pusukuri Mar 15, 2024

Choose a reason for hiding this comment

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

Thank you @neonichu I will talk with @MaxDesiatov and finalize it.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Boris, with this PR as it is we're losing test coverage here. This test needs to change to check for a different warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked with @MaxDesiatov and made changes appropriately for the above test case.

@pusukuri
Copy link
Contributor Author

@swift-ci test

@pusukuri
Copy link
Contributor Author

@swift-ci test macos

@MaxDesiatov
Copy link
Member

@swift-ci test

@MaxDesiatov
Copy link
Member

@swift-ci test windows

Copy link
Contributor Author

@pusukuri pusukuri left a comment

Choose a reason for hiding this comment

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

Sure.

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) March 19, 2024 17:10
@MaxDesiatov MaxDesiatov self-assigned this Mar 19, 2024
@pusukuri
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov MaxDesiatov merged commit e73cb5b into apple:main Mar 19, 2024
5 checks passed
pusukuri added a commit that referenced this pull request Mar 20, 2024
…tion (#7404)

Suppress redundant linkage warnings due to dependency linkage
propagation rdar://112671586

### Motivation:

Improve user experience by suppressing  redundant linkage warnings

### Modifications:

Pass "-no_warn_duplicate_libraries" to linker.

### Result:

We should not see warnings such as "ld: warning: ignoring duplicate
libraries: '-lsqlite3'"

---------

Co-authored-by: Max Desiatov <[email protected]>
(cherry picked from commit e73cb5b)
pusukuri added a commit that referenced this pull request Mar 22, 2024
**Explanation**: Improve user experience by suppressing redundant
linkage warnings due to dependency linkage propagation
**Scope**: We should not see warnings such as "ld: warning: ignoring
duplicate libraries: '-lsqlite3'"
**Risk**: No risks
**Testing**: Tests continue passing. 
**Issue**: rdar://112671586
**Reviewer**: @MaxDesiatov and @neonichu 
**Co-authored-by**: Max Desiatov <[email protected]>
(cherry picked from commit e73cb5b)

Original PR #7404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system Changes to interactions with build systems diagnostics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants