Skip to content

Add modulemaps that work for statically compiled Foundation #2850

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

Merged
merged 2 commits into from
Aug 12, 2020

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Aug 4, 2020

The static libraries need to link against additional dependencies, which are listed in the newly added modulemaps

@drexin drexin requested review from millenomi and compnerd August 4, 2020 22:20
@drexin
Copy link
Contributor Author

drexin commented Aug 4, 2020

This so far only works for -static-stdlib. To make -static-executable work, we would need to list all transitive dependencies.

@drexin
Copy link
Contributor Author

drexin commented Aug 4, 2020

@swift-ci test linux

CMakeLists.txt Outdated
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS
CoreFoundation CFXMLInterface CFURLSessionInterface)
install(TARGETS CoreFoundation CFXMLInterface CFURLSessionInterface
DESTINATION lib/swift_static/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
DESTINATION ${swift_lib_dir}/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>)
Copy link
Member

Choose a reason for hiding this comment

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

This seems incorrect. CoreFoundation is always built statically for Foundation, so this should always be swift_static 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.

Good catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, actually this is still correct because it will only be installed if we are compiling statically, in which case the variable is already set to lib/swift_static. I can change it back if you want.

Copy link
Member

Choose a reason for hiding this comment

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

That would be great.

DESTINATION
lib/swift/CFXMLInterface)
${swift_lib_dir}/CFXMLInterface)
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need two copies of the headers? I think that I should revive my work to remove the private headers at least. We really want to stop propagating the CoreFoundation headers into the toolchain I think.

CC: @millenomi

The static libraries need to link against additional dependencies, which are listed in the newly added modulemaps
@drexin drexin force-pushed the wip-static-modulemap branch from 7be5a73 to 185640c Compare August 5, 2020 21:11
@drexin
Copy link
Contributor Author

drexin commented Aug 5, 2020

@swift-ci test linux

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.

I'm fine with doing this for now to get the work unblocked but we should revisit the need for duplicating the headers. Could you please file a SR/radar before merging and reference it here?

Minor nit: mind pulling down the definition of swift_lib_dir out of the current block and right before the blocks of install where is used?

@drexin
Copy link
Contributor Author

drexin commented Aug 10, 2020

@compnerd I'm not sure what you mean by pulling the definition of swift_lib_dir out. It's defined pretty much right before it's being used.

@drexin
Copy link
Contributor Author

drexin commented Aug 12, 2020

@swift-ci test

@drexin drexin merged commit 98ff863 into swiftlang:master Aug 12, 2020
@finagolfin
Copy link
Member

Nice work, I just tried this out with the latest 8/18 official trunk snapshot build for Ubuntu and it works great.

Any plans to backport these pulls to the 5.3 branch? I will do it for the Android builds I put out if not.

@drexin
Copy link
Contributor Author

drexin commented Aug 19, 2020

@buttaface Thanks for the feedback! I am planning to backport this to 5.3 as well.

@finagolfin
Copy link
Member

Great, looking forward to it.

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