Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Problem building pyrebox on Debian sid #114

Open
Te-k opened this issue Aug 7, 2020 · 4 comments
Open

Problem building pyrebox on Debian sid #114

Te-k opened this issue Aug 7, 2020 · 4 comments
Assignees
Labels

Comments

@Te-k
Copy link

Te-k commented Aug 7, 2020

Hi,

I am trying to build pyrebox on Debian sid. When building qemu, I get the following error in the config.log file:

config-temp/qemu-conf.c: In function ‘main’:
config-temp/qemu-conf.c:2:25: error: null argument where non-null required (argument 1) [-Werror=nonnull]
    2 | int main(void) { return sem_timedwait(0, 0); }
      |                         ^~~~~~~~~~~~~
config-temp/qemu-conf.c:2:25: error: null argument where non-null required (argument 2) [-Werror=nonnull]
cc1: all warnings being treated as errors

It seems to be the issue mentioned here but config-temp is a temporary file, I am not sure what generates it in the compiling process, so not sure how to apply this patch. Any clue where that problem is coming from?

@xabiugarte
Copy link
Contributor

Hi Te-K, could you tell me the GCC version you are using?

@xabiugarte xabiugarte self-assigned this Aug 12, 2020
@Te-k
Copy link
Author

Te-k commented Aug 12, 2020

I am using gcc (Debian 10.2.0-3) 10.2.0

@xabiugarte
Copy link
Contributor

Hi Te-K,

There are some known problems with the latest versions of GCC. This will require to update the QEMU version that PyREBox relies on. I still need to allocate some time to work on that and make and properly test the upgrade. For the time being, you could try to compile PyREBox with an older GCC version such as gcc 8. This can be easily achieved with the alternatives system in Debian based distros: https://wiki.debian.org/DebianAlternatives

Thanks,

@Te-k
Copy link
Author

Te-k commented Aug 27, 2020

I got it working, it was not a GCC 10 issue, but some weird other problems. One of them is a bug in gcc configure script. The other one that is weird, is that qemu has a -Werror flag enabled by default if it is in a git repository. I solved that by forcing the --disable-werror in the build script (as explained here).

I guess it is not system dependent but I am surprised you never had these issues. Here are the paches if you want to fix them:

diff --git a/build.sh b/build.sh
index f19748fe..97ded8fb 100755
--- a/build.sh
+++ b/build.sh
@@ -95,7 +95,7 @@ if [ x"${reconfigure}" = xyes ] || [ ! -f ${qemu_path}/config-host.mak ] || [ !
     then
       qemu_configure_flags='--enable-debug'
     fi
-    ./configure --disable-docs --disable-libiscsi --target-list=i386-softmmu,x86_64-softmmu ${qemu_configure_flags}
+    ./configure --disable-werror --disable-docs --disable-libiscsi --target-list=i386-softmmu,x86_64-softmmu ${qemu_configure_flags}
     if [ $? -ne 0 ]; then
         echo -e "\n${RED}[!] Could not configure QEMU${NC}\n"
         exit 1
diff --git a/qemu/configure b/qemu/configure
index 54179416..a997e94a 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -5117,7 +5117,7 @@ fi
 sem_timedwait=no
 cat > $TMPC << EOF
 #include <semaphore.h>
-int main(void) { return sem_timedwait(0, 0); }
+int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); }
 EOF
 if compile_prog "" "" ; then
     sem_timedwait=yes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants