swift icon indicating copy to clipboard operation
swift copied to clipboard

[utils][presets] Build libc++ for LLDB on linux

Open Michael137 opened this issue 1 year ago • 4 comments

We pass -stdlib=libc++ in the test-suite to Clang for many of our tests because we want to explicilty test against libc++ type layouts. However, if we don't do this against a newly built libc++ we risk testing against old/unexpected layouts or if libc++ isn't available on the system, falling back to the system libstdc++.

This patch adds libcxx as an explicit target in the preset so the tests build against a fresh libc++ (as we do for our other LLDB presets too).

Fixes the Ubuntu LLDB bots: https://ci.swift.org/view/LLDB/job/oss-lldb-linux-ubuntu-22_04/10806/execution/node/427/log/?consoleFull

Michael137 avatar Sep 23 '24 10:09 Michael137

@swift-ci test

Michael137 avatar Sep 23 '24 10:09 Michael137

@swift-ci test linux

Michael137 avatar Sep 23 '24 13:09 Michael137

Seems reasonable to me, I just wonder if we also need to test libstdc++. @egorzhdan Is the expectations that users of C++ interop on Linux are using libc++?

adrian-prantl avatar Sep 23 '24 16:09 adrian-prantl

@egorzhdan It looks like the package bots (e.g., https://ci.swift.org/job/oss-swift-package-ubuntu-24_04/551/consoleText) are currently not building libc++. Should we change that?

adrian-prantl avatar Sep 23 '24 17:09 adrian-prantl

@swift-ci test

Michael137 avatar Sep 24 '24 10:09 Michael137

Is the expectations that users of C++ interop on Linux are using libc++?

By default Swift code that uses C++ interop on Linux is still compiled with libstdc++, we provide substantially better support for libstdc++ in the Swift compiler, compared to libc++ on Linux. The ability to compile with libc++ on Linux is meant to unblock projects which have dependencies that can only be built with libc++.

It looks like the package bots (e.g., https://ci.swift.org/job/oss-swift-package-ubuntu-24_04/551/consoleText) are currently not building libc++. Should we change that?

I think it would be reasonable to build libc++ on Linux on the bots. I can see a lot of Building CXX object libcxx/src output in this build log, so it looks like some part of libc++ is being built. Perhaps it just isn't installed to the right path afterwards?

egorzhdan avatar Sep 24 '24 11:09 egorzhdan