Skip to content

LLVMSwift as package dependency in Xcode #221

Open
@qmathe

Description

@qmathe

I have a Xcode 12.2 project where I would like to use LLVMSwift. I installed LLVM 9 with brew and followed Installation instructions. I then added LLVMSwift to my project with File > Swift Packages > Add Package Dependency…. The dependency references the latest commit on master.

When I compile my target, I get the following error: LLVMSwift/Sources/llvmshims/src/shim.cpp:1:10: fatal error: 'llvm-c/Core.h' file not found.

From what I see in the output, flags defined in pkgconfig/cllvm.pc are missing. It's my first time using Swift Package Manager and I don't know how it interacts with pkg-config. Here is how cllvm.pc was generated:

$ swift [snip]/SourcePackages/checkouts/LLVMSwift/utils/make-pkgconfig.swift 
Running /usr/bin/which llvm-config-9...
Running /usr/bin/which llvm-config...
Found llvm-config at /usr/local/opt/llvm@9/bin/llvm-config...
Running /usr/local/opt/llvm@9/bin/llvm-config --version...
LLVM version is 9.0.1
Running /usr/local/opt/llvm@9/bin/llvm-config --ldflags --libs all --system-libs...
Running /usr/local/opt/llvm@9/bin/llvm-config --cflags...
Writing pkg-config file to /usr/local/lib/pkgconfig/cllvm.pc...

Successfully wrote pkg-config file!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions