bochs-emu / Bochs

Bochs - Cross Platform x86 Emulator Project
https://bochs.sourceforge.io/
GNU Lesser General Public License v2.1
903 stars 108 forks source link

Bochs git fails to build on netBSD 10.0 amd64 #392

Open Randrianasulu opened 5 days ago

Randrianasulu commented 5 days ago
gmake[1]: Entering directory '/home/guest/src/Bochs/bochs/gui'
g++ -c  -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I.. -I./.. -I../iodev -I./../iodev -I../instrument/stubs -I./../instrument/stubs -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -pthread   -D_REENTRANT -I/usr/X11R7/include  textconfig.cc -o textconfig.o
In file included from textconfig.cc:59:
../logio.h:64:62: error: ‘va_list’ has not been declared
   64 |   void fatal(int level, const char *prefix, const char *fmt, va_list ap, int exit_status);
      |                                                              ^~~~~~~
../logio.h:65:61: error: ‘va_list’ has not been declared
   65 |   void warn(int level, const char *prefix, const char *fmt, va_list ap);
      |                                                             ^~~~~~~
../logio.h:66:60: error: ‘va_list’ has not been declared
   66 |   void ask(int level, const char *prefix, const char *fmt, va_list ap);
      |                                                            ^~~~~~~
../logio.h:109:57: error: ‘va_list’ has not been declared
  109 |   void out(int level, const char *pre, const char *fmt, va_list ap);
      |                                                         ^~~~~~~
gmake[1]: *** [Makefile:120: textconfig.o] Error 1
gmake[1]: Leaving directory '/home/guest/src/Bochs/bochs/gui'
gmake: *** [Makefile:362: gui/libgui.a] Error 2

git commit 07047ee279f98e38041bc10db7708f8999a9e56d

gcc --version
gcc (nb3 20231008) 10.5.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Vort commented 4 days ago

I was able to get pass first 3 obstacles with such changes:

diff --git a/bochs/gui/textconfig.cc b/bochs/gui/textconfig.cc
index 9b7035f0c..41a611f0a 100644
--- a/bochs/gui/textconfig.cc
+++ b/bochs/gui/textconfig.cc
@@ -48,6 +48,7 @@ extern "C" {
 #include <ctype.h>
 #include <string.h>
 #include <assert.h>
+#include <stdarg.h>

 #ifndef __QNXNTO__
 }
diff --git a/bochs/iodev/network/eth_slirp.cc b/bochs/iodev/network/eth_slirp.cc
index 735f1b281..b9c871937 100644
--- a/bochs/iodev/network/eth_slirp.cc
+++ b/bochs/iodev/network/eth_slirp.cc
@@ -32,6 +32,10 @@
 #include "pc_system.h"
 #include "netmod.h"

+#ifdef __NetBSD__
+#include <sys/wait.h>
+#endif
+
 #if BX_NETWORKING && BX_NETMOD_SLIRP

 #ifdef _WIN32
diff --git a/bochs/iodev/network/eth_socket.cc b/bochs/iodev/network/eth_socket.cc
index 4c96cc9c2..155c53f21 100644
--- a/bochs/iodev/network/eth_socket.cc
+++ b/bochs/iodev/network/eth_socket.cc
@@ -93,7 +93,9 @@ extern "C" {
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <netinet/in.h>
+#ifndef __NetBSD__
 #include <net/ethernet.h>
+#endif
 #include <net/if.h>
 #ifdef __linux__
 #include <linux/types.h> 

But this one still puzzles me: image

Randrianasulu commented 4 days ago

may be make vs gmake (gnu make as on linux) difference?

try gmake instead of make?

Vort commented 4 days ago

try gmake instead of make?

It solved the problem, thanks.

I configured Bochs with ./.conf.linux normal by the way. Looks like you tried something different since you did not encountered eth_slirp/eth_socket problems.

image

Randrianasulu commented 4 days ago

Thanks! Yes, I used plain ./configure + gmake

vruppert commented 4 days ago

Is it required to apply the changes above to fix this issue?

Vort commented 4 days ago

I don't completely understand your question. These changes are what was needed to make successfull build of Bochs with gmake for me. Are they perfect? I don't know.

Randrianasulu commented 4 days ago

Is it required to apply the changes above to fix this issue?

I added patch for textconfig.cc and build finished. Probably need to add more configure enables for others to have effect ...

Randrianasulu commented 4 days ago

building with .conf.linux required additional patches as posted here.

But sadly I have pulseaudio as dependency so on NetBSD where pkgsrc soft installed in /usr/pkg build fail a bit later:

soundpulse.h:25:10: fatal error: pulse/simple.h: No such file or directory
   25 | #include <pulse/simple.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
pkg-config --cflags libpulse-simple
-I/usr/pkg/include -D_REENTRANT

hopefully adding this -I will fix that?

Vort commented 4 days ago

I don't understand entirely how (g)make works, but this change allowed to compile Bochs with Pulse support: (autoreconf and reconfiguration are needed, maybe also gmake all-clean before all of this)

diff --git a/bochs/configure.ac b/bochs/configure.ac
index c94e48411..f9c79186c 100644
--- a/bochs/configure.ac
+++ b/bochs/configure.ac
@@ -2172,6 +2172,7 @@ if test "$soundcard_present" = 1; then
     if test "x$PKG_CONFIG" != x; then
       $PKG_CONFIG --exists libpulse-simple
       if test x$? = x0; then
+        PULSE_SOUND_CFLAGS="`$PKG_CONFIG --cflags libpulse-simple`"
         SOUNDLOW_OBJS="$SOUNDLOW_OBJS soundpulse.o"
         soundlow_drivers="$soundlow_drivers pulse"
         AC_DEFINE(BX_HAVE_SOUND_PULSE, 1)
@@ -2209,6 +2210,7 @@ fi
 AC_SUBST(SOUNDHW_OBJS)
 AC_SUBST(SOUNDLOW_OBJS)
 AC_SUBST(ALSA_SOUND_LINK_OPTS)
+AC_SUBST(PULSE_SOUND_CFLAGS)
 AC_SUBST(PULSE_SOUND_LINK_OPTS)
 AC_SUBST(SDL_SOUND_LINK_OPTS)
 AC_SUBST(SOUNDHW_DLL_TARGETS)
diff --git a/bochs/iodev/sound/Makefile.in b/bochs/iodev/sound/Makefile.in
index 4dcc724e0..af95c56d3 100644
--- a/bochs/iodev/sound/Makefile.in
+++ b/bochs/iodev/sound/Makefile.in
@@ -40,7 +40,7 @@ SHELL = @SHELL@

 CXX = @CXX@
 CXXFLAGS = @CXXFLAGS@ @GUI_CXXFLAGS@
-CPPFLAGS = $(BX_INCDIRS) @CPPFLAGS@
+CPPFLAGS = $(BX_INCDIRS) @PULSE_SOUND_CFLAGS@ @CPPFLAGS@

 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@ 

Attempt to use it with Bochs ended with Assertion 'p' failed at ../src/pulse/simple.c:273, function pa_simple_write(). Aborting. message however.