#1196 enable compilation with cygwin gcc4

open
nobody
5
2013-11-11
2009-10-27
Anonymous
No

I tried to configure and compile Bochs latest CVS with gcc4 provided by cygwin (both Bochs CVS and cygwin downloaded today - 27/10/2009).

Using built-in specs.
Target: i686-pc-cygwin
Configured with: /gnu/gcc/package/gcc4-4.3.2-2/src/gcc-4.3.2/configure --srcdir=/gnu/gcc/package/gcc4-4.3.2-2/src/gcc-4.3.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/sbin --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --datadir=/usr/share --infodir=/usr/share/info --mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable-bootstrap --enable-version-specific-runtime-libs --with-slibdir=/usr/bin --libexecdir=/usr/lib --enable-static --enable-shared --enable-shared-libgcc --enable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,objc,obj-c++ --disable-symvers --enable-libjava --program-suffix=-4 --enable-libgomp --enable-libssp --enable-libada --enable-threads=posix AS=/opt/gcc-tools/bin/as.exe AS_FOR_TARGET=/opt/gcc-tools/bin/as.exe LD=/opt/gcc-tools/bin/ld.exe LD_FOR_TARGET=/opt/gcc-tools/bin/ld.exe
Thread model: posix
gcc version 4.3.2 20080827 (beta) 2 (GCC)

Problems:

  1. configure produced an error - C compiler cannot produce executables
    => to resolve had to remove -mno-cygwin option from configure script. I think proper solution is to add configure check for -mno-cygwin.

  2. crashed on compilation because MINGW32 wasn't defined. As result in config.h __int64 was undefined.
    bad code:

ifdef MINGW32

typedef unsigned long long Bit64u;
typedef signed long long Bit64s;

include types.h>

else

typedef unsigned int64 Bit64u;
typedef signed
int64 Bit64s;

endif

under #if defined WIN32

  1. in serial.cc -> everything required like it have no WIN32 defined.

ifndef WIN32

include socket.h>

include in.h>

include

define closesocket(s) close(s)

else

ifndef FILE_FLAG_FIRST_PIPE_INSTANCE

define FILE_FLAG_FIRST_PIPE_INSTANCE 0

endif

endif

but I've gor bunch of compilation errors without following lines:

include socket.h>

include in.h>

include

define closesocket(s) close(s)

  1. in win32.cc

win32.cc:147: warning: non-local variable ' bx_bitmaps [17]' uses anonymous type
win32.cc:187: warning: deprecated conversion from string constant to 'char'
win32.cc:188: warning: deprecated conversion from string constant to 'char
'
win32.cc:189: warning: deprecated conversion from string constant to 'char'
win32.cc: In member function 'virtual void bx_win32_gui_c::specific_init(int, char
, unsigned int, unsigned int, unsigned int)':
win32.cc:648: warning: deprecated conversion from string constant to 'char
'
win32.cc:649: warning: deprecated conversion from string constant to 'char'
win32.cc:650: warning: deprecated conversion from string constant to 'char
'
win32.cc:675: warning: deprecated conversion from string constant to 'char'
win32.cc:676: warning: deprecated conversion from string constant to 'char
'
win32.cc:677: warning: deprecated conversion from string constant to 'char'
win32.cc:716: error: '_beginthread' was not declared in this scope
win32.cc: In function 'void resize_main_window()':
win32.cc:778: warning: suggest parentheses around assignment used as truth value
win32.cc: In function 'void UIThread(void
)':
win32.cc:951: error: '_endthread' was not declared in this scope

  1. misc_mem.cc:

misc_mem.cc: In static member function 'static void bx_mem_c::load_ROM(const char, bx_phy_address, Bit8u)':
misc_mem.cc:308: error: '::close' has not been declared
misc_mem.cc:315: error: 'close' was not declared in this scope
misc_mem.cc:329: error: 'close' was not declared in this scope
misc_mem.cc:334: error: 'close' was not declared in this scope
misc_mem.cc:340: error: 'close' was not declared in this scope
misc_mem.cc:355: error: 'close' was not declared in this scope
misc_mem.cc:364: error: 'read' was not declared in this scope
misc_mem.cc:371: error: 'close' was not declared in this scope
misc_mem.cc: In static member function 'static void bx_mem_c::load_RAM(const char
, bx_phy_address, Bit8u)':
misc_mem.cc:423: error: 'read' was not declared in this scope
misc_mem.cc:430: error: 'close' was not declared in this scope

  1. floppy.cc:

floppy.cc: In static member function 'static void bx_floppy_ctrl_c::floppy_xfer(Bit8u, Bit32u, Bit8u, Bit32u, Bit8u)':
floppy.cc:1023: error: '_lseeki64' was not declared in this scope
floppy.cc:1057: error: '::read' has not been declared
floppy.cc:1102: error: '::write' has not been declared
floppy.cc: In member function 'virtual unsigned int bx_floppy_ctrl_c::set_media_status(unsigned int, unsigned int)':
floppy.cc:1416: error: 'close' was not declared in this scope
floppy.cc: In static member function 'static bx_bool bx_floppy_ctrl_c::evaluate_media(Bit8u, Bit8u, char
, floppy_t)':
floppy.cc:1498: error: 'close' was not declared in this scope
make:
** [floppy.o] Error 1

Similar problems in cmos.cc

....

Stanislav

Discussion

  • Volker Ruppert
    Volker Ruppert
    2013-11-11

    The compilation with gcc 4.x in Cygwin now works again. The symbols WIN32 needs to be defined again (it has been removed from configure script some time ago). For components usually including winsock.h the non-WIN32 code must be used to fix conflicts (serial port, rfb gui).