Skip to content

Properly fix Pathogen and libClangSharp extensions not being exported on Linux #3

@PathogenDavid

Description

@PathogenDavid

On Linux, libclang typically exports its functions via an explicit listing: libclang.exports.

Because of this, the pathogen_ and clangsharp_ functions aren't being exported on Linux builds. Explicitly setting the visibility (IE: __attribute__((visibility("default")))) does not seem to work when this file is in use, I assume because the linker treats this exports file as the source of truth when it is specified.

In theory we could just list all of our functions here too, but I'm concerned this will lead to mistakes due to the fact that functions will be exported differently depending on the platform. Ideally it should "just work" on Linux like it does on Windows. (Edit: Upon some additional consideration, these mistakes could be prevented by adding some unit tests to either ClangSharp.Pathogen or llvm-project to ensure everything gets exported on all platforms. Although we'd likely want to do this as part of the ClangSharp.Pathogen CI since it's already building libclang.)

For now I've disabled the exports file, which causes the libclang.so file to balloon from 81 MB to 99 MB on my system. It's not clear whether this is caused by all the additional code needed to support these functions or whether it's caused by the fact that a ton of Clang's C++ API is now being exported too. If it's the former, this might just be the workaround.

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