-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Conversation
Please test with following PR: swiftlang/swift-corelibs-libdispatch#489 |
utils/build-script-impl
Outdated
@@ -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 |
There was a problem hiding this comment.
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 =
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
utils/build-script-impl
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar
utils/gen-static-stdlib-link-args
Outdated
-ldispatch | ||
-lswiftDispatch | ||
-lDispatchStubs | ||
-lbsd |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
Please test with following PR: swiftlang/swift-corelibs-libdispatch#489 |
Build failed |
Build failed |
Please test with following PR: swiftlang/swift-corelibs-libdispatch#489 |
Build failed |
Build failed |
Please test with following PR: swiftlang/swift-corelibs-libdispatch#489 |
Build failed |
Build failed |
Does this always build the libdispatch static libraries, or does the product only get added if asked for? |
It is switched on here https://github.com/apple/swift/blob/master/utils/build-script-impl#L1261 |
Got it. The idea of products being configured and then enabled or not is confusing (although useful sometimes). |
There was a problem hiding this 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} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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 |
It still executes the |
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). |
@drodriguez @compnerd Does this PR look ok to you now? |
There was a problem hiding this 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).
@swift-ci test and merge |
1 similar comment
@swift-ci test and merge |
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
Resolves SR-7039 for
-static-stdlib