I finally got this to work under Windows, but because of the amount of time I spent trying to make this work, I am compelled to share my experiences and comments on doing so. I don't want others to waste nearly as much time as I did trying to make this work.
I was initially unsure whether to make this thread under Tutorials or here. I settled for here because I wanted to also make some comments on the build scripts and compatibility. Prior to simply asking in the QBMS Errors thread if there was a Windows specific build script, I could find no mention of there being one on aluigi.altervista.org nor in this forum. Nor could I find any mention of a user having attempted to compile under Windows.
I'll spare most the experience of wandering in the dark trying to build using the makefile prior, but much of the changes I had to make with the makefile were present in that batch script already. For future reference to curious individuals: Don't try to build under Windows with the Makefile. It's hell and you'll waste more time chasing dubious compilation errors than you may want to admit.
For convenience, I'll quote aluigi's build script here:
I use a .bat file for doing the whole compiling job on Windows using gcc 4:http://aluigi.org/bms/compa.bat
I also made some minor edits to the script for convenience, readability, and a couple comments about compilation:
File comment: Slightly modified batch script to build quickbms in windows.
compile_quickbms.zip [2.51 KiB]
Downloaded 208 times
Some of the following might be common sense solutions for some readers, but I'd rather be thorough and complete than not.Potential Pitfalls1. Missing includes to library headers shipped with MinGW.
src\quickbms.c:172:14: fatal error: openssl/crypto.h: No such file or directory
For some reason this occurred with all
my MinGW installations. Headers and libs located in the opt directory aren't in the search paths by default (ie OpenSSL). As such, you may want to manually add opt\include and opt\lib paths to the compilation script.2. Missing includes for mcrypt and tomcrypt.
Add these include paths to the compilation script. (My modified script already has this addition.)
-Isrc\libs\libmcrypt -Isrc\libs\libtomcrypt3. Several "skipping incompatible" library errors while linking.
You're trying to use an x86_64 toolchain + libraries. Install the i686 toolchain and try with that.4. Failure to link xcompress.lib
ld.exe: xcompress.lib(obj/i386/lci.obj): warning: line number count (0x2) exceeds section size (0x1)
xcompress.lib(obj/i386/lci.obj): could not read symbols: Invalid operation
collect2.exe: error: ld returned 1 exit status
Don't use GCC 7 or newer. The library xcompress.lib will be incompatible with the binutils that are shipped with GNU GCC 7 and 8. If you're hellbent on using latest possible GCC toolchain, then use GCC 6.4.0. It will also work with GCC 5 and 4.5. Undefined reference to `BCrypt_init`
It's possible that bcrypt.h has been included by another file (possibly wincrypt.h). I've observed this in both GCC 5 and GCC 6. So, unless you're Mr. Aluigi himself or you actually are attempting to build and test on a Win98 machine... It should be satisfactory enough to make these two changes and add -lbcrypt
to the compilation script:
// In file /src/myenc.c : Comment out the mybcrypt include and use MinGW'sFinal Words
// [ ... About 110 lines below ... ]
//if(!BCrypt_init()) return -1; // The comment on this line in-file suggests only needed for Win98
Could you put the batch script in an easy-to-find location... Like the page for quickbms on your site.