Open cecio opened 5 years ago
I run into similar issues on my ubuntu. While I didn't had a problem with minor/major I got this python error:
Collecting gevent==1.4.0 (from -r requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/ed/27/6c49b70808f569b66ec7fac2e78f076e9b204db9cf5768740cff3d5a07ae/gevent-1.4.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-lz1zIR/gevent/setup.py", line 427, in <module>
run_setup(EXT_MODULES, run_make=_BUILDING)
File "/tmp/pip-build-lz1zIR/gevent/setup.py", line 411, in run_setup
"signal_os_incompat = gevent.monkey:_subscribe_signal_os",
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/home/wdev/qira-1.3/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 268, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/home/wdev/qira-1.3/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/home/wdev/qira-1.3/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 804, in resolve
requirements = list(requirements)[::-1]
File "/home/wdev/qira-1.3/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2930, in parse_requirements
"version spec")
File "/home/wdev/qira-1.3/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2906, in scan_list
raise RequirementParseError(msg, line, "at", line[p:])
pkg_resources.RequirementParseError: Expected ',' or end-of-list in cffi >= 1.11.5 ; sys_platform == 'win32' and platform_python_implementation == 'CPython' at ; sys_platform == 'win32' and platform_python_implementation == 'CPython'
To resolve it I needed to upgrade virtualenv
And thanks for your fixes :)
pipenv is the real move here. Would merge it if someone did the PR
FWIW, the changes needed to get qemu building on WSL2 as of today (and thus likely on Ubuntu 20.04, and potentially any recent Debian based distro):
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 99fe9c56..1d1e3ba6 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -9,6 +9,7 @@
#include <sys/mman.h>
#include <unistd.h>
#include <sched.h>
+#include <sys/sysmacros.h>
#include "qemu.h"
#undef TARGET_ABI_FMT_lx
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d395f628..5d319cb4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -133,39 +133,46 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#undef _syscall5
#undef _syscall6
+int stime(const time_t *t)
+{
+ struct timespec ts = {};
+ ts.tv_sec = *t;
+ return clock_settime(CLOCK_REALTIME, &ts);
+}
+
#define _syscall0(type,name) \
-static type name (void) \
+type name (void) \
{ \
return syscall(__NR_##name); \
}
#define _syscall1(type,name,type1,arg1) \
-static type name (type1 arg1) \
+type name (type1 arg1) \
{ \
return syscall(__NR_##name, arg1); \
}
#define _syscall2(type,name,type1,arg1,type2,arg2) \
-static type name (type1 arg1,type2 arg2) \
+type name (type1 arg1,type2 arg2) \
{ \
return syscall(__NR_##name, arg1, arg2); \
}
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
-static type name (type1 arg1,type2 arg2,type3 arg3) \
+type name (type1 arg1,type2 arg2,type3 arg3) \
{ \
return syscall(__NR_##name, arg1, arg2, arg3); \
}
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
-static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \
{ \
return syscall(__NR_##name, arg1, arg2, arg3, arg4); \
}
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
type5,arg5) \
-static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
{ \
return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5); \
}
@@ -173,7 +180,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
type5,arg5,type6,arg6) \
-static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
type6 arg6) \
{ \
return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5, arg6); \
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c2ff9702..245f8b54 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -29,6 +29,7 @@
#include "qemu/queue.h"
#include "qemu/host-utils.h"
#include "qemu/sockets.h"
+#include <sys/sysmacros.h>
#ifndef CONFIG_HAS_ENVIRON
#ifdef __APPLE__
diff --git a/user-exec.c b/user-exec.c
index 8ad89a46..50c7cba6 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -58,7 +58,7 @@ static void exception_action(CPUState *cpu)
void cpu_resume_from_signal(CPUState *cpu, void *puc)
{
#ifdef __linux__
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
#elif defined(__OpenBSD__)
struct sigcontext *uc = puc;
#endif
@@ -172,7 +172,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#elif defined(__OpenBSD__)
struct sigcontext *uc = puc;
#else
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
#endif
unsigned long pc;
int trapno;
@@ -227,7 +227,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#elif defined(__OpenBSD__)
struct sigcontext *uc = puc;
#else
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
#endif
pc = PC_sig(uc);
@@ -289,7 +289,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#ifdef __APPLE__
#include <sys/ucontext.h>
-typedef struct ucontext SIGCONTEXT;
+typedef ucontext_t SIGCONTEXT;
/* All Registers access - only for local access */
#define REG_sig(reg_name, context) \
((context)->uc_mcontext->ss.reg_name)
@@ -332,7 +332,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
ucontext_t *uc = puc;
#else
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
#endif
unsigned long pc;
int is_write;
@@ -359,7 +359,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
void *puc)
{
siginfo_t *info = pinfo;
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
uint32_t *pc = uc->uc_mcontext.sc_pc;
uint32_t insn = *pc;
int is_write = 0;
@@ -457,7 +457,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#if defined(__NetBSD__)
ucontext_t *uc = puc;
#else
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
#endif
unsigned long pc;
int is_write;
@@ -484,7 +484,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
{
siginfo_t *info = pinfo;
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
uintptr_t pc = uc->uc_mcontext.pc;
uint32_t insn = *(uint32_t *)pc;
bool is_write;
@@ -513,7 +513,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
void *puc)
{
siginfo_t *info = pinfo;
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
unsigned long pc;
int is_write;
@@ -535,7 +535,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
{
siginfo_t *info = pinfo;
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
unsigned long ip;
int is_write = 0;
@@ -566,7 +566,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
void *puc)
{
siginfo_t *info = pinfo;
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
unsigned long pc;
uint16_t *pinsn;
int is_write = 0;
@@ -619,7 +619,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
void *puc)
{
siginfo_t *info = pinfo;
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
greg_t pc = uc->uc_mcontext.pc;
int is_write;
@@ -635,7 +635,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
void *puc)
{
siginfo_t *info = pinfo;
- struct ucontext *uc = puc;
+ ucontext_t *uc = puc;
unsigned long pc = uc->uc_mcontext.sc_iaoq[0];
uint32_t insn = *(uint32_t *)pc;
int is_write = 0;
diff --git a/util/memfd.c b/util/memfd.c
index 7c406914..1f3de727 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -40,7 +40,7 @@
#include <sys/syscall.h>
#include <asm/unistd.h>
-static int memfd_create(const char *name, unsigned int flags)
+int memfd_create(const char *name, unsigned int flags)
{
#ifdef __NR_memfd_create
return syscall(__NR_memfd_create, name, flags);
I tried to install qira on a debian based distro...I faced some errors, probably due to some libs/package misalignment.
I managed to fix and have everything working, just want to share, in case someone else face the same issues. Consider that I got the lazy way to fix....no reinstallations, just mods....
Error: "error: static declaration of 'memfd_create' follows non-static declaration" Fix: remove static from "int memfd_create" in "qira-1.3/tracers/qemu/qemu-2.5.1/util/memfd.c"
Error: "error: undefined reference to 'minor'/'major'" Fix: add "#include <sys/sysmacros.h>" in "qira-1.3/tracers/qemu/qemu-2.5.1/qga/commands-posix.c" and "qira-1.3/tracers/qemu/qemu-latest/linux-user/strace.c"
Error: "error dereferencing pointer to incomplete type 'struct ucontext'" Fix: take this at your own risk, but modify every "ucontext" decalaration in "ucontext_t" in "qira-1.3/tracers/qemu/qemu-latest/user-exec.c"
I don't know if it make sense to include these mods in the code...not sure if it's just my problem or a common one.