Bug#903476: bochs FTCBFS: multiple reasons
Source: bochs
Version: 2.6-6
Tags: patch upstream
User: helmutg@debian.org
Usertags: rebootstrap
bochs fails to cross build from source. There are a number of individual
causes all rooted in the upstream build system. The attached patch fixes
all of them. Let me go into detail:
* The immediate failure is use of AC_TRY_RUN. Running host code is not
possible during cross compilation, so AC_TRY_RUN cannot be used. It
turns out that the relevant checks will typically fail linking or
succeed running though, so replacing them with AC_TRY_LINK is
sufficient here.
* The next failure is with finding gtk headers. Actually ./configure
failed way earlier to report that it couldn't find gtk with the build
architecture pkg-config. Using the PKG_PROG_PKG_CONFIG macro one gets
the host architecture pkg-config and suddenly it finds all the .pc
files.
* Finally the generated Makefile lists -lltdl (via @PLUGIN_VAR@) as a
Makefile dependency. That causes make to look up libltdl.so in its
library search path. As we are using the build architecture
make-dfsg, that's the build architecture search path and it'll fail
finding the library giving up on missing dependencies. That's
actually why make is not marked Multi-Arch: foreign. We must avoid
using path lookup in make and the easiest way of doing so is
filtering out dependencies on system libraries. System libraries
cannot be changed by the build system anyway.
The patch makes bochs cross buildable. Please consider applying it.
Helmut
--- bochs-2.6.orig/configure.in
+++ bochs-2.6/configure.in
@@ -130,8 +130,8 @@
AC_LIB_LTDL
fi
-AC_PATH_PROG(PKGCONFIG, pkg-config, not_found)
-if test "$PKGCONFIG" = not_found; then
+PKG_PROG_PKG_CONFIG
+if test "x$PKG_CONFIG" = x; then
AC_PATH_XTRA
fi
@@ -1293,10 +1293,10 @@
AC_MSG_CHECKING(if readline works without -lcurses)
OLD_LIBS=$LIBS
LIBS="$LIBS -lreadline"
- AC_TRY_RUN([
+ AC_TRY_LINK([
#include <stdio.h>
#include <readline/readline.h>
- int main() { rl_initialize(); exit(0); }
+ ],[ rl_initialize();
],
[ AC_MSG_RESULT(yes)
rl_without_curses_ok=yes ],
@@ -1304,10 +1304,10 @@
)
AC_MSG_CHECKING(if readline works with -lcurses)
LIBS="$LIBS -lcurses"
- AC_TRY_RUN([
+ AC_TRY_LINK([
#include <stdio.h>
#include <readline/readline.h>
- int main() { rl_initialize(); exit(0); }
+ ],[ rl_initialize();
],
[AC_MSG_RESULT(yes)
rl_with_curses_ok=yes ],
@@ -2075,9 +2075,9 @@
])
fi
- if test "$PKGCONFIG" != not_found; then
- X_CFLAGS="`pkg-config --cflags x11`"
- X_LIBS="`pkg-config --libs x11` $XPM_LIB -lXrandr"
+ if test "x$PKG_CONFIG" != x; then
+ X_CFLAGS="`$PKG_CONFIG --cflags x11`"
+ X_LIBS="`$PKG_CONFIG --libs x11` $XPM_LIB -lXrandr"
else
X_LIBS="$X_LIBS -lX11 $XPM_LIB -lXrandr"
fi
@@ -2217,7 +2217,7 @@
WX_CFLAGS="`$WX_CONFIG --cflags`"
WX_CXXFLAGS="`$WX_CONFIG --cxxflags`"
if test "$wx_needs_gdk2" = 1; then
- GDK_CFLAGS="`pkg-config --cflags gdk-2.0`"
+ GDK_CFLAGS="`$PKG_CONFIG --cflags gdk-2.0`"
WX_CFLAGS="$WX_CFLAGS $GDK_CFLAGS"
WX_CXXFLAGS="$WX_CXXFLAGS $GDK_CFLAGS"
fi
@@ -2271,9 +2271,9 @@
# some display libraries and the enhanced debugger may depend on the GTK+ software package
if test "$needs_gtk2" = 1; then
# pkg-config is required to set TOOLKIT_CXXFLAGS and LIBS
- if test "$PKGCONFIG" != not_found; then
- TOOLKIT_CXXFLAGS="`pkg-config --cflags gtk+-2.0`"
- LIBS="$LIBS `pkg-config --libs gtk+-2.0`"
+ if test "x$PKG_CONFIG" != x; then
+ TOOLKIT_CXXFLAGS="`$PKG_CONFIG --cflags gtk+-2.0`"
+ LIBS="$LIBS `$PKG_CONFIG --libs gtk+-2.0`"
else
echo "ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package."
echo "Install pkg-config and the gtk+ development package,"
--- bochs-2.6.orig/Makefile.in
+++ bochs-2.6/Makefile.in
@@ -176,7 +176,7 @@
bochs@EXE@: @IODEV_LIB_VAR@ @HDIMAGE_LIB_VAR@ @USB_LIB_VAR@ @NETWORK_LIB_VAR@ @SOUND_LIB_VAR@ \
@DEBUGGER_VAR@ cpu/libcpu.a cpu/cpudb/libcpudb.a memory/libmemory.a \
gui/libgui.a @DISASM_VAR@ @INSTRUMENT_VAR@ $(BX_OBJS) \
- $(SIMX86_OBJS) @FPU_VAR@ @GDBSTUB_VAR@ @PLUGIN_VAR@
+ $(SIMX86_OBJS) @FPU_VAR@ @GDBSTUB_VAR@ $(filter-out -l%,@PLUGIN_VAR@)
@LINK@ @EXPORT_DYNAMIC@ $(BX_OBJS) $(SIMX86_OBJS) \
@IODEV_LIB_VAR@ @HDIMAGE_LIB_VAR@ @USB_LIB_VAR@ @NETWORK_LIB_VAR@ @SOUND_LIB_VAR@ \
@DEBUGGER_VAR@ cpu/libcpu.a cpu/cpudb/libcpudb.a \
Reply to: