Page 1 of 2

I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 2:26 am
by Neolander
Hello everyone !

Until now, I was a happy Linux user. Sadly my new laptop's hardware is not yet supported by current desktop distros (I don't call support the current choice between a black back-lit screen and hanged computer at X startup on one hand, and marvelous 800x600 resolution on a wide screen on the other hand), so I'm more or less forced to get used to Windows 7 at the moment.

I hence installed Cygwin with a basic development setup, and successfully built my cross-compiling GCC and binutils. However, when it comes to building Bochs, configure crashes with the error message "configure:2775: error: C compiler cannot create executables"

Needless to say, this is just plain stupid. If GCC couldn't create executables, my builds of GCC and binutils would have failed. Moreover, if I try to write a very simple C program (int main() { return 0; }) and compile it with GCC, it just works.

Here is the config.log. Can somebody who is more experienced with Cygwin help me ?

Code: Select all

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure --with-win32 --enable-smp --enable-x86-64 --enable-vmx --enable-long-phy-address --enable-sb16=dummy --enable-ne2000 --enable-vbe --enable-clgd54xx --enable-all-optimizations --enable-debugger --enable-pci --enable-usb --enable-usb-ohci

## --------- ##
## Platform. ##
## --------- ##

hostname = Singularity
uname -m = i686
uname -r = 1.7.5(0.225/5/3)
uname -s = CYGWIN_NT-6.1-WOW64
uname -v = 2010-04-12 19:07

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = i686
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /cygdrive/c/Windows/system32
PATH: /cygdrive/c/Windows
PATH: /cygdrive/c/Windows/System32/Wbem
PATH: /cygdrive/c/Windows/System32/WindowsPowerShell/v1.0/
PATH: /usr/lib/lapack
PATH: /usr/local/cross/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2125: checking build system type
configure:2143: result: i686-pc-cygwin
configure:2165: checking host system type
configure:2180: result: i686-pc-cygwin
configure:2202: checking target system type
configure:2217: result: i686-pc-cygwin
configure:2246: checking if you are configuring for another platform
configure:2253: result: no
configure:2311: checking for standard CFLAGS on this platform
configure:2313: result: -mno-cygwin -DWIN32
configure:2382: checking for gcc
configure:2398: found /usr/bin/gcc
configure:2409: result: gcc
configure:2647: checking for C compiler version
configure:2654: gcc --version >&5
gcc (GCC) 4.3.4 20090804 (release) 1
Copyright (C) 2008 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.

configure:2657: $? = 0
configure:2664: gcc -v >&5
Using built-in specs.
Target: i686-pc-cygwin
Configured with: /gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4/configure --srcdir=/gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --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 --disable-__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 --with-arch=i686 --with-tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-4 CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind 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 --with-ecj-jar=/usr/share/java/ecj.jar
Thread model: posix
gcc version 4.3.4 20090804 (release) 1 (GCC) 
configure:2667: $? = 0
configure:2674: gcc -V >&5
gcc: '-V' option must have argument
configure:2677: $? = 1
configure:2700: checking for C compiler default output file name
configure:2727: gcc  -mno-cygwin -DWIN32  -mno-cygwin -DWIN32  conftest.c  >&5
gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler.

configure:2730: $? = 1
configure:2768: result: 
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2775: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-cygwin
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_F77_set=
ac_cv_env_F77_value=
ac_cv_env_FFLAGS_set=
ac_cv_env_FFLAGS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_XMKMF_set=
ac_cv_env_XMKMF_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=i686-pc-cygwin
ac_cv_prog_ac_ct_CC=gcc
ac_cv_target=i686-pc-cygwin

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR=''
BUILD_DOCBOOK_VAR=''
BXIMAGE_LINK_OPTS=''
BX_COMPRESSED_HD_SUPPORT=''
BX_SUPPORT_ACPI=''
BX_USE_IDLE_HACK=''
CC='gcc'
CDROM_OBJS=''
CD_UP_ONE=''
CD_UP_THREE=''
CD_UP_TWO=''
CFLAGS=' -mno-cygwin -DWIN32'
CFP=''
COMMAND_SEPARATOR=''
CPP=''
CPPFLAGS=' -mno-cygwin -DWIN32'
CPP_SUFFIX=''
CXX=''
CXXCPP=''
CXXFLAGS=' -mno-cygwin -DWIN32'
CXXFP=''
DASH=''
DEBUGGER_VAR=''
DEFINE_PLUGIN_PATH=''
DEFS=''
DEPMOD=''
DEVICE_LINK_OPTS=''
DIALOG_OBJS=''
DISASM_VAR=''
DOCBOOK2HTML=''
ECHO='echo'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENH_DBG_OBJS=''
EXE=''
EXEEXT=''
EXPORT_DYNAMIC=''
EXTERNAL_DEPENDENCY=''
EXTRA_BX_OBJS=''
EXTRA_LINK_OPTS=''
F77=''
FFLAGS=''
FPU_VAR=''
GAME_OBJS=''
GDBSTUB_VAR=''
GREP=''
GUI_CFLAGS=''
GUI_CXXFLAGS=''
GUI_LINK_OPTS=''
GUI_LINK_OPTS_TERM=''
GUI_LINK_OPTS_WX=''
GUI_NON_PLUGIN_OBJS=''
GUI_OBJS=''
GUI_PLUGIN_OBJS=''
GZIP=''
INLINE_VAR=''
INSMOD=''
INSTALL_DOCBOOK_VAR=''
INSTALL_LIST_FOR_PLATFORM=''
INSTALL_PLUGINS_VAR=''
INSTALL_TARGET=''
INSTRUMENT_DIR=''
INSTRUMENT_VAR=''
IODEBUG_OBJS=''
IODEV_LIB_VAR=''
IODEV_NON_PLUGIN_OBJS=''
IODEV_PLUGIN_OBJS=''
KERNELDIR=''
KERNEL_MODULE_SUFFIX=''
LDFLAGS=''
LIBADD_DL=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LINK=''
LINK_CONSOLE=''
LN_S=''
LSMOD=''
LTLIBOBJS=''
MAKELIB=''
NE2K_OBJS=''
NETLOW_OBJS=''
NONINLINE_VAR=''
NONPLUGIN_GUI_LINK_OPTS=''
OBJEXT=''
OBJS64=''
OFP=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PCIDEV_MODULE_MAKE_ALL=''
PCI_OBJ=''
PLUGIN_LIBNAME_TRANSFORMATION=''
PLUGIN_TARGET=''
PLUGIN_VAR=''
PRIMARY_TARGET=''
PTHREAD_CC=''
PTHREAD_CFLAGS=''
PTHREAD_LIBS=''
RANLIB=''
RC_CMD=''
READLINE_LIB=''
REL_STRING='Build from CVS snapshot, on April 25, 2010'
RFB_LIBS=''
RMCOMMAND=''
RMMOD=''
SB16_OBJS=''
SCSI_OBJS=''
SET_MAKE=''
SHELL='/bin/sh'
SLASH=''
SOUNDLOW_OBJS=''
SOUND_LINK_OPTS=''
STRIP=''
SUFFIX_LINE=''
TAR=''
TOOLKIT_CXXFLAGS=''
USBDEV_OBJS=''
VERSION='2.4.5'
VER_STRING='2.4.5'
WGET=''
WIN_VER_STRING='2, 4, 5, 0'
WX_CFLAGS=''
WX_CONFIG=''
WX_CXXFLAGS=''
XMKMF=''
XPM_LIB=''
X_CFLAGS=''
X_EXTRA_LIBS=''
X_LIBS=''
X_PRE_LIBS=''
ac_ct_CC='gcc'
ac_ct_CXX=''
ac_ct_F77=''
bindir='${exec_prefix}/bin'
build='i686-pc-cygwin'
build_alias=''
build_cpu='i686'
build_os='cygwin'
build_vendor='pc'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host='i686-pc-cygwin'
host_alias=''
host_cpu='i686'
host_os='cygwin'
host_vendor='pc'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='i686-pc-cygwin'
target_alias=''
target_cpu='i686'
target_os='cygwin'
target_vendor='pc'

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""

