Unsuppress compiler error messages in Clang.jl

Hi :slight_smile:
I’m pretty sure i’m the 100th guy who asks this, but i can’t find anything.

I ripped out the relevant parts to be able to call trans_unit.jl/parse_header(..) directly,
and when i do, the usual clang error messages are printed to stderr just like calling the compiler conventionally would.

Example:

/home/elkawee/src_deb/dbus-1.12.20/cmake/…/dbus/dbus-types.h:31:10: fatal error: ‘dbus/dbus-arch-deps.h’ file not found

But when using the generator as instructed on its github page
These messages are somehow suppressed.

Example:

Warning: failed to parse /home/elkawee/src_deb/dbus-1.12.20/dbus/dbus-address.h, skip…

Question:
Where and how does the Generator suppress those, and how do i get at them?

Probably because the default flags used in context.jl/parse_header(..) and trans_unit.jl/parse_header(..) are different.

/home/elkawee/src_deb/dbus-1.12.20/cmake/…/dbus/dbus-types.h:31:10: fatal error: ‘dbus/dbus-arch-deps.h’ file not found

I’m sure this error is due to the include_dir is not passed correctly to args.

Warning: failed to parse /home/elkawee/src_deb/dbus-1.12.20/dbus/dbus-address.h, skip…

It looks like you didn’t pass those compiler flags used when building the dbus binaries correctly.

1 Like

There is a BB artifact for Dbus, you could give it a try by running:

pkg> add Dbus_jll

julia> using Dbus_jll

julia> include_dir = joinpath(Dbus_jll.artifact_dir, "include") |> normpath

and follow the example in Clang.jl’s README.

Dubs_jll only works for Linux, so if you’re not working on Linux, you need to use the new cross-platform API:

julia> using Clang.Generators

julia> using Clang.JLLEnvs

julia> target = "x86_64-linux-gnu"
"x86_64-linux-gnu"

julia> include_dir = JLLEnvs.get_pkg_include_dir(Dbus_jll, target)

julia> args = get_default_args(target)

Thank you.
I am a complete idiot.

There was no suppression of error messages, i passed args as Vector{AbstractString} instead of Vector{String}

… explains why you would not tell me how to turn it off.