Skip to content

Conversation

@finagolfin
Copy link
Member

Now that libllbuildSwift is statically linked against libllbuild with #852, remove the runpath and don't install it. Also, the Android build started failing, so set the appropriate flag for it to work again.

Previously, we installed libllbuild.so in the Swift toolchain alongside libllbuildSwift.so and set the ELF runpath so it knew it was in the same directory:

> ls swift-5.7.3-RELEASE-ubuntu20.04/usr/lib/swift/pm/llbuild/
libllbuild.so  libllbuildSwift.so
> readelf -d swift-5.7.3-RELEASE-ubuntu20.04/usr/lib/swift/pm/llbuild/libllbuildSwift.so |ag runpath
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:$ORIGIN/../../linux]

Now that @compnerd made it link statically, we're wrongly shipping the static libllbuild and still have the now unneeded runpath:

> ls swift-DEVELOPMENT-SNAPSHOT-2023-03-01-a-ubuntu20.04/usr/lib/swift/pm/llbuild/
libllbuild.a  libllbuildSwift.so
> readelf -d swift-DEVELOPMENT-SNAPSHOT-2023-03-01-a-ubuntu20.04/usr/lib/swift/pm/llbuild/libllbuildSwift.so | ag runpath
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:$ORIGIN/../../linux]

Also, I started seeing cross-compilation failures on my daily Android CI with this move to static linking, which this Android change now fixes, finagolfin/swift-android-sdk#94.

… statically linked

Now that libllbuildSwift is statically linked against libllbuild with swiftlang#852,
remove the runpath and don't install it. Also, the Android build started
failing, so set the appropriate flag for it to work again.
@finagolfin
Copy link
Member Author

@johari, would be good to fix this before the upcoming 5.9 branch, let me know what you think.

@johari
Copy link
Member

johari commented Mar 7, 2023

cc/ @owenv @jakepetroules @dmbryson and @compnerd

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 don't see a problem with the diff, I think that it can go further though and reduce even more of the installation logic.

Thanks for cleaning this up @buttaface!


if(CMAKE_SYSTEM_NAME STREQUAL Android)
set(CMAKE_HAVE_LIBC_PTHREAD TRUE)
endif()
Copy link
Member

Choose a reason for hiding this comment

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

I think that this condition isn't exactly the best, but it works for now. We should prefer to figure this out more generally as musl also includes pthread in libc.

ARCHIVE DESTINATION lib${LLBUILD_LIBDIR_SUFFIX}
LIBRARY DESTINATION lib${LLBUILD_LIBDIR_SUFFIX}
RUNTIME DESTINATION bin
COMPONENT libllbuild)
Copy link
Member

Choose a reason for hiding this comment

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

I think that we should nix this part as well. Although it doesn't really matter much for Windows distributions as the packaging of the installer will drop it, it does help keep things clean. Does it make sense to continue distributing the headers? Or should we also be dropping those? Sorry about this mess I created!

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if the rest is needed or not, haven't looked into it.

target_link_options(llbuildSwift PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
set_target_properties(llbuildSwift PROPERTIES
INSTALL_RPATH "$ORIGIN:$ORIGIN/../../$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
INSTALL_RPATH "$ORIGIN/../../$<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.

The diff rendering here is silly, the change is removing $ORIGIN not altering the second path. That seems reasonable as there is nothing from that location that should now be needed.

@finagolfin
Copy link
Member Author

@johari, would you please run the CI and merge?

@johari
Copy link
Member

johari commented Mar 7, 2023

@SwiftCI please smoke test

@finagolfin
Copy link
Member Author

I believe it's called @swift-ci.

@dmbryson
Copy link
Contributor

dmbryson commented Mar 8, 2023

@swift-ci please smoke test

@johari
Copy link
Member

johari commented Mar 9, 2023

CI is green, but let's ensure it doesn't break downstream before merging it. Reverting them is not fun.

@finagolfin
Copy link
Member Author

Ping, can be merged now?

@johari
Copy link
Member

johari commented Mar 14, 2023

Making a quick inquiry with @bnbarham and we should be good to go.

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.

4 participants