PDA

Visualizza la versione completa : [C++]compilazione libusb-win32 con mingw


warcomeb
28-06-2011, 16:53
Salve a tutti, intanto chiedo scusa ad alka per l'ultimo 3d che mi ha dovuto chiudere... :)

Stavo provando ad utilizzare la libusb-win32, ma la dll che foniscono sul sito non mi funziona con le QT e quindi la devo ricompilare con mingw... purtroppo qui sorgono i problemi: in pratica scompatto i sorgenti (http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/libusb-win32-src-1.2.4.0.zip/download) dentro alla cartella C:/LibUSB-Win32 e da li faccio mingw32-make... inizia la compilazione fino a quando non da questi errori (scusate la lunghezza, ma preferisco riportare tutto l'errore):


C:\LIBUSB~1>mingw32-make
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK
-c ./src/usb.c -o usb.2.o -I./src -I./src/driver -I.
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK
-c ./src/error.c -o error.2.o -I./src -I./src/driver -I.
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK
-c ./src/descriptors.c -o descriptors.2.o -I./src -I./src/driver -I.
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK
-c ./src/windows.c -o windows.2.o -I./src -I./src/driver -I.
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK
-c ./src/install.c -o install.2.o -I./src -I./src/driver -I.
./src/install.c:319: warning: 'gdi32_dll' defined but not used
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK
-c ./src/registry.c -o registry.2.o -I./src -I./src/driver -I.
./src/registry.c: In function 'usb_registry_get_property':
./src/registry.c:94: warning: unused variable 'reg_key'
./src/registry.c:93: warning: unused variable 'p'
./src/registry.c: In function 'usb_registry_get_mz_value':
./src/registry.c:874: warning: pointer targets in passing argument 5 of 'RegQuer
yValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_set_mz_value':
./src/registry.c:931: warning: pointer targets in passing argument 5 of 'RegSetV
alueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:108: no
te: expected 'const BYTE *' but argument is of type 'char *'
./src/registry.c:939: warning: pointer targets in passing argument 5 of 'RegSetV
alueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:108: no
te: expected 'const BYTE *' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_get_all_class_keys':
./src/registry.c:1435: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_lookup_class_keys_by_name':
./src/registry.c:1498: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_get_class_filter_keys':
./src/registry.c:1640: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c:1646: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
windres -I./src ./src/resource.rc -o resource.2.o
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK
-o libusb0.dll -I./src usb.2.o error.2.o descriptors.2.o windows.2.o install.2
.o registry.2.o resource.2.o libusb0.def -s -mdll -Wl,--kill-at -Wl,--out-implib
,libusb.a -Wl,--enable-stdcall-fixup -L. -lcfgmgr32 -lsetupapi -lgdi32
Creating library file: libusb.a
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"install-filter\" -DTARGETTYPE=PROG
RAMconsole -DLOG_STYLE_SHORT -c ./src/install_filter.c -o install_filter.1.o -I
./src -I./src/driver -I.
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"install-filter\" -DTARGETTYPE=PROG
RAMconsole -DLOG_STYLE_SHORT -c ./src/error.c -o error.1.o -I./src -I./src/driv
er -I.
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"install-filter\" -DTARGETTYPE=PROG
RAMconsole -DLOG_STYLE_SHORT -c ./src/install.c -o install.1.o -I./src -I./src/
driver -I.
./src/install.c:319: warning: 'gdi32_dll' defined but not used
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"install-filter\" -DTARGETTYPE=PROG
RAMconsole -DLOG_STYLE_SHORT -c ./src/registry.c -o registry.1.o -I./src -I./sr
c/driver -I.
./src/registry.c: In function 'usb_registry_get_property':
./src/registry.c:94: warning: unused variable 'reg_key'
./src/registry.c:93: warning: unused variable 'p'
./src/registry.c: In function 'usb_registry_get_mz_value':
./src/registry.c:874: warning: pointer targets in passing argument 5 of 'RegQuer
yValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_set_mz_value':
./src/registry.c:931: warning: pointer targets in passing argument 5 of 'RegSetV
alueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:108: no
te: expected 'const BYTE *' but argument is of type 'char *'
./src/registry.c:939: warning: pointer targets in passing argument 5 of 'RegSetV
alueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:108: no
te: expected 'const BYTE *' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_get_all_class_keys':
./src/registry.c:1435: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_lookup_class_keys_by_name':
./src/registry.c:1498: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c: In function 'usb_registry_get_class_filter_keys':
./src/registry.c:1640: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
./src/registry.c:1646: warning: pointer targets in passing argument 5 of 'RegQue
ryValueExA' differ in signedness
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winreg.h:97: not
e: expected 'LPBYTE' but argument is of type 'char *'
windres -I./src ./src/install_filter_rc.rc -o install_filter_rc.1.o
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"install-filter\" -DTARGETTYPE=PROG
RAMconsole -DLOG_STYLE_SHORT -o install-filter.exe -I./src install_filter.1.o e
rror.1.o install.1.o registry.1.o install_filter_rc.1.o -s -L. -lgdi32 -luser32
-lcfgmgr32 -lsetupapi
gcc -c projects/additional/libwdi/libwdi/installer.c -o projects/additional/libw
di/libwdi/installer.6.o -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"installer_x86\
" -DTARGETTYPE=PROGRAMconsole -DWDF_VER=\"01009\" -DUSER_DIR=\"\" -DOPT_M32 -DWI
NVER=0x500 -DWINVER=0x500 -I./projects/additional/libwdi/libwdi
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"installer_x86\" -DTARGETTYPE=PROGR
AMconsole -DWDF_VER=\"01009\" -DUSER_DIR=\"\" -DOPT_M32 -DWINVER=0x500 -o instal
ler_x86.exe -I./projects/additional/libwdi/libwdi projects/additional/libwdi/li
bwdi/installer.6.o -s -L. -ladvapi32 -lnewdev -lsetupapi
cp ./projects/additional/libwdi/libwdi/../msvc/config.h ./projects/additional/li
bwdi/libwdi
process_begin: CreateProcess(NULL, cp ./projects/additional/libwdi/libwdi/../msv
c/config.h ./projects/additional/libwdi/libwdi, ...) failed.
make (e=2): Impossibile trovare il file specificato.
mingw32-make: *** [installer_x86.exe] Error 2


qualcuno mi pu aiutare a capire dov' l'inghippo??? :dh: io non so pi quello che fare!

Ciao
Marco

MItaly
28-06-2011, 17:13
La compilazione a posto, il problema credo sia nel makefile, che richiama cp (comando di copia su sistemi Unix-like) ma che su Windows ovviamente non presente. Potresti andare a spulciare nel makefile e sostituire il 'cp parametri' con un 'cmd /c copy parametri'. In alternativa, puoi provare a creare un file copy.cmd nella directory del makefile, contenente qualcosa del tipo


@copy %*

Nota che questo funziona solo se cp viene usato per copiare singoli files, altrimenti devi cercare di convertire la sintassi di cp in quella di xcopy (http://ss64.com/nt/xcopy.html).

warcomeb
28-06-2011, 17:29
ti ringrazio per la risposta! ora mi chiedo: perch in una libreria che deve funzionare per win c' un comando unix-like? provo a vedere e poi vi faccio sapere!

grazie di nuovo!

Marco

MItaly
28-06-2011, 17:32
Originariamente inviato da warcomeb
ti ringrazio per la risposta! ora mi chiedo: perch in una libreria che deve funzionare per win c' un comando unix-like? provo a vedere e poi vi faccio sapere!
Non un problema della libreria, ma del makefile. Probabilmente stato collaudato solo con CygWin.

warcomeb
28-06-2011, 17:45
ho provato con 'cmd /c copy' ma mi dice sintassi del comando errata...

in pratica nel makefile ho trovato questo:


MAKE = make
CP = cp
CD = cd
MV = mv
RM = -rm -fr
TAR = tar
ISCC = iscc
INSTALL = install
LIB = lib
IMPLIB = implib
UNIX2DOS = unix2dos


ed ho pensato di sostituire 'cp' con 'cmd /c copy'. ho sbagliato? :bh:

grazie
Marco

MItaly
28-06-2011, 17:57
Dipende da come viene usato nel makefile... io tenterei l'altro approccio, con il file .cmd...

warcomeb
28-06-2011, 18:59
niente da fare:
ho provato a fare il file, l'ho chiamato cp.cmd e nel makefile ho messo sia 'CP = cp' che 'CP = cp.cmd' ma niente, mi dice errore di sintassi!

un mio amico mi ha passato un pacchetto che si chiama UnxUtils che ha dentro degli exe che simulano i comandi linux classici, ma ora l'errore :



gcc -c projects/additional/libwdi/libwdi/embedder.c -o projects/additional/libwd
i/libwdi/embedder.7.o -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"embedder\" -DTAR
GETTYPE=PROGRAMconsole -DWDF_VER=\"01009\" -DUSER_DIR=\"\" -DOPT_M32 -DWINVER=0x
500 -DWINVER=0x500 -I./projects/additional/libwdi/libwdi
gcc -O2 -Wall -DWINVER=0x500 -DLOG_APPNAME=\"embedder\" -DTARGETTYPE=PROGRAMcon
sole -DWDF_VER=\"01009\" -DUSER_DIR=\"\" -DOPT_M32 -DWINVER=0x500 -o embedder.ex
e -I./projects/additional/libwdi/libwdi projects/additional/libwdi/libwdi/embedd
er.7.o -s -L. -luser32 -lversion
cp -u ./projects/additional/libwdi/libwdi/winusb.inf.in ./
cp: cannot create regular file `./': Permission denied
mingw32-make: *** [embedder.exe] Error 1


Io non so pi come appattarla!

Ciao e grazie!

warcomeb
28-06-2011, 19:32
sano togliere tutti i ./ dai comandi? o c' un modo pi decente per far ci?

MItaly
28-06-2011, 23:19
Pi che altro mi pare strano quel

cp -u ./projects/additional/libwdi/libwdi/winusb.inf.in ./... sarebbe illegale anche su Linux... dopo il ./ dovrebbe esserci qualcosa, oppure dovrebbe essere . e basta per copiare il file nella directory corrente e fine. Comunque la compilazione credo sia fatta, l sta soltanto raggruppando i file generati.

Loading