* [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation
@ 2016-09-02 11:49 Michal Privoznik
2016-09-02 11:56 ` Peter Maydell
2016-09-02 12:04 ` Pranith Kumar
0 siblings, 2 replies; 3+ messages in thread
From: Michal Privoznik @ 2016-09-02 11:49 UTC (permalink / raw)
To: qemu-devel; +Cc: veroniabahaa, eblake
The first build error to be seen is that linux-test.c fails to
include cutils.h:
linux-test.c:42:25: fatal error: qemu/cutils.h: No such file or directory
This is because toplevel include/ dir is not put onto compiler's
command line. After that:
qemu.git/include/qemu/cutils.h:171:1: error: unknown type name ‘bool’
So we need to include "qemu/osdep.h" which will define bool type
for us. However, osdep.h eventually includes glib.h from system,
therefore we need to put GLIB_CFLAGS onto compiler's command line
too.
Lastly, getrusage is used in linux-test.c. This function and a
struct it uses are defined in sys/resource.h:
linux-test.c:247:5: warning: implicit declaration of function ‘getrusage’
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
diff to v1:
- Move include of osdep.h in linux-test.c at the beginning of the file as
suggested by Eric in review
tests/tcg/Makefile | 6 +++---
tests/tcg/linux-test.c | 4 ++++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile
index 89e3342..5eadd8b 100644
--- a/tests/tcg/Makefile
+++ b/tests/tcg/Makefile
@@ -89,7 +89,7 @@ hello-i386: hello-i386.c
strip $@
testthread: testthread.c
- $(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
+ $(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
# i386/x86_64 emulation test (test various opcodes) */
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
@@ -98,7 +98,7 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
$(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm
test-i386-fprem: test-i386-fprem.c
- $(CC_I386) $(QEMU_INCLUDES) $(CFLAGS) $(LDFLAGS) -o $@ $^
+ $(CC_I386) $(QEMU_INCLUDES) $(GLIB_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^
test-x86_64: test-i386.c \
test-i386.h test-i386-shift.h test-i386-muldiv.h
@@ -106,7 +106,7 @@ test-x86_64: test-i386.c \
# generic Linux and CPU test
linux-test: linux-test.c
- $(CC_I386) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
+ $(CC_I386) $(QEMU_INCLUDES) $(GLIB_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
# vm86 test
runcom: runcom.c
diff --git a/tests/tcg/linux-test.c b/tests/tcg/linux-test.c
index 5070d31..173214d 100644
--- a/tests/tcg/linux-test.c
+++ b/tests/tcg/linux-test.c
@@ -16,6 +16,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+
+#include "qemu/osdep.h"
+
#define _GNU_SOURCE
#include <stdarg.h>
#include <stdlib.h>
@@ -31,6 +34,7 @@
#include <utime.h>
#include <time.h>
#include <sys/time.h>
+#include <sys/resource.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>
--
2.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation
2016-09-02 11:49 [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation Michal Privoznik
@ 2016-09-02 11:56 ` Peter Maydell
2016-09-02 12:04 ` Pranith Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-09-02 11:56 UTC (permalink / raw)
To: Michal Privoznik; +Cc: QEMU Developers, Veronia Bahaa
On 2 September 2016 at 12:49, Michal Privoznik <mprivozn@redhat.com> wrote:
> The first build error to be seen is that linux-test.c fails to
> include cutils.h:
>
> linux-test.c:42:25: fatal error: qemu/cutils.h: No such file or directory
>
> This is because toplevel include/ dir is not put onto compiler's
> command line. After that:
>
> qemu.git/include/qemu/cutils.h:171:1: error: unknown type name ‘bool’
>
> So we need to include "qemu/osdep.h" which will define bool type
> for us. However, osdep.h eventually includes glib.h from system,
> therefore we need to put GLIB_CFLAGS onto compiler's command line
> too.
Why are we including qemu/cutils.h anyway? As far as I can see
we don't use it for anything and removing the #include doesn't
cause any problems...
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation
2016-09-02 11:49 [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation Michal Privoznik
2016-09-02 11:56 ` Peter Maydell
@ 2016-09-02 12:04 ` Pranith Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Pranith Kumar @ 2016-09-02 12:04 UTC (permalink / raw)
To: Michal Privoznik; +Cc: qemu-devel, Veronia Bahaa
Hi Michal,
On Fri, Sep 2, 2016 at 7:49 AM, Michal Privoznik <mprivozn@redhat.com> wrote:
> The first build error to be seen is that linux-test.c fails to
> include cutils.h:
>
> linux-test.c:42:25: fatal error: qemu/cutils.h: No such file or directory
>
> This is because toplevel include/ dir is not put onto compiler's
> command line. After that:
>
> qemu.git/include/qemu/cutils.h:171:1: error: unknown type name ‘bool’
>
> So we need to include "qemu/osdep.h" which will define bool type
> for us. However, osdep.h eventually includes glib.h from system,
> therefore we need to put GLIB_CFLAGS onto compiler's command line
> too.
>
> Lastly, getrusage is used in linux-test.c. This function and a
> struct it uses are defined in sys/resource.h:
>
> linux-test.c:247:5: warning: implicit declaration of function ‘getrusage’
>
I recently posted a patch series cleaning up tests/tcg. While doing
that I fixed the build issues I came across.
Please see: https://www.mail-archive.com/qemu-devel@nongnu.org/msg393764.html
Thanks,
--
Pranith
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-02 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-02 11:49 [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation Michal Privoznik
2016-09-02 11:56 ` Peter Maydell
2016-09-02 12:04 ` Pranith Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).