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

generator/linux: Use --ldpath linker flag for 5.9 #151

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

euanh
Copy link
Contributor

@euanh euanh commented Nov 18, 2024

Swift Package Manager's linker flag handling changed between 5.9 and 5.10. The flags which work for 5.9 cause linking failures 5.10 and later, and vice versa:

swiftlang/swift-package-manager#7222

This commit generates workaround flags for 5.9 and new-style flags for all other versions.

The EndToEnd tests currently cannot run in CI, so this change was tested locally. (Issue #145)

  • The basic 'hello world' example generated by swift package init built successfully with 5.9.2, 5.10.1 and 6.0.2 SDKs on x86_64 and aarch64.
  • A more complex example using Vapor built succesfully with 5.9.2, 5.10.1. 6.0.2 failed because of the CShims problem reported in Issue Creating an AmazonLinux2 Swift SDK fails #138.

@euanh euanh requested a review from MaxDesiatov as a code owner November 18, 2024 10:04
@euanh
Copy link
Contributor Author

euanh commented Nov 18, 2024

@swift-ci test

"-Xlinker",
"-R/usr/lib/swift/linux/",
])
var swiftCompilerOptions = ["-Xlinker", "-R/usr/lib/swift/linux/"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think -Xlinker -R/usr/lib/swift/linux/ may not be necessary any more, but want to do more testing before removing it.

Swift Package Manager's linker flag handling changed between
5.9 and 5.10.   The flags which work for 5.9 cause linking failures
5.10 and later, and vice versa:

  swiftlang/swift-package-manager#7222

This commit generates workaround flags for 5.9 and new-style flags
for all other versions.

The EndToEnd tests currently cannot run in CI, so this change was
tested locally. (Issue swiftlang#145)

* The basic 'hello world' example generated by `swift package init`
  built successfully with 5.9.2, 5.10.1 and 6.0.2 SDKs on x86_64 and aarch64.
* A more complex example using Vapor built succesfully with 5.9.2, 5.10.1.  6.0.2
  failed because of the CShims problem reported in Issue swiftlang#138.
@euanh euanh force-pushed the fix-59-linker-flags branch from 6da0f0c to a08cf08 Compare November 18, 2024 10:11
@euanh
Copy link
Contributor Author

euanh commented Nov 18, 2024

@swift-ci test

@euanh euanh merged commit f6da543 into swiftlang:main Nov 18, 2024
3 checks passed
@euanh euanh deleted the fix-59-linker-flags branch November 18, 2024 16:10
@euanh euanh added bug Something isn't working enhancement New feature or request labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants