HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
.i.e., the PCI\ USB\ HID\ branches of a Device Instance ID path all originate from ControlSet\Enum.
We're full of IT!
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
.*.sh -crlf *.ac -crlf *.am -crlf
./pi.sh
and follow the prompts-m32
& -m64
, to produce either 32 or 64 bit Windows binaries), as well as static and shared library generation on a Linux host platform, using the current latest official versions of everything. Most of what I'm going to describe is based on the mingw-w64-howto-build guides that one can find here, with fixes added. This guide is intended to be fairly generic, so that you can use it as a base for more specific settings.svn co https://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64 mingw-w64Another prerequisite that you shouldn't overlook is, since the compilation process is fraught with disappointments and restarts, the fastest and the more cores your CPU is/has, the better. Better try that process on the fastest Linux machine you can get your hands on first, and once you're satisfied that your compilation should work, do it on a slower machine if that's your final target.
mv mpfr-3.0.0/ gcc-4.5.0/mpfr mv gmp-4.3.2/ gcc-4.5.0/gmp mv mpc-0.8.2/ gcc-4.5.0/mpcOnce this is done, this is the content you should have in your working directory:
binutils-2.20.1/ binutils-2.20.1.tar.bz2 gcc-4.5.0/ gcc-4.5.0.tar.bz2 gmp-5.0.1.tar.bz2 mingw-w64/ mpc-0.8.2.tar.gz mpfr-3.0.0.tar.bz2
/usr/local
as their base (specific MinGW-w64 subdirectories will be created, don't worry). The only option I'm going to consistently add when running the versions configure is the --disable-nls
to try to speed up things a little bit by disabling non Western language support.binutils-build
) in our working space for each source we need to go through.make
(-j
) to considerably speed up the whole compilation process. The rule of thumb is to use j#
with # being the number of cores you have at your disposal (altough I've also seen people doubling that number). Hence, almost every make
command we call below will be affixed with -j4
.--build=<build-machine-triplet>
all over the place, but most of the scripts we use are smart enough to detect cross compilation, so this is not necessary. You might see some warnings about --build
not being specified, but you shouldn't worry too much about them.-j
on make (but even without, weird things happen), so if your make process generates an error for any reason, the first thing to try is make again, to see if things get further. Even without -j
, it sometimes takes 2 or 3 passes to get a specific section of the compilation working.mkdir binutils-build; cd binutils-build ../binutils-2.20.1/configure --disable-nls --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32 make -j4 make installIn the above, the
--target indicates
that we ultimately want to produce a MinGW compiler that can produce x86_64 binaries (i.e. MinGW-w64), and the --enable-targets
with 2 parameters is for multilib support, with 64 (x86_64) and 32 (i686) bit.The end result of all this is that you should get a bunch of x86_64-w64-mingw32
binaries into /usr/local/bin
(ar, ld, etc)trunk/
but the one from trunk/mingw-w64-headers/
. If you try to run the configure from trunk/
at this stage, of course it will fail.cd ..; mkdir mingw-build; cd mingw-build ../mingw-w64/trunk/mingw-w64-headers/configure --host=x86_64-w64-mingw32 make installThis should copy the MinGW headers into
/usr/local/x86_64-w64-mingw32/include/
. /usr/local/x86_64-w64-mingw32/
directory that also contains a lib/
directory (which will be used for the 64 bit version of the libraries). If that's not the case you should create it. Now, for multilib, we'll also need a lib32/
directory, and some parts of MinGW expect a few specific directories, like lib64/
or /usr/local/mingw
, so we create all that:ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw mkdir -p /usr/local/x86_64-w64-mingw32/lib32 ln -s /usr/local/x86_64-w64-mingw32/lib /usr/local/x86_64-w64-mingw32/lib64
cd ..; mkdir gcc-build; cd gcc-build ../gcc-4.5.0/configure --disable-nls --target=x86_64-w64-mingw32 --enable-languages=c,c++ --with-system-zlib --enable-multilib --enable-version-specific-runtime-libs --enable-shared --enable-fully-dynamic-stringOK, a little clarification about our configure options:
--enable-languages=c,c++
, because, who the hell compiles 64 bit Windows binaries in Fortran or Ada, and your time is precious (plus, I think the Fortran/Ada source generate some errors). C and C++ are all you need.--with-system-zlib
, at least on Slackware, you do want to use that option to avoid an uncorrectable "Link tests are not allowed after GCC_NO_EXECUTABLES
" error in the zlib/
directory provided by gcc. And I'm at loss to figure out why gcc does include the sources for zlib in their archive, but not the ones for gmp, mpc, mpfr, as it'd make life a lot easier for everybody.--enable-version-specific-runtime-libs
, --enable-fully-dynamic-string
, because some people use these and say they are useful.--enable-version-specific-runtime-libs
, as this causes issues. There is currently a long discussion on the MinGW-w64 mailing list about this. Make sure you read it! I may update this guide at some stage--enable-multilib
, to have -m32
and -m64
support!--enable-shared
, to be able to compile DLLs as well as static libraries.make all-gcc -j4Yay, our first compilation error (sadly, won't be the last!). The above fails on
checking for gmp internal files... configure: error: header files gmp-impl.h and longlong.h not found make: *** [configure-mpfr] Error 1To fix that error:
cp ../gcc-4.5.0/gmp/gmp-impl.h gmp; cp ../gcc-4.5.0/gmp/longlong.h gmpAfter that, the process should complete successfully with:
make all-gcc -j4 make install-gccNote that if you get other errors during the build (eg. "
Link tests are not allowed after GCC_NO_EXECUTABLES
"), just try without -j
a couple of times to see if this is really a permanent error, or just gcc screwing with your nerves.cd ../mingw-build ../mingw-w64/trunk/configure --disable-nls --host=x86_64-w64-mingw32 --enable-lib32 make -j4 make install -j4I think
--enable-lib32
is superfluous, as recent MinGW-w64 seem to be hardwired for multilib by default. Just make sure that 32 and 64 bit are enabled on the configure summary screen.cd ../gcc-build make -j4will choke on:
/usr/local/x86_64-w64-mingw32/bin/ld: skipping incompatible /usr/local/x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32and a whole bunch of similar errors. Obviously, since we're in
gcc-build/x86_64-w64-mingw32/32/libgcc/
when that happens, ld
should be looking in lib32/
rather than lib/
.<your_working_dir>/gcc-build/x86_64-w64-mingw32/32/libgcc/Makefile
CC
line into a CC32
line and replace all the /lib
by /lib32
. GCC_FOR_TARGET = $(CC)
with GCC_FOR_TARGET = $(CC32)
CC
line doesn't work (which I guess is due to libtool use)! You need to create a new CC32
variable.make -j4You might get a "
Link tests are not allowed after GCC_NO_EXECUTABLES
" (what the heck does that error actually mean anyway?). If that happens, just retry... until it breaks again with the "skipping incompatible when searching for -lmingw32
" error again in <your_working_dir>/gcc-build/x86_64-w64-mingw32/32/libssp/
Makefile
, only this time you can edit the CC
and CPP
variables directly and just replace /lib
with /lib32
again.make -j4Yup, choked again, this time in
<your_working_dir>/gcc-build/x86_64-w64-mingw32/libstdc++-v3/libsupc++/
, with:/bin/sh: ../libtool: No such file or directoryEasiest solution I found:
cp ./x86_64-w64-mingw32/libssp/libtool ./x86_64-w64-mingw32/libstdc++-v3Then once more:
make -j4Might get a few errors, that go away on retry, and then:
../../../../gcc-4.5.0/libstdc++-v3/src/atomic.cc:26:21: fatal error: gstdint.h: No such file or directoryEasy to fix:
ln -s /usr/local/mingw/include/stdint.h /usr/local/mingw/include/gstdint.h make -j4...and then again:
make[6]: Entering directory `/mnt/hd/src/clean/gcc-build/x86_64-w64-mingw32/32/libstdc++-v3' make[6]: *** No rule to make target `all'. Stop.Well, no surprise: there's no makefile in
<your_working_dir>/gcc-build/x86_64-w64-mingw32/32/libstdc++-v3/
! How I fixed it?rm -r x86_64-w64-mingw32/32/libstdc++-v3 ln -s x86_64-w64-mingw32/libstdc++-v3/32 x86_64-w64-mingw32/32/libstdc++-v3 make -j4...and once more, plenty of errors in
./x86_64-w64-mingw32/32/libssp/
about lib
vs lib32
. At least we can't say gcc compilation isn't keeping us entertained. This time, we can edit ./x86_64-w64-mingw32/32/libssp/libtool
and do a search for -m32
. For each line that has -m32
, just replace /lib
with /lib32
.$ make -j4YAY!!! Completion at last! Just one final thing to do:
make install -j4If you managed to make it through that last ordeal, you should now have a fully working MinGW-w64 gcc compiler, capable of producing 32 and 64 bit windows binaries, as well as static or dynamic (DLL) libraries, and using nothing but the latest versions of all the tools. Pretty cool huh?
--host=x86_64-w64-mingw32
when running configure, and possibly export a CFLAGS=-m32
if you want to produce 32 bit binaries.
The following is quoted from a USB-IF forum post (the link is now invalid)
http://www.usb.org/phpbb/viewtopic.php?p=33850
"Win2000/XP has a way to ignore the serial number.
This is copied form an AppNote I wrote:
-------------------------------------------------------
Ignore serial number in Win2000 / XP In Windows 2000 and XP,
there is a way to ignore the serial number for a certain device.
This is not recommended in general, but there are reasons to do so.
This is the registry key
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags]
The global way: The entry below does enable the serial numbers despite
its name! It is already there after a fresh installation.
GlobalDisableSerNumGen = 1
We recommend keeping the above setting unchanged.
Now here is the individual way. Create an entry under the
above ...\UsbFlags key. The name must start with "IgnoreHWSerNum"
followed by the vendor and product ID of the device. The value for the
entry is 1 for disable.
Example:
IgnoreHWSerNum0536016A= 1
Our vendor ID (VID) is 0536 (hex), the product ID (PID) depends
on the interface you choose.
fatal error RC1050: Cannot open include file 'afxres.h'.The solution? Replace your:
#include "afxres.h"from your .rc file with the following:
#include <windows.h> #define IDC_STATIC -1
qemu -usb -vnc 127.0.0.1:0 -hda winxp.img -m 512 -localtime -net user -net nic,model=rtl8139 -cdrom //./d:
error LNK2001: unresolved external symbol IID_IFileOpenDialog error LNK2001: unresolved external symbol CLSID_FileOpenDialogYou're missing uuid.lib.
C:\Windows\system32\mmc.exe C:\Windows\system32\devmgmt.msc
sh: ./setup_driver.exe: Bad file numberThe reason: Microsoft's implementation of UAC will try to give a free pass to any application that has "setup" in its name, and run it in elevated mode (after asking for confirmation).
BUILT_SOURCES = resource.hin your Makefile/Makefile.am as all files mentioned as
BUILT_SOURCES
will be built before any of the normal compilation rules run.BUILT_SOURCES = resource.h lib_LTLIBRARIES = libusb-wdi.la LIB_SRC = resource.h infs.h usbi.h installer.h installer_library.h installer_library.c libusb_wdi_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS) -L../../libusb/libusb/.libs -lusb-1.0 libusb_wdi_la_SOURCES = $(LIB_SRC) resource.h: ../embedder/embedder.exe resource.h clean-local: -rm -rf resource.h
Private saved As Boolean = False Private Sub DocumentEvents_DocumentSaved(ByVal document As EnvDTE.Document) _ Handles DocumentEvents.DocumentSaved If Not saved Then Try ' Remove all the trailing whitespaces. DTE.Find.FindReplace(vsFindAction.vsFindActionReplaceAll, _ "{:Zs|\t}+$", _ vsFindOptions.vsFindOptionsRegularExpression, _ String.Empty, _ vsFindTarget.vsFindTargetCurrentDocument, , , _ vsFindResultsLocation.vsFindResultsNone) saved = True document.Save() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Trim White Space exception") End Try Else saved = False End If End Sub
ServiceBinary = %12%\mydriver_x64.sysand try again. Might work better this time around.