rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.64k stars 306 forks source link

How to support emcc compiler? #580

Closed Virus-V closed 2 weeks ago

Virus-V commented 3 weeks ago

I have a C project that uses the emscripten SDK to compile wasm.

During the build, emcc is used to compile the c files, but bear generates an empty compile_commands.json.

I tried to manually create a soft link from emcc to ../wrapper in the wrapper.d directory, like other tools, and used the bear --force-wrapper -- make command to force wrapper mode, but bear still doesn't work.

How can I do this? Thank you!

rizsotto commented 2 weeks ago

Hi @Virus-V , you are on the right path. :) If you run Bear with -v switch (even multiple times) it prints extra information. Then you can see if the "wrapper" trick was working or not... My guess is that you need to create a config file and mention the emcc compiler to recognize.