issues compiling bochs under msys2/m ingw and vs2013

Андрей Любченко <[email protected]> Thu, 18 May 2017 21:09:09 +0300
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <[email protected]>
Hi, Masters!

Trying to compile Bochs 2.6.9 from source under Windows 7 32bit and 64bit using both MSYS2/mingw32 and VS2013 environments, I've encountered discrepancy from the way described in the docs, mostly concerning bxhub.

1. Running configure or .config.win32-cygwin scripts under MSYS2 produces incorrect Makefile which fails to link misc/bxhub.o, misc/netutil.o into bxhub.exe reporting unresolved globals such as imp__WSAStartup, _imp__WSACleanup, _imp__socket, _imp__sendto and others which clearly witness that somewhere in the configure script a winsock2 library reference is missed. Exploring this script contents I've found a case "$target" statement which branches compilation of bxhub depending on the compiling environment. This case statement has a target branch *-pc-mingw*), while config.log file says target='i686-w64-mingw32'. This leads to the default *) branch which does not contain any definition for BXHUB_LINK_OPTS and hence ld does not link ws2_32 library. After replacing “-pc-“ substring with a lone hyphen (“-“) in the *-pc-mingw*) branch the script correctly configures link option for bxhub as BXHUB_LINK_OPTS="-lws2_32" and subsequent compilation succeeds. I noticed many other “-pc-“ substrings in the target definitions too.

2. Successful compilation under MSYS2/mingw32 makes the desired bochs.exe, but alas! it can be run only in the same MSYS2 environment. Running it in pure Windows environment brings up a system error window complaining that some libgcc_s_dw2-1.dll or alike library is missed. To avoid this error the .conf.win32-cygwin (or any inherited) script should be changed manually. The CFLAGS variable should contain a "-static" command line key, like this CFLAGS="-O3 -Wall -Wno-format -mno-ms-bitfields -static". This key tells the linker to link in statically any libraries at compilation time instead of dynamic linking at run time.

3. Trying to compile under VS2013 either bochs-2.6.9-msvc-src.zip source or the zip-archive made in MSYS2 with wint.conf.win32-vcpp and make win32_snap scripts surprisingly leads to the same unresolved symbols as in the above case, even though config.log says that target='i586-pc-windows' and BXHUB_LINK_OPTS="ws2_32.lib", but now it won't help, I don’t know why. This may be managed by opening Solution Explorer in VS2013 IDE, right-clicking bxhub project in the list of projects, selecting Properties, opening option tabs Linker - Input and here Additional Dependencies parameter and manually adding a “ws2_32.lib” reference somewhere in the string, deliberately separating it with semicolons from other options.

Yours,
andrei
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
bochs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bochs-developers