[Vm-dev] attempting to build BochsX64Plugin on 32-bit Ubuntu

Robert Withers robert.w.withers at gmail.com
Mon Oct 26 00:39:29 UTC 2015


Yes, Eliot, I see what you are saying...

On 10/25/2015 07:47 PM, Eliot Miranda wrote:
>   
>
>
> Hi Robert,
>
> On Sun, Oct 25, 2015 at 12:05 PM, Robert Withers 
> <robert.w.withers at gmail.com <mailto:robert.w.withers at gmail.com>> wrote:
>
>
>     Eliot, thank you for that orientation. I looked at your mac but
>     had to go one more step. I realized I probably couldn't build both
>     BochsIA32Plugin and BochsX64Plugin at the same time while sharing
>     the processors/IA32 support code - it is compiled separately for
>     IA32 and X64. So I added a processors/X64 directory, with a
>     seaparate copy of Bochs for 64-bit emulation, built the libs with
>     your conf.COG from mac, and built both Bochs plugins. I am
>     attaching the link to BochsX64Plugin for 32-bit linux:
>     https://www.dropbox.com/s/g73feosuzlx45le/BochsX64Plugin.11-25-2015.tgz?dl=0
>
>
> You definitely /don't/ need a separate copy and /can/ use the IA32 
> Bochs sources.  It works fine.  That's what I've been doing.  Look at 
> the conf.COG files.  They differ only in configure options.  They 
> build all objects locally, taking only source from processors/IA32/bochs

What confused me was the location for the generated libs. They are put 
in subdirectories of the directory where conf.COG is run from.

So I reflected what you did and created bochs86 and bochs64 in the 
build.linux32x86 directory, copied conf.COG for 32-bits to bochs86, 
copied conf.COG for 64-bits to bochs64, ran each conf.COG and makeem and 
the libs are in these subdirectories, one set for 86 and one set for 64. 
So only one installation of Bochs.

My issue occurs when I mvm the build. The BochsIA32Plugin/BochsX64Plugin 
blow up trying to read bochsconfig.h from bochs.h, where bochs.h is in 
the bochs directorory of the processor code and the bochsconfig.h is in 
the bochs86/bochs64 directory under the main build directory 
(build.linux32x86).

What is confusing is that these blochs86 and bochs64 directories are 
included in the path: 
-I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build/../../bochs86 
and 
-I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build/../../bochs64, 
yet they are not found when #include "bochsconfig.h" is specified in 
bochs.h.  Is this due to having the headers in totally different 
directories?

Would you know what to make of this?

Regards,
Robert

g++ -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2 -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64 -DCOGMTVM=0 -DLSB_FIRST=1 -m32 -DHAVE_CONFIG_H 
-I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build 
-I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build 
-I/home/rabbit/warren/oscogvm/platforms/unix/vm 
-I/home/rabbit/warren/oscogvm/platforms/Cross/vm 
-I/home/rabbit/warren/oscogvm/spursrc/vm 
-I/home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsIA32Plugin 
-m32 -DUSE_BOCHS_CONFIG_H=1 
-I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build/../../bochs86 
-I/home/rabbit/warren/oscogvm/processors/IA32/bochs 
-I/home/rabbit/warren/oscogvm/processors/IA32/bochs/instrument/stubs -c 
/home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsIA32Plugin/sqBochsIA32Plugin.cpp 
-fPIC -DPIC -DPIC -o sqBochsIA32Plugin.o
In file included from 
/home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsIA32Plugin/sqBochsIA32Plugin.cpp:7:0:
/home/rabbit/warren/oscogvm/processors/IA32/bochs/bochs.h:38:79: fatal 
error: bochsconfig.h: No such file or directory
  # include "bochsconfig.h" /* generated by configure script from 
config.h.in */
^
compilation terminated.
make[1]: *** [sqBochsIA32Plugin.lo] Error 1
make: *** [BochsIA32Plugin.la] Error 2

