Problems compiling with clang (3.8.21)

Torsten Hilbrich torsten.hilbrich at secunet.com
Tue Apr 2 13:34:47 UTC 2019


Hello,

I tried to compile libmbim (1.16.0), libqmi (1.20.0) and ModemManager (1.8.0) with clang and got strange results.

I set the environment variables CC=clang and CXX=clang++ and ran the autogen.sh, configure, and make steps.

Then the configure noticed that clang was used and checked for the supported warning options:

CC='clang'
configure:3408: checking for gcc
configure:3435: result: clang
...
configure:17644: checking whether gcc understands -Wno-unused-but-set-variable
configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable  conftest.c >&5
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
1 warning generated.
configure:17657: $? = 0
configure:17666: result: yes


However, when compiling the code I got the following error messages:

make[4]: Entering directory '/build/client/clang/freedesktop/modemmanager/work/modemmanager/libqcdm/src'
  CC       libqcdm_la-com.lo
error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'?
      [-Werror,-Wunknown-warning-option]
Makefile:516: recipe for target 'libqcdm_la-com.lo' failed
make[4]: *** [libqcdm_la-com.lo] Error 1

I assume that checking in configure is done without -Werror, but compilation at least in libqdcdm is done with -Werror.


It this a known problem? Are fixes welcome to support compilation with clang?

The same problem happened in libmbim and libqmi.

With regards,

	Torsten Hilbrich




More information about the ModemManager-devel mailing list