Skip to content

SR-7039: Build and install libdispatch static libraries #25085

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 1 commit into from
May 30, 2019

Conversation

spevans
Copy link
Contributor

@spevans spevans commented May 27, 2019

Resolves SR-7039 for -static-stdlib

@spevans
Copy link
Contributor Author

spevans commented May 27, 2019

@@ -2113,7 +2113,11 @@ for host in "${ALL_HOSTS[@]}"; do

for product in "${PRODUCTS[@]}"; do
# Check if we should perform this action.
if ! [[ $(should_execute_action "${host}-${product}-build") ]]; then
tmp_product=${product}
if [ ${tmp_product} == "libdispatch_static" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Please don't mix and match sh and bash. Use either [[ and == or [ and =.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, I never realised they were different for sh v bash. Anyway, fixed.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, POSIX sh only has [ and =. Bash extended that syntax to have ... something which behaved marginally more expectantly by people at that time. I would posit that the expectations of people around the behaviour of the conditional checks have changed, so they are just as confusing to many people today.

@@ -3463,7 +3467,12 @@ for host in "${ALL_HOSTS[@]}"; do

for product in "${PRODUCTS[@]}"; do
# Check if we should perform this action.
if ! [[ $(should_execute_action "${host}-${product}-install") ]]; then
tmp_product=${product}
if [ ${tmp_product} == "libdispatch_static" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Similar

-ldispatch
-lswiftDispatch
-lDispatchStubs
-lbsd
Copy link
Member

Choose a reason for hiding this comment

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

There is no reason to assume libbsd - you can build with the stubs and without libbsd.

This file is really horrible. If this is meant to be a valid way to build, I think that we should hardcode this into the driver. CC @jrose-apple

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you dont have -lbsd you get the following link error:

/home/spse/swift-build-master-test/usr/lib/swift_static/linux/libdispatch.a(init.c.o):init.c:function _dispatch_object_missing_debug: error: undefined reference to 'strlcpy'
/home/spse/swift-build-master-test/usr/lib/swift_static/linux/libdispatch.a(init.c.o):init.c:function _dispatch_debugv: error: undefined reference to 'strlcpy'
/home/spse/swift-build-master-test/usr/lib/swift_static/linux/libdispatch.a(init.c.o):init.c:function _dispatch_logv_init: error: undefined reference to 'getprogname'

The idea of this file is that the static-stdlib-link-args file can be generated at build time depending on the platform, rather than having a complex list of files in the driver with lots of per platform #ifdefs.

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 ended up removing these extra libs as they broke the swift tests anyway, so I just added them as extra link options to the swift-integration-tests test instead.

@spevans
Copy link
Contributor Author

spevans commented May 27, 2019

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ef33f113fd2839599284a944024a3c56e8554d6d

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ef33f113fd2839599284a944024a3c56e8554d6d

@spevans
Copy link
Contributor Author

spevans commented May 28, 2019

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 721cca02e1821a668776ce84c185a28f40871b0c

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 721cca02e1821a668776ce84c185a28f40871b0c

@spevans
Copy link
Contributor Author

spevans commented May 28, 2019

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b3d521a671b6f5a107393494a9d25c7064fd6dbc

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b3d521a671b6f5a107393494a9d25c7064fd6dbc

@jrose-apple
Copy link
Contributor

Does this always build the libdispatch static libraries, or does the product only get added if asked for?

@spevans
Copy link
Contributor Author

spevans commented May 28, 2019

@jrose-apple
Copy link
Contributor

Got it. The idea of products being configured and then enabled or not is confusing (although useful sometimes).

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.

@drodriguez may have opinions as he has been working to migrate things to python.

@@ -2113,7 +2113,11 @@ for host in "${ALL_HOSTS[@]}"; do

for product in "${PRODUCTS[@]}"; do
# Check if we should perform this action.
if ! [[ $(should_execute_action "${host}-${product}-build") ]]; then
tmp_product=${product}
Copy link
Member

Choose a reason for hiding this comment

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

Why not simplify this further?

for product in ${PRODUCTS[@]} ; do
  product=${product//_static/}

should effectively give you all the changes that you need for all the products being built statically. Generalising that means that we don't need to handle each product individually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment the Foundation static libs dont build so I dont want foundation_static enabled, however once it's working I will up update to that to enable it for both. So for now just libdispatch will be enabled.

@drodriguez
Copy link
Contributor

Should be fine. I’m still a little bit away of porting dispatch to the new system, and it already had to do some special bits for the dynamic/static bits.

What I am curious is if it is OK to execute the steps for libdispatch twice (since libdispatch can be a product at the same time as libdispatch_static).

@spevans
Copy link
Contributor Author

spevans commented May 29, 2019

It still executes the libdispatch_static part as libdispatch_static, it only passes the name as libdispatch to should_execute_action.

@drodriguez
Copy link
Contributor

Right. Sorry about the question. That's what happen when I type before having my morning coffee (disclusure: I don’t drink coffee, so that's my normal state).

@spevans
Copy link
Contributor Author

spevans commented May 29, 2019

@drodriguez @compnerd Does this PR look ok to you now?

Copy link
Contributor

@drodriguez drodriguez left a comment

Choose a reason for hiding this comment

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

It's OK for me, but you might want to change the description, which no longer match the contents of the PR after all the changes (unless GitHub is showing me just changes in build-script-impl for some reason).

@spevans
Copy link
Contributor Author

spevans commented May 30, 2019

@swift-ci test and merge

1 similar comment
@spevans
Copy link
Contributor Author

spevans commented May 30, 2019

@swift-ci test and merge

@swift-ci swift-ci merged commit a21cc81 into swiftlang:master May 30, 2019
yln added a commit that referenced this pull request Aug 12, 2019
PR #25085 [1] enabled building and installing the static variant of the
libdispatch library in build-script-impl. This broke the
`tsan-libdispatch-test` preset [2].

Let's make sure we pass along the options specified in
`libdispatch-cmake-options` when building the static variant.

[1] #25085
[2] #24330

rdar://problem/49177823
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.

5 participants