> oscogvm$ diff build.macos32x86/bochsx*/conf.COG
> 3,4c3,4
> < # Bochs x64 simulator for the BochsX64Alien plugin.
> < # this sets up the x64 compile for Cog on Mac OS X.  Disable as much 
> inessential
> ---
> > # Bochs x86 simulator for the BochsIA32Alien plugin.
> > # this sets up the x86 compile for Cog on Mac OS X.  Disable as much 
> inessential
> 32,33c32,35
> < --enable-x86-64 \
> < --enable-global-pages \
> ---
> > --disable-x86-64 \
> > --disable-pae \
> > --disable-large-pages \
> > --disable-global-pages \
> oscogvm$ cat build.macos32x86/bochsx64/conf.COG
> #!/bin/sh
>
> # Bochs x64 simulator for the BochsX64Alien plugin.
> # this sets up the x64 compile for Cog on Mac OS X. Disable as much 
> inessential
> # stuff as possible leaving only the cpu/fpu & memory interface
>
> # build cpu/libcpu.a disasm/libdisasm.a fpu/libfpu.a using
> # $ ./conf.COG
> # $ ../../processors/IA32/bochs/makeem
>
> set echo
> # CFLAGS="-pipe -O3 -fomit-frame-pointer -finline-functions 
> -falign-loops=16 -falign-jumps=16 -falign-functions=16 
> -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 
> -fprefetch-loop-arrays $CFLAGS"
> CFLAGS="-m32 $CFLAGS"
> CFLAGS="-Dlongjmp=_longjmp -Dsetjmp=_setjmp $CFLAGS"
> CFLAGS="-pipe -O3 -fomit-frame-pointer -finline-functions $CFLAGS"
> CFLAGS="-g $CFLAGS"
> CPPFLAGS=""
> CXXFLAGS="$CFLAGS"
>
> export CFLAGS
> export CPATH
> export CPPFLAGS
> export CXXFLAGS
> export LDFLAGS
>
> ../../processors/IA32/bochs/configure \
> --enable-Cog \
> --enable-cpu-level=6 \
> --enable-sse=2 \
> --enable-assert-checks \
> --with-nogui \
> --enable-x86-64 \
> --enable-global-pages \
> --disable-mtrr \
> --disable-sb16 \
> --disable-ne2000 \
> --disable-pci \
> --disable-acpi \
> --disable-apic \
> --disable-clgd54xx \
> --disable-usb \
> --disable-plugins \
> ${CONFIGURE_ARGS}
>
> # apic == Advanced programmable Interrupt Controller
> # acpi == Advanced Configuration and Power Interface
> # pci == Peripheral Component Interconnect local bus
> # clgd54xx == Cirrus Logic GD54xx video card
>
> # avoid conflict with squeak unix build's config.h
> echo cp config.h bochsconfig.h
> cp config.h bochsconfig.h
>
> echo "and don't forget to run ../../processors/IA32/bochs/makeem"
>
>
>
>     Best,
>     Robert
>
>     ... ^^
>
>     On 10/24/2015 11:54 PM, Eliot Miranda wrote:
>>       
>>
>>
>>     Hi Rob,
>>
>>         I've only tried to build it in Mac OS X. I've also changed
>>     the build structure so one /can/ build it either in 32 or 64
>>     bits.  So look at the structure for building the support
>>     libraries under build.macos32x86 and replicate it under
>>     build.linux32x86, write or change
>>     platforms/unix/plugins/BochsX64Plugin/Makefile to pick up the
>>     libraries from (IIRC)
>>     build.linux32x86/bochsx64/{cpu/libcpu.a,disasm/libdisasm.a,fpu/libfpu.a}
>>     and you should be fine.  You'll need to
>>     run build.linux32x86/bochsx64/conf.COG which you'll copy
>>     from build.macos32x86/bochsx64/conf.COG
>>
>>     _,,,^..^,,,_ (phone)
>>
>>     On Oct 24, 2015, at 5:59 PM, Robert Withers
>>     <robert.w.withers at gmail.com <mailto:robert.w.withers at gmail.com>>
>>     wrote:
>>
>>>     Is it possible I need 64-bit headers/libraries on the 32-bit
>>>     Ubuntu when compiling BochsX64Plugin? Here a line I am receiving
>>>     an error for and it is for 64-bits:
>>>
>>>     from sqBochsX64Plugin.cpp, line 68:
>>>     bx_cpu.sregs[BX_SEG_REG_CS].cache.u.segment.l = 1; // 64-bit seg
>>>
>>>     resulting in error, below.
>>>
>>>
>>>     On 10/23/2015 01:49 PM, Eliot Miranda wrote:
>>>>       
>>>>
>>>>
>>>>
>>>>
>>>>     On Wed, Oct 21, 2015 at 7:26 PM, Robert Withers
>>>>     <robert.w.withers at gmail.com
>>>>     <mailto:robert.w.withers at gmail.com>> wrote:
>>>>
>>>>
>>>>         I am not sure it is possible, even. Can this plugin be
>>>>         build 32-bit; does it make any sense to do so?
>>>>
>>>>
>>>>     yes.  How on earth can the 64-bit Cogit be created if this
>>>>     plugin can't be built in 32-bits?  I'm using it on Mac OS X in
>>>>     32-bits using a 32-bit VM.
>>>>
>>>>
>>>>         Here is the make portion of this attempt for this plugin. I
>>>>         am unsure how to deal with this C++ issue in the
>>>>         Cross/plugins/BochsX64Plugin/sqUnixBochsX64Plugin.cpp file.
>>>>
>>>>
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:
>>>>         In function 'int resetCPU(void*)':
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:68:47:
>>>>         error: 'struct bx_descriptor_t::<anonymous
>>>>         union>::<anonymous>' has no member named 'l'
>>>>          bx_cpu.sregs[BX_SEG_REG_CS].cache.u.segment.l    = 1; //
>>>>         64-bit seg
>>>>
>>>>
>>>>         Thank you,
>>>>         Robert
>>>>
>>>>
>>>>         /bin/bash
>>>>         /home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build/libtool
>>>>         --mode=compile gcc -m32 -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2
>>>>         -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0
>>>>         -DLSB_FIRST=1 -m32 -DHAVE_CONFIG_H
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/platforms/unix/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/vm
>>>>         -I/home/rabbit/warren/oscogvm/spursrc/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin
>>>>         -m32 -DUSE_BOCHS_CONFIG_H=1
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/linuxbochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs/instrument/stubs
>>>>         -c -o BochsX64Plugin.lo
>>>>         /home/rabbit/warren/oscogvm/src/plugins/BochsX64Plugin/BochsX64Plugin.c
>>>>         gcc -m32 -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2 -D_GNU_SOURCE
>>>>         -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0 -DLSB_FIRST=1 -m32
>>>>         -DHAVE_CONFIG_H
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/platforms/unix/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/vm
>>>>         -I/home/rabbit/warren/oscogvm/spursrc/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin
>>>>         -m32 -DUSE_BOCHS_CONFIG_H=1
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/linuxbochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs/instrument/stubs
>>>>         -c
>>>>         /home/rabbit/warren/oscogvm/src/plugins/BochsX64Plugin/BochsX64Plugin.c
>>>>         -fPIC -DPIC -DPIC -o BochsX64Plugin.o
>>>>         mv -f BochsX64Plugin.o BochsX64Plugin.lo
>>>>         /bin/bash
>>>>         /home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build/libtool
>>>>         --mode=compile g++ -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2
>>>>         -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0
>>>>         -DLSB_FIRST=1  -m32 -DHAVE_CONFIG_H
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/platforms/unix/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/vm
>>>>         -I/home/rabbit/warren/oscogvm/spursrc/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin
>>>>         -m32 -DUSE_BOCHS_CONFIG_H=1
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/linuxbochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs/instrument/stubs
>>>>         -c -o sqBochsX64Plugin.lo
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp
>>>>         g++ -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2 -D_GNU_SOURCE
>>>>         -D_FILE_OFFSET_BITS=64 -DCOGMTVM=0 -DLSB_FIRST=1 -m32
>>>>         -DHAVE_CONFIG_H
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/build.linux32x86/squeak.cog.spur/build
>>>>         -I/home/rabbit/warren/oscogvm/platforms/unix/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/vm
>>>>         -I/home/rabbit/warren/oscogvm/spursrc/vm
>>>>         -I/home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin
>>>>         -m32 -DUSE_BOCHS_CONFIG_H=1
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/linuxbochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs
>>>>         -I/home/rabbit/warren/oscogvm/processors/IA32/bochs/instrument/stubs
>>>>         -c
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp
>>>>         -fPIC -DPIC -DPIC -o sqBochsX64Plugin.o
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:17:0:
>>>>         warning: "setjmp" redefined [enabled by default]
>>>>          # define setjmp(jb) _setjmp(jb)
>>>>          ^
>>>>         In file included from
>>>>         /home/rabbit/warren/oscogvm/processors/IA32/bochs/gui/siminterface.h:1069:0,
>>>>                          from
>>>>         /home/rabbit/warren/oscogvm/processors/IA32/bochs/bochs.h:117,
>>>>                          from
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:7:
>>>>         /usr/include/setjmp.h:67:0: note: this is the location of
>>>>         the previous definition
>>>>          #define setjmp(env) _setjmp (env)
>>>>          ^
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:
>>>>         In function 'int resetCPU(void*)':
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:68:47:
>>>>         error: 'struct bx_descriptor_t::<anonymous
>>>>         union>::<anonymous>' has no member named 'l'
>>>>          bx_cpu.sregs[BX_SEG_REG_CS].cache.u.segment.l    = 1; //
>>>>         64-bit seg
>>>>                ^
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:74:47:
>>>>         error: 'struct bx_descriptor_t::<anonymous
>>>>         union>::<anonymous>' has no member named 'l'
>>>>          bx_cpu.sregs[BX_SEG_REG_DS].cache.u.segment.l    = 1; //
>>>>         64-bit seg
>>>>                ^
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:80:47:
>>>>         error: 'struct bx_descriptor_t::<anonymous
>>>>         union>::<anonymous>' has no member named 'l'
>>>>          bx_cpu.sregs[BX_SEG_REG_SS].cache.u.segment.l    = 1; //
>>>>         64-bit seg
>>>>                ^
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:101:10:
>>>>         error: 'class bx_cpu_c' has no member named 'efer'
>>>>            bx_cpu.efer.set_LMA(1); /* Hack.  The old version we use
>>>>         have doesn't support set_EFER */
>>>>                   ^
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:
>>>>         In function 'int disassembleForAtInSize(void*, ulong,
>>>>         void*, ulong)':
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:213:52:
>>>>         error: 'struct bx_descriptor_t::<anonymous
>>>>         union>::<anonymous>' has no member named 'l'
>>>>         anx64->sregs[BX_SEG_REG_CS].cache.u.segment.l,
>>>>                     ^
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:
>>>>         At global scope:
>>>>         /home/rabbit/warren/oscogvm/platforms/Cross/plugins/BochsX64Plugin/sqBochsX64Plugin.cpp:324:39:
>>>>         error: no 'void bx_cpu_c::TLB_flushNonGlobal()' member
>>>>         function declared in class 'bx_cpu_c'
>>>>          void BX_CPU_C::TLB_flushNonGlobal(void)
>>>>                                                ^
>>>>         make[1]: *** [sqBochsX64Plugin.lo] Error 1
>>>>         make: *** [BochsX64Plugin.la] Error 2
>>>>         rabbit at rabbithole:~/warren/oscogvm/build.linux32x86/squeak.cog.spur/build$
>>>>         <mailto:rabbit at rabbithole:%7E/warren/oscogvm/build.linux32x86/squeak.cog.spur/build$>
>>>>         mv -f BochsX64Plugin.o BochsX64Plugin.lo
>>>>         mv: cannot stat ‘BochsX64Plugin.o’: No such file or directory
>>>>
>>>>
>>>>
>>>>
>>>>     -- 
>>>>     _,,,^..^,,,_
>>>>     best, Eliot
>>>
>
>
>
>
>
> -- 
> _,,,^..^,,,_
> best, Eliot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20151025/6cf56aa8/attachment-0001.htm


More information about the Vm-dev mailing list