Stuart Henderson <[email protected]> wrote:
> Build failed:
>
> > c++ -c -I. -I./. -Iinstrument/stubs -I./instrument/stubs -DBXHUB -O2 -pipe
> > -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES ./iodev/network/netutil.cc -o
> > misc/netutil.o
> > ./iodev/network/netutil.cc:1674:72: warning: format specifies type 'long'
> > but the argument has type 'off_t' (aka 'long long') [-Wformat]
> > sprintf(linebuf, "drwxrwxr-x 1 ftp ftp %ld %s %s%c%c",
> > st.st_size,
> > ~~~
> > ^~~~~~~~~~
> > %lld
> > ./iodev/network/netutil.cc:1677:72: warning: format specifies type 'long'
> > but the argument has type 'off_t' (aka 'long long') [-Wformat]
> > sprintf(linebuf, "-rw-rw-r-- 1 ftp ftp %ld %s %s%c%c",
> > st.st_size,
> > ~~~
> > ^~~~~~~~~~
> > %lld
> > 2 warnings generated.
> > /usr/bin/libtool --mode=link --tag CXX c++ -o bxhub -O2 -pipe
> > -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES misc/bxhub.o misc/netutil.o
> > libtool: link: c++ -o bxhub -O2 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
> > misc/bxhub.o misc/netutil.o
> > /usr/bin/make -C doc/docbook
> > *** Parse error in /pobj/bochs-2.7/bochs-2.7/doc/docbook: Error in archive
> > specification: "(not_found, not_found)" (Makefile:20)
> > *** Parse error: Need an operator in 'endif' (Makefile:27)
> > No closing parenthesis in archive specification
>
> Looks like a missing dep relating to docbook, but also some issues on
> non-LP64 archs showing in warnings, which should probably be cast to long long
> and printed using %lld.
woops, my fault. I remember fixing the format string but then I
probably got distracted and lost the patches...
Here's a diff that disables docbook and fixes the format strings.
Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/bochs/Makefile,v
retrieving revision 1.76
diff -u -p -r1.76 Makefile
--- Makefile 27 May 2022 12:20:06 -0000 1.76
+++ Makefile 12 Jun 2022 12:25:22 -0000
@@ -1,6 +1,7 @@
COMMENT= x86 machine simulator
DISTNAME= bochs-2.7
+REVISION= 0
CATEGORIES= emulators
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=bochs/}
@@ -11,10 +12,11 @@ PERMIT_PACKAGE= Yes
WANTLIB += ${COMPILER_LIBCXX} c curses m pthread
-COMPILER = base-clang ports-gcc base-gcc
+COMPILER = base-clang ports-gcc base-gcc
CONFIGURE_STYLE= gnu autoconf no-autoheader
-CONFIGURE_ARGS= --enable-all-optimizations \
+CONFIGURE_ARGS= --disable-docbook \
+ --enable-all-optimizations \
--enable-avx \
--enable-e1000 \
--enable-es1370 \
Index: patches/patch-cpu_apic_cc
===================================================================
RCS file: patches/patch-cpu_apic_cc
diff -N patches/patch-cpu_apic_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-cpu_apic_cc 12 Jun 2022 12:25:22 -0000
@@ -0,0 +1,23 @@
+fix format string
+
+Index: cpu/apic.cc
+--- cpu/apic.cc.orig
++++ cpu/apic.cc
+@@ -26,6 +26,8 @@
+ #include "scalar_arith.h"
+ #include "iodev/iodev.h"
+
++#include <inttypes.h>
++
+ #if BX_SUPPORT_APIC
+
+ extern bool simulate_xapic;
+@@ -1176,7 +1178,7 @@ void bx_local_apic_c::set_vmx_preemption_timer(Bit32u
+ vmx_preemption_timer_value = value;
+ vmx_preemption_timer_initial = bx_pc_system.time_ticks();
+ vmx_preemption_timer_fire = ((vmx_preemption_timer_initial >>
vmx_preemption_timer_rate) + value) << vmx_preemption_timer_rate;
+- BX_DEBUG(("VMX Preemption timer: value = %u, rate = %u, init = %u, fire =
%u", value, vmx_preemption_timer_rate, vmx_preemption_timer_initial,
vmx_preemption_timer_fire));
++ BX_DEBUG(("VMX Preemption timer: value = %u, rate = %u, init = %" PRIu64 ",
fire = %" PRIu64, value, vmx_preemption_timer_rate,
vmx_preemption_timer_initial, vmx_preemption_timer_fire));
+ bx_pc_system.activate_timer_ticks(vmx_timer_handle,
vmx_preemption_timer_fire - vmx_preemption_timer_initial, 0);
+ vmx_timer_active = 1;
+ }
Index: patches/patch-cpu_paging_cc
===================================================================
RCS file: patches/patch-cpu_paging_cc
diff -N patches/patch-cpu_paging_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-cpu_paging_cc 12 Jun 2022 12:25:22 -0000
@@ -0,0 +1,14 @@
+fix format string
+
+Index: cpu/paging.cc
+--- cpu/paging.cc.orig
++++ cpu/paging.cc
+@@ -804,7 +804,7 @@ bx_phy_address BX_CPU_C::translate_linear_long_mode(bx
+ // - R/W bit=0 and Dirty=1 for leaf entry
+ bool shadow_stack_page = ((combined_access & BX_COMBINED_ACCESS_WRITE) !=
0) && ((entry[leaf] & 0x40) != 0) && ((entry[leaf] & 0x02) == 0);
+ if (!shadow_stack_page) {
+- BX_DEBUG(("shadow stack access to not shadow stack page CA=%x
entry=%lx\n", combined_access, Bit32u(entry[leaf] & 0xfff)));
++ BX_DEBUG(("shadow stack access to not shadow stack page CA=%x
entry=%x\n", combined_access, Bit32u(entry[leaf] & 0xfff)));
+ page_fault(ERROR_PROTECTION, laddr, user, rw);
+ }
+
Index: patches/patch-iodev_hdimage_vbox_cc
===================================================================
RCS file: patches/patch-iodev_hdimage_vbox_cc
diff -N patches/patch-iodev_hdimage_vbox_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-iodev_hdimage_vbox_cc 12 Jun 2022 12:25:22 -0000
@@ -0,0 +1,41 @@
+fix format string
+
+Index: iodev/hdimage/vbox.cc
+--- iodev/hdimage/vbox.cc.orig
++++ iodev/hdimage/vbox.cc
+@@ -229,7 +229,7 @@ ssize_t vbox_image_t::read(void *buf, size_t count)
+ while (count > 0) {
+ off_t readable = perform_seek();
+ if (readable == INVALID_OFFSET) {
+- BX_ERROR(("vbox disk image read failed on %u bytes at " FMT_LL "d",
(unsigned)count, current_offset));
++ BX_ERROR(("vbox disk image read failed on %u bytes at %lld",
(unsigned)count, (long long)current_offset));
+ return -1;
+ }
+
+@@ -253,7 +253,7 @@ ssize_t vbox_image_t::write(const void *buf, size_t co
+ while (count > 0) {
+ off_t writable = perform_seek();
+ if (writable == INVALID_OFFSET) {
+- BX_ERROR(("vbox disk image write failed on %u bytes at " FMT_LL "d",
(unsigned)count, current_offset));
++ BX_ERROR(("vbox disk image write failed on %u bytes at %lld",
(unsigned)count, (long long)current_offset));
+ return -1;
+ }
+
+@@ -389,7 +389,7 @@ void vbox_image_t::read_block(const Bit32u index)
+ offset = dtoh32(mtlb[index]) * header.block_size;
+ bx_read_image(file_descriptor, header.offset_data + offset, block_data,
header.block_size);
+
+- BX_DEBUG(("reading block index %d (%d) " FMT_LL "d", index,
dtoh32(mtlb[index]), offset));
++ BX_DEBUG(("reading block index %d (%d) %lld", index, dtoh32(mtlb[index]),
(long long)offset));
+ }
+ }
+
+@@ -415,7 +415,7 @@ void vbox_image_t::write_block(const Bit32u index)
+
+ offset = dtoh32(mtlb[index]) * header.block_size;
+
+- BX_DEBUG(("writing block index %d (%d) " FMT_LL "d", index,
dtoh32(mtlb[index]), offset));
++ BX_DEBUG(("writing block index %d (%d) %lld", index, dtoh32(mtlb[index]),
(long long)offset));
+
+ bx_write_image(file_descriptor, header.offset_data + offset, block_data,
header.block_size);
+ }
Index: patches/patch-iodev_hdimage_vmware4_cc
===================================================================
RCS file: patches/patch-iodev_hdimage_vmware4_cc
diff -N patches/patch-iodev_hdimage_vmware4_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-iodev_hdimage_vmware4_cc 12 Jun 2022 12:25:22 -0000
@@ -0,0 +1,23 @@
+fix format string
+
+Index: iodev/hdimage/vmware4.cc
+--- iodev/hdimage/vmware4.cc.orig
++++ iodev/hdimage/vmware4.cc
+@@ -180,7 +180,7 @@ ssize_t vmware4_image_t::read(void * buf, size_t count
+ while (count > 0) {
+ off_t readable = perform_seek();
+ if (readable == INVALID_OFFSET) {
+- BX_DEBUG(("vmware4 disk image read failed on %u bytes at " FMT_LL "d",
(unsigned)count, current_offset));
++ BX_DEBUG(("vmware4 disk image read failed on %u bytes at %lld",
(unsigned)count, (long long)current_offset));
+ return -1;
+ }
+
+@@ -202,7 +202,7 @@ ssize_t vmware4_image_t::write(const void * buf, size_
+ while (count > 0) {
+ off_t writable = perform_seek();
+ if (writable == INVALID_OFFSET) {
+- BX_DEBUG(("vmware4 disk image write failed on %u bytes at " FMT_LL "d",
(unsigned)count, current_offset));
++ BX_DEBUG(("vmware4 disk image write failed on %u bytes at %lld",
(unsigned)count, (long long)current_offset));
+ return -1;
+ }
+
Index: patches/patch-iodev_network_netutil_cc
===================================================================
RCS file: patches/patch-iodev_network_netutil_cc
diff -N patches/patch-iodev_network_netutil_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-iodev_network_netutil_cc 12 Jun 2022 12:25:22 -0000
@@ -0,0 +1,21 @@
+fix format string
+
+Index: iodev/network/netutil.cc
+--- iodev/network/netutil.cc.orig
++++ iodev/network/netutil.cc
+@@ -1671,11 +1671,11 @@ void vnet_server_c::ftp_list_directory(tcp_conn_t *tcp
+ strftime(tmptime, 20, "%b %d %H:%M", localtime(&st.st_mtime));
+ }
+ if (S_ISDIR(st.st_mode)) {
+- sprintf(linebuf, "drwxrwxr-x 1 ftp ftp %ld %s %s%c%c",
st.st_size,
+- tmptime, dent->d_name, 13, 10);
++ sprintf(linebuf, "drwxrwxr-x 1 ftp ftp %lld %s %s%c%c",
++ (long long) st.st_size, tmptime, dent->d_name, 13, 10);
+ } else {
+- sprintf(linebuf, "-rw-rw-r-- 1 ftp ftp %ld %s %s%c%c",
st.st_size,
+- tmptime, dent->d_name, 13, 10);
++ sprintf(linebuf, "-rw-rw-r-- 1 ftp ftp %lld %s %s%c%c",
++ (long long)st.st_size, tmptime, dent->d_name, 13, 10);
+ }
+ }
+ } else {