From: Michal Privoznik <mprivozn@redhat.com>
To: qemu-devel@nongnu.org
Cc: veroniabahaa@gmail.com, eblake@redhat.com
Subject: [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation
Date: Fri, 2 Sep 2016 13:49:08 +0200 [thread overview]
Message-ID: <aee4e0cc17d97b27e57b5dc656d87eb4c12f9a44.1472816827.git.mprivozn@redhat.com> (raw)
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
next reply other threads:[~2016-09-02 11:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 11:49 Michal Privoznik [this message]
2016-09-02 11:56 ` [Qemu-devel] [PATCH v2] tests: Fix broken tcg test compilation Peter Maydell
2016-09-02 12:04 ` Pranith Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aee4e0cc17d97b27e57b5dc656d87eb4c12f9a44.1472816827.git.mprivozn@redhat.com \
--to=mprivozn@redhat.com \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=veroniabahaa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).