Skip to content

Conversation

daveinglis
Copy link
Contributor

  • fix adding -lc++ to OTHER_LDFLAGS to match native build system.
  • remove OTHER_LDRFLAGS setting

@daveinglis daveinglis changed the title Cleanup some unnecessary build setting Fix/Cleanup some unnecessary build setting Oct 8, 2025
@daveinglis
Copy link
Contributor Author

@swift-ci test

// darwin & freebsd
if [.macOS, .macCatalyst, .iOS, .watchOS, .tvOS, .xrOS, .driverKit, .freebsd].contains(platform) {
settings[.OTHER_LDFLAGS, platform] = ["-lc++", "$(inherited)"]
} else if platform != .windows { // all others except windows
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should warn or emit a debug log if we encounter a totally unknown platform here so we know we need to go fix it up

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 made the new test fail of it finds a unknown platform.

@owenv
Copy link
Contributor

owenv commented Oct 8, 2025

It might be nice to see if we can put in a test in SwiftBuildSupportTests/PIFBuilderTests for this

- fix adding -lc++ to OTHER_LDFLAGS to match native build system.

- remove OTHER_LDRFLAGS setting
@daveinglis
Copy link
Contributor Author

@swift-ci test

@daveinglis
Copy link
Contributor Author

@swift-ci test windows

@daveinglis
Copy link
Contributor Author

@swift-ci test linux

// We currently deliberately do not support Swift ObjC interface headers.
settings[.SWIFT_INSTALL_OBJC_HEADER] = "NO"
settings[.SWIFT_OBJC_INTERFACE_HEADER_NAME] = ""
settings[.OTHER_LDRFLAGS] = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know why this was set? Could be a default value that this is explicitly wanting to clear out.

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 it came over from the old PIF builder, not sure the history here.

)

if sourceModule.isCxx {
for platform in ProjectModel.BuildSettings.Platform.allCases {
Copy link
Contributor

Choose a reason for hiding this comment

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

On Windows, clang uses the MSVC C++ runtime, not libc++, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like it, -lc++ was not found, and it look like the linker is adding the MSVC libraries as c++ packages seem to be building now

@daveinglis
Copy link
Contributor Author

something weird happened with the PR where I could not update it anymore... here (#9234) is the new one and will close this one

@daveinglis daveinglis closed this Oct 9, 2025
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