[alsa-devel] [bug] alsa-tools-1.1.3 compilation fails with clang due to wrong inline declaration.
I've tried compiling alsa-tools-1.3.0 with clang, and the compilation fails with the following:
$ CC=clang CXX=clang++ make ./as10k1 <...snip...> clang -fno-strict-aliasing -O2 -Wall -pipe -g -o as10k1 as10k1.o parse.o assemble.o macro.o as10k1.o: In function `header': /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:524: undefined reference to `output_tram_line' /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:527: undefined reference to `output_tram_line' /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:539: undefined reference to `output_tram_line' /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:543: undefined reference to `output_tram_line' clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [Makefile:320: as10k1] Error 1 make[2]: Leaving directory '/home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1' make[1]: *** [Makefile:354: all-recursive] Error 1 make[1]: Leaving directory '/home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1' make: *** [Makefile:9: all] Error 1
Clang devs claim that it is not a bug in clang (as I thought originally), but rather invalid code, which happens to compile with gcc by accident. This is due to `output_tram_line` function being declared as `inline void output_tram_line`. The intent was probably to declare it as `static inline void output_tram_line`. Please see https://bugs.llvm.org/show_bug.cgi?id=33768 for more details.
Adding `static` to the function definition makes everything compile (at least everything that compiles with gcc already).
On Fri, 14 Jul 2017 00:32:42 +0200, moxian wrote:
I've tried compiling alsa-tools-1.3.0 with clang, and the compilation fails with the following:
$ CC=clang CXX=clang++ make ./as10k1 <...snip...> clang -fno-strict-aliasing -O2 -Wall -pipe -g -o as10k1 as10k1.o parse.o assemble.o macro.o as10k1.o: In function `header': /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:524: undefined reference to `output_tram_line' /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:527: undefined reference to `output_tram_line' /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:539: undefined reference to `output_tram_line' /home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1/as10k1.c:543: undefined reference to `output_tram_line' clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [Makefile:320: as10k1] Error 1 make[2]: Leaving directory '/home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1' make[1]: *** [Makefile:354: all-recursive] Error 1 make[1]: Leaving directory '/home/moxian/work/alsa-tools/alsa-tools-1.1.3/as10k1' make: *** [Makefile:9: all] Error 1
Clang devs claim that it is not a bug in clang (as I thought originally), but rather invalid code, which happens to compile with gcc by accident. This is due to `output_tram_line` function being declared as `inline void output_tram_line`. The intent was probably to declare it as `static inline void output_tram_line`. Please see https://bugs.llvm.org/show_bug.cgi?id=33768 for more details.
Adding `static` to the function definition makes everything compile (at least everything that compiles with gcc already).
I dropped simply the bogus inline prefix.
thanks,
Takashi
participants (2)
-
moxian
-
Takashi Iwai