Skip to content

Conversation

@daveinglis
Copy link
Contributor

@daveinglis daveinglis commented Nov 4, 2025

  • remove the platform specifics from computeLibraryArgs (we cannot assume
    that all libraries have a lib prefix and what there suffix is.) So we
    now use the FileType prefix and remove any suffix when using
    searchPathFlagsForLD, moving this into the LinkerSpec.LibrarySpecifier
    extension, this allows for proper searching of libraries, and linking
    of dynamic libraries (especially on Windows).

@daveinglis
Copy link
Contributor Author

@swift-ci test

@daveinglis daveinglis force-pushed the building_tests_fixes_windows branch 8 times, most recently from c224e9e to 843e629 Compare November 10, 2025 16:21
@daveinglis daveinglis changed the title Change how libraries are specified to the linker Change how libraries are specified to the linker when using searched libs Nov 10, 2025
@daveinglis daveinglis force-pushed the building_tests_fixes_windows branch 5 times, most recently from e6674c3 to 3d422f3 Compare November 11, 2025 16:39
@daveinglis
Copy link
Contributor Author

@swift-ci test

@daveinglis daveinglis force-pushed the building_tests_fixes_windows branch from 3d422f3 to 27d13e5 Compare November 11, 2025 19:40
@daveinglis
Copy link
Contributor Author

@swift-ci test

…libs

- remove the platform specifics from computeLibraryArgs (we cannot assume
  that all libraries have a lib prefix and what there suffix is.) So we
  now use the FileType prefix and remove any suffix when using
  searchPathFlagsForLD, moving this into the LinkerSpec.LibrarySpecifier
  extension, this allows for proper searching of libraries, and linking
  of dynamic libraries (especially on Windows).
@daveinglis daveinglis force-pushed the building_tests_fixes_windows branch from 27d13e5 to 4fe5921 Compare November 11, 2025 21:06
@daveinglis
Copy link
Contributor Author

@swift-ci test

@daveinglis daveinglis marked this pull request as ready for review November 12, 2025 01:24
}

if specifier.useSearchPaths, basename.hasPrefix("lib"), basename.hasSuffix(".a") {
if specifier.useSearchPaths {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we emit some kind of warning here if the library name doesn't have one of the prefixes we think will allow it to be found via search paths?

fileprivate extension LinkerSpec.LibrarySpecifier {
func searchPathFlagsForLd(_ name: String) -> [String] {
func searchPathFlagsForLd() -> [String] {
let strippedName: String
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question here, should we warn if we get a filename format we don't recognize here / don't think will be found?

self.dsymPath = dsymPath
self.xcframeworkSourcePath = xcframeworkSourcePath
self.privacyFile = privacyFile
self.libPrefix = prefixes.first
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we only consider the first element here?

@owenv
Copy link
Collaborator

owenv commented Nov 12, 2025

overall this looks great, just have a few questions

@owenv
Copy link
Collaborator

owenv commented Nov 12, 2025

we should also run this through cross-repo testing before merging

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.

2 participants