clangd and Kit Environment Variables
-
I've set some environment variables, CFLAGS, CXXFLAGS, and so on in the Kit settings under "Environment"
They look something like
CFLAGS=-mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/redacted/path
Everything builds beautifully and the generated makefiles look correct. However, there seems to be some kind of an issue with the way Qt Creator is passing these arguments to my GCC when it's trying to dump info for clangd.
If I run qtcreator from the terminal, I can see the following output:
SOFT ASSERT [17:02:30.451]: /home/qt/work/build/qt-creator/src/plugins/projectexplorer/gcctoolchain.cpp:625: Compiler feature detection failure. The command "/redacted-path/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -x c -E -dM '-mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/redacted/path' -D_REENTRANT -" terminated with exit code 1. arm-poky-linux-gnueabi-gcc: error: unrecognized command-line option ‘-mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/redacted/path’
As you can see, it's passing all of the arguments in single quotes, so it thinks of it as one giant argument.
How do I get it to NOT do that?
-
To answer my own question, I was setting
OE_QMAKE_CFLAGS
andOE_QMAKE_CXXFLAGS
with those values. This appears to be what it was pulling from.By removing these and instead moving it to the
Platform codegen flags
andPlatform linker flags
for the compiler settings, I seem to achieve the result that I want.It's a little more duplication than I would want, but it is functional.
-