Skip to content
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

[SR-13625] LLDB on Linux cannot automatically find system headers linked via SwiftPM with pkg-config #4458

Open
swift-ci opened this issue Sep 28, 2020 · 4 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@swift-ci
Copy link

Previous ID SR-13625
Radar rdar://problem/69728225
Original Reporter ryanw (JIRA User)
Type Bug
Environment

Fedora 33 Beta

Swift version 5.3-dev (LLVM 6c69ba3, Swift af7ca0f3470a466)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: 3c0a257d2c62ccc4156ca7a708e09c29

Issue Description:

Attempting to debug an app using a system library (pipewire in this case) fails as LLDB cannot locate the library headers:

 lldb             SwiftASTContext("Tsunami")::CreateInstance(Module)
lldb             SwiftASTContext("Tsunami")::SetTriple("x86_64-unknown-linux-gnu") setting to "x86_64-unknown-linux-gnu"
lldb             SwiftASTContext("Tsunami")::SetTriple("x86_64-unknown-linux-gnu") setting to "x86_64-unknown-linux-gnu"
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- Found 1 AST file data entries.
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "ArgumentParser" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "Earthquake" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "HeliumLogger" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "LoggerAPI" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "Logging" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "Propellor" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "Signals" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- SDK path from module "Tsunami" was "".
lldb             SwiftASTContext("Tsunami")::DeserializeAllCompilerFlags() -- Picking SDK path "".
lldb             SwiftASTContext("Tsunami")::CreateInstance() -- Found serialized triple x86_64-unknown-linux-gnu.
lldb             SwiftASTContext("Tsunami")::SetTriple("x86_64-unknown-linux-gnu") setting to "x86_64-unknown-linux-gnu"
lldb             SwiftASTContext("Tsunami")::CreateInstance() -- No serialized SDK path.
lldb             SwiftASTContext("Tsunami")::CreateInstance() -- Host SDK path is .
lldb             SwiftASTContext::GetResourceDir() -- trying ePathTypeSwiftDir: /home/ryan/Projects/Develop/swift-toolchain/usr/lib/swift
lldb             SwiftASTContext::GetResourceDir() -- found Swift resource dir via ePathTypeSwiftDir': /home/ryan/Projects/Develop/swift-toolchain/usr/lib/swift
lldb             SwiftASTContext("Tsunami")::GetASTContext() -- Using Clang module cache path: /home/ryan/.cache/clang/ModuleCache
lldb             SwiftASTContext("Tsunami")::GetASTContext() -- Using prebuilt Swift module cache path: /home/ryan/Projects/Develop/swift-toolchain/usr/lib/swift/linux/prebuilt-modules
lldb             SwiftASTContext("Tsunami")::GetModule("ArgumentParser")
lldb             SwiftASTContext("Tsunami")::GetModule("ArgumentParser") -- found ArgumentParser
lldb             SwiftASTContext("Tsunami")::GetModule("Earthquake")
lldb             SwiftASTContext("Tsunami")::GetModule("Earthquake") -- <module-includes>:1:10: note: in file included from <module-includes>:1:
#include "include/cpipewire.h"
         ^error: /home/ryan/Projects/Develop/Tsunami/Sources/CPipewire/include/cpipewire.h:1:10: error: 'spa/param/audio/format-utils.h' file not found
#include <spa/param/audio/format-utils.h>
         ^error: could not build C module 'CPipewire'

Can be worked around by setting a custom compiler flag in ~/.lldbinit as follows:

settings set -- target.swift-extra-clang-flags -I/usr/include/pipewire-0.3 -I/usr/include/spa-0.2

Similar symptoms to https://bugs.swift.org/browse/SR-12050 but involving system library rather than SwiftPM packaged module.

@typesanitizer
Copy link

@swift-ci create

@adrian-prantl
Copy link
Member

Is there a way you could share a project that reproduces the issue either here or via Apple Feedback?

@swift-ci
Copy link
Author

swift-ci commented Oct 3, 2020

Comment by Ryan (JIRA)

@adrian-prantl sure - https://github.com/tokyovigilante/SR13625Example

Sorry, this took a wee while. It's a stripped version of my project. interestingly optimising the Pipewire module any further (reducing the complexity to a single PipewireOutput class in this example) resulted in the bug not being reduced.

Tested on Fedora 33 Beta with pipewire-devel installed, should be able to be tested on Fedora 32 as it will have the relevant package also. Have not tested on Ubuntu.

@swift-ci
Copy link
Author

swift-ci commented Oct 3, 2020

Comment by Ryan (JIRA)

Steps to reproduce:

  1. swift build

  2. lldb ./.build/debug/Tsunami

  3. Set a breakpoint in main.swift (will produce relevant debug output

  4. Run executable

  5. At breakpoint enter fr v, no frame variables printed.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

3 participants