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

CMake: Make SourceControl a shared library #8124

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

Steelskin
Copy link
Contributor

@Steelskin Steelskin commented Nov 19, 2024

Motivation:

The current CMake build results in duplicate definitions across the resulting shared libraries, resulting in warnings on macOS at runtime.

Modifications:

  • Make SourceControl a shared library. The library is shared across multiple other libraries (Commands, PackageGraph and PackageLoading), resulting in duplicate definitions in shared libraries.

Result:

No more warning at runtime with a macOS build.

* Make `SourceControl` a shared library. The library is shared across
  multiple other libraries (`Commands`, `PackageGraph` and
  `PackageLoading`), resulting in duplicate definitions in shared
  libraries.
* Set rpath for macOS binaries, resulting in binaries ready to be used
  post-installation.
Copy link
Contributor

@jakepetroules jakepetroules left a comment

Choose a reason for hiding this comment

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

Nice, this should help reduce toolchain size. Have you tested across all platforms? My CMake is a pretty rusty but overall looks reasonable to me.

@plemarquand
Copy link
Contributor

@swift-ci test

@Steelskin
Copy link
Contributor Author

I do not know if I have the right permissions to restart testing, but I believe the failure is a flake:

Test Suite 'All tests' passed at 2024-11-19 04:34:44.420
	 Executed 671 tests, with 24 tests skipped and 0 failures (0 unexpected) in 514.871 (514.871) seconds

@Steelskin
Copy link
Contributor Author

Nice, this should help reduce toolchain size. Have you tested across all platforms? My CMake is a pretty rusty but overall looks reasonable to me.

I only tested on macOS, but, outside of the SourceControl changes - which fix an existing issue with the shared library build - the rest should only take effect on macOS.

@Steelskin Steelskin changed the title [cmake] Set up rpath for macOS binaries [cmake] Make SourceControl a shared library Nov 20, 2024
@Steelskin
Copy link
Contributor Author

I removed the rpath changes and refocused this change to be about the duplicate definitions across libraries. I am going to be doing other changes to dependent libraries to change the installation folder for shared libraries and I will submit another PR once the dependent libraries have been updated.
See this comment for details.

@MaxDesiatov
Copy link
Contributor

@swift-ci test

@MaxDesiatov
Copy link
Contributor

@swift-ci test windows

@MaxDesiatov MaxDesiatov changed the title [cmake] Make SourceControl a shared library CMake: Make SourceControl a shared library Dec 9, 2024
@MaxDesiatov MaxDesiatov changed the title CMake: Make SourceControl a shared library CMake: Make SourceControl a shared library Dec 9, 2024
@MaxDesiatov MaxDesiatov added bug cmake Changes related to CMake configuration labels Dec 9, 2024
@MaxDesiatov MaxDesiatov requested a review from compnerd December 9, 2024 14:35
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

Please prepare the associated change for swift-installer-script and do a cross-repository test with a Windows toolchain build for this change as this will otherwise break the toolchain distribution on Windows.

Steelskin added a commit to Steelskin/swift-installer-scripts that referenced this pull request Dec 12, 2024
`SourceControl` has been made a shared library in
swiftlang/swift-package-manager#8124.
@Steelskin
Copy link
Contributor Author

Please prepare the associated change for swift-installer-script and do a cross-repository test with a Windows toolchain build for this change as this will otherwise break the toolchain distribution on Windows.

Here is the corresponding PR: swiftlang/swift-installer-scripts#354
I don't know how these cross-repo dependencies work.

@compnerd
Copy link
Member

Please test with following PRs:
swiftlang/swift-installer-scripts#354

@swift-ci please build toolchain Windows platform

@compnerd
Copy link
Member

Kicked off a test at swiftlang/swift#65907

@compnerd compnerd merged commit 2a89813 into swiftlang:main Dec 13, 2024
5 checks passed
bnbarham pushed a commit to bnbarham/swift-installer-scripts that referenced this pull request Jan 4, 2025
`SourceControl` has been made a shared library in
swiftlang/swift-package-manager#8124.

(cherry picked from commit 345b660)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cmake Changes related to CMake configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants