Problems compiling with clang (3.8.21)
Dan Williams
dcbw at redhat.com
Tue Apr 2 15:02:31 UTC 2019
On Tue, 2019-04-02 at 15:34 +0200, Torsten Hilbrich wrote:
> 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
I think -Wno-unused-but-set-variable is actually a mistake and it
should be "-Wunused-but-set-variable". But that causes build errors
that we should fix.
Does clang support -Wunused-but-set-variable?
Also, does making this change in m4/compiler_warnings.m4 of
ModemManager sources help?
- CFLAGS="$CFLAGS $option"
+ CFLAGS="$CFLAGS $option -Werror"
Dan
>
> However, when compiling the code I got the following error messages:
>
> make[4]: Entering directory
> '/build/client/clang/freedesktop/modemmanager/work/modemmanager/libqc
> dm/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
>
>
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
More information about the ModemManager-devel
mailing list