configure: exit 77

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 2:48 am
by gerryg400
configure:2775: error: C compiler cannot create executables
See `config.log' for more details.

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 2:58 am
by Neolander
gerryg400 wrote:
configure:2775: error: C compiler cannot create executables
See `config.log' for more details.
Do you mean you want the config.log file ? But you just rode it ! ^^'

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:04 am
by gerryg400
Ooops, sorry Neolander. I forgot it puts that message inside itself.

Configure gives that message if it can't compile one or any of its test programs. Often it's because of a gcc build option not being supported.

Code: Select all

configure:2700: checking for C compiler default output file name
configure:2727: gcc  -mno-cygwin -DWIN32  -mno-cygwin -DWIN32  conftest.c  >&5
gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler.

configure:2730: $? = 1
configure:2768: result: 
configure: failed program was:
Is that -mno-cygwin correct ?

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:12 am
by Neolander
I think the interesting part is here :

Code: Select all

configure:2727: gcc  -mno-cygwin -DWIN32  -mno-cygwin -DWIN32  conftest.c  >&5
gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler.
1/It puts the mno-cygwin and -DWIN32 options twice. Why ?
2/Why is the mno-cygwin flag is unsupported ? Why is it even there ? It looks just wrong in this context, according to the doc on the subject which I've found :
The idea is quite simple -- the default compilation
mode is "cygwin", and the compiler by default looks for header files
that are Cygwin specific and also links in the Cygwin runtime libraries.
When instead you specify -mno-cygwin, the development tools instead look
for Mingw32 headers and links in the Mingw32 runtime libraries.
EDIT : You've been faster than me. Let's put a third question :P
3/If this mno-cygwin flag is wrong, how do I remove it ? Can this work by adding an option to the config script or setting an environment variable ? Otherwise, which file do I edit ?

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:16 am
by gerryg400
configure:2311: checking for standard CFLAGS on this platform
configure:2313: result: -mno-cygwin -DWIN32
c
See this line? Not sure where it gets the CFLAGS on the platform. Maybe you can override them.

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:27 am
by gerryg400
CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind 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 --with-ecj-
Are you getting gcc and ld from different paths ? Do you have 2 gcc's installed?

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:39 am
by Neolander
gerryg400 wrote:
CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind 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 --with-ecj-
Are you getting gcc and ld from different paths ? Do you have 2 gcc's installed?
As far as I know, the only two GCCs that exist on that system is the one from cygwin and my cross-compiler, which is not present here.
Going to check if that's true...

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:43 am
by Solar
The joys of changing interfaces.

Cygwin GCC supported -mno-cygwin, so Bochs used it. Newer versions of Cygwin GCC no longer support -mno-cygwin, but Bochs still uses it.

You are not alone.

Try what that blogger did, try some more, and if it doesn't work, go over to bochs.org and start buggering them about it so they update their configure scripts.

Expect to meet some attitude. Those Open Sourcers don't really like it when they have to do something because of somebody else, and quite frequently start pointing fingers instead of getting their act together and fixing the mess. 8)

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:49 am
by fronty
Or even better, send patch.

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 3:54 am
by Neolander
Solar wrote:The joys of changing interfaces.

Cygwin GCC supported -mno-cygwin, so Bochs used it. Newer versions of Cygwin GCC no longer support -mno-cygwin, but Bochs still uses it.

You are not alone.

Try what that blogger did, try some more, and if it doesn't work, go over to bochs.org and start buggering them about it so they update their configure scripts.

