GNOME Bugzilla – Bug 664606
vala testsuite fails on multilib builds as it drops CFLAGS
Last modified: 2012-02-01 15:02:42 UTC
Created attachment 201963 [details] buildscript-0.14.0-74-gd03557e.txt When vala is built with CFLAGS=-m32 and PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig:/usr/share/pkgconfig" to get the 32-bit versions of libs and headers, the error in the attached buildscript is encountered when running the testsuite (not to mention the numerous parallel build errors). This build error happens because the testsuite ignores CFLAGS, causing GCC to enter 64-bit mode, when invoking VALAC. Yet, because PKG_CONFIG_LIBDIR is set for 32-bit building, the C code produced by valac is compiled against glib's 32-bit headers. This causes the usual following error: /usr/include/glib-2.0/glib/gthread.h:347:3: error: size of unnamed array is negative This error is produced because glib is checking the sanity of ABI compatibility between its headers and the mode gcc is in, producing a negative index for an array dereference to prevent the compilation from proceeding. An example of how to get pkg-config to behave properly when compiling 32-bit code on a multilib amd64 machine: ohnobinki@ohnopublishing ~/vala $ pkg-config --cflags glib -I/usr/include/glib-1.2 -I/usr/lib64/glib/include ohnobinki@ohnopublishing ~/vala $ PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig:/usr/share/pkgconfig" pkg-config --cflags glib -I/usr/include/glib-1.2 -I/usr/lib32/glib/include
Created attachment 201964 [details] [review] vala--0.14.0-74-gd03557e-testsuite-CFLAGS.patch This patch fixes the compilation problem shown in attachment 201963 [details] for me by respecting CFLAGS, LDFLAGS, and CPPFLAGS when compiling a vala program in the testsuite.
Thanks for your patch. Why should we honor CPPFLAGS?
(In reply to comment #2) > Thanks for your patch. Why should we honor CPPFLAGS? See $ info '(automake1.11) Standard Configuration Variables' Since valac invokes the C compiler driver on the generated C files, the C compiler driver in turn invokes the preprocessor, compiler, assembler, and linker in turn. A user building vala may need to specify a preprocessor-specific flag, such as -I or -D, for the generated C code to be compiled successfully. These flags belong in CPPFLAGS. If CPPFLAGS is arbitrarily ignored by the testsuite script when automake uses it everywhere else in its own build rules, certain testsuite failure errors caused by ignoring CPPFLAGS may be confusing to the user. Maybe I don't see your point; why should one not honor CPPFLAGS?
(In reply to comment #3) > Maybe I don't see your point; why should one not honor CPPFLAGS? Because it's C code, not C++?
Sorry, my mistake. I recognized that as CXXFLAGS. CPPFLAGS is obviously fine.
commit 224a2fcb750aca13e917b3319dc8985ce5fde2e9 Author: Nathan Phillip Brink <binki@gentoo.org> Date: Wed Nov 23 02:57:23 2011 +0000 tests: Honor CFLAGS, LDFLAGS, and CPPFLAGS Fixes bug 664606. This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.