How to make CLion recognise my fake compiler in compilation database?

Answered

Hello,

I'm trying to use CLion with an unsupported compiler (namely, windriver diab). I have a compilation database (compile_commands.json). If I import it directly, CLion will not recognise the compiler and things like code suggestions and navigation will not work. I have written a tool that replaces the unsupported compiler in "command" json field with itself. When the tool is run from CLion, it tries to pretend as if it was a supported compiler (GCC), providing all the necessary definitions and so on. The idea is to make code completion work by generating all the necessary definitions outside of CLion by this tool.

However, I get this message for each file in the project:

Unexpected compiler output. This compiler might be unsupported.
If you are using GCC/Clang, please report the bug in https://youtrack.jetbrains.com/issues/CPP.

In my tool, I implement the following scenario: when it's called with -xcpp or -xc from CLion, it outputs compiler identification as follows:

Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr --mandir
=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=pos
ix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-
gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-i
nitfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-functio
n --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.2.1 20181215 (Red Hat 8.2.1-6) (GCC)

Apart from that, the command line for each file is modified to include all the system headers and definitions.

My question is, what else should I implement to make CLion believe this is a supported compiler? I don't need any of the build functionality but I would like to have code navigation and refactoring.

0
1 comment

Hi Vlad, 

I'm afraid there is no way to use an unsupported compiler in CLion. Feel free to create a feature request about the Wind River Diab in our tracker: https://youtrack.jetbrains.com/issues/CPP.

0

Please sign in to leave a comment.