Expect to meet some attitude. Those Open Sourcers don't really like it when they have to do something because of somebody else, and quite frequently start pointing fingers instead of getting their act together and fixing the mess. 8)
Even if said script is seriously outdated ? It seems to me that it doesn't detect the target properly. If it has found CYGWIN written somewhere in capitals, it should build for Cygwin. -mno-cygwin is an option for those MSYS users who want to make BSD-licensed software which doesn't rely on cygwin's libs. In the case of building bochs, which is LGPL'd, this is a highly questionable behavior...

Well, guess I'm going to stop ranting and hunt the mno-cygwin everywhere in the various files available...
fronty wrote:Or even better, send patch.
I think I'm not familiar enough with the automake/autoconf/configure/and so on toolchain to do that. Never got motivated enough to learn about it, when I want to build software, I generally just use gcc file.c, with maybe a pkg-config here and there, and it just works. OSdeving made me learn about using intermediary object files and LD scripts, plus get some notion of shell scripting, and that's about all...

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 4:18 am
by Neolander
Well, found out how to tweak configure.

For those who wonder, there is somewhere a section which begins with a "*-pc-mingw32* | *-pc-cygwin*)" and which sets some flags.
This basically means that both are considered to work the same way as far as compilation flags are concerned, which is perfectly untrue.

I hence split this section, getting a *-pc-mingw32*) section and a *-pc-cygwin*) section. In the *-pc-cygwin*) section, I removed the -mno-cygwin flag. Now, configure works. This is a very hackish patch that's probably not suitable for merge into Bochs' trunk, but maybe the Bochs team could make something useful from that...

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 4:52 am
by -m32
Mostly off topic but...

Since your problem was no Linux on your laptop, why not just run Linux inside a VM (like Virtual Box)? This is what I do (with Fedora 13). The main reason I do it this way is because GCC under Windows 7 x64/Cgygwin is EXTREMELY slow. It takes *at least* 20s to compile each source file (even one liners) - meaning, the bigger the file, the longer it takes (and my machine is by no means slow). Plus, if you have to cross-compile GCC to run on Cygwin in the first place, it will take *hours* to complete.

There's no problem running Bochs/Qemu in a VirtualBox guest. You can't run VirtualBox inside a VirtualBox Linux guest, but it's easy to get around that. I just use a USB flash drive in windows, set up file-sharing, and smbmount (actually mount -t cifs) it within the guest so that files can be copied to it. Then, spark up another VirtualBox guest in the Windows host that has raw disk access on the USB device.

That way you get the nice Linux environment and can still have access to your Windows environment. It works really well for me.

Just a suggestion.... ;)

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 5:46 am
by Neolander
Well, now it configures, but it does not make. The output looks very strange...
nonsense.PNG
-m32 wrote:Mostly off topic but...

Since your problem was no Linux on your laptop, why not just run Linux inside a VM (like Virtual Box)? This is what I do (with Fedora 13). The main reason I do it this way is because GCC under Windows 7 x64/Cgygwin is EXTREMELY slow. It takes *at least* 20s to compile each source file (even one liners) - meaning, the bigger the file, the longer it takes (and my machine is by no means slow). Plus, if you have to cross-compile GCC to run on Cygwin in the first place, it will take *hours* to complete.

There's no problem running Bochs/Qemu in a VirtualBox guest. You can't run VirtualBox inside a VirtualBox Linux guest, but it's easy to get around that. I just use a USB flash drive in windows, set up file-sharing, and smbmount (actually mount -t cifs) it within the guest so that files can be copied to it. Then, spark up another VirtualBox guest in the Windows host that has raw disk access on the USB device.

That way you get the nice Linux environment and can still have access to your Windows environment. It works really well for me.

Just a suggestion.... ;)
Well, I wanted to first try cygwin, because having to run a virtual machine + set up some linux distro on top of it sounded a bit like overkill when all I wanted was a POSIX environment. If it continues to go that bad, I might be forced to do so, though...

Re: I can't get bochs to compile under cygwin.

Posted: Wed Jun 23, 2010 5:59 am
by Owen
You're compiling it with Cygwin GCC. It doesn't expect that - use MinGW!