mcuee / libusb-win32

libusb-win32 project official github repo
179 stars 49 forks source link

Compilation failed on MSYS2 CLANG64 environment #66

Open ikspress opened 7 months ago

ikspress commented 7 months ago

Command: make dll -j16 Here is the output:

gcc -O2 -Wall -DWINVER=0x500  -Werror -Wno-unknown-pragmas -Wno-multichar -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  -Werror -Wno-unknown-pragmas -Wno-multichar -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  -Werror -Wno-unknown-pragmas -Wno-multichar -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  -Werror -Wno-unknown-pragmas -Wno-multichar -DLOG_APPNAME=\"libusb0-dll\" -DTARGETTYPE=DYNLINK -c ./src/install.c -o install.2.o  -I./src -I./src/driver -I. 
In file included from ./src/descriptors.c:11:
In file included from ./src/usbi.h:4:
./src/lusb0_usb.h:88:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
   88 | #include <pshpack1.h>
      |          ^
D:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
    7 | #pragma pack(push,1)
      |         ^
In file included from ./src/descriptors.c:11:
In file included from ./src/usbi.h:4:
./src/lusb0_usb.h:336:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  336 | #include <poppack.h>
      |          ^
note: previous '#pragma pack' directive that modifies alignment is here
2 errors generated.
make: *** [Makefile:133: descriptors.2.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ./src/usb.c:16:
In file included from ./src/usbi.h:4:
./src/lusb0_usb.h:88:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
   88 | #include <pshpack1.h>
      |          ^
D:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
    7 | #pragma pack(push,1)
      |         ^
In file included from ./src/usb.c:16:
In file included from ./src/usbi.h:4:
./src/lusb0_usb.h:336:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  336 | #include <poppack.h>
      |          ^
note: previous '#pragma pack' directive that modifies alignment is here
2 errors generated.
In file included from ./src/windows.c:32:
./src/lusb0_usb.h:88:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
   88 | #include <pshpack1.h>
      |          ^
D:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
    7 | #pragma pack(push,1)
      |         ^
In file included from ./src/windows.c:32:
./src/lusb0_usb.h:336:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  336 | #include <poppack.h>
      |          ^
note: previous '#pragma pack' directive that modifies alignment is here
In file included from ./src/windows.c:35:
./src/driver/driver_api.h:181:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  181 | #include <pshpack1.h>
      |          ^
D:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
    7 | #pragma pack(push,1)
      |         ^
In file included from ./src/windows.c:35:
./src/driver/driver_api.h:398:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  398 | #include <poppack.h>
      |          ^
note: previous '#pragma pack' directive that modifies alignment is here
4 errors generated.
make: *** [Makefile:133: usb.2.o] Error 1
make: *** [Makefile:133: windows.2.o] Error 1
In file included from ./src/install.c:41:
./src/lusb0_usb.h:88:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
   88 | #include <pshpack1.h>
      |          ^
D:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
    7 | #pragma pack(push,1)
      |         ^
In file included from ./src/install.c:41:
./src/lusb0_usb.h:336:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  336 | #include <poppack.h>
      |          ^
note: previous '#pragma pack' directive that modifies alignment is here
In file included from ./src/install.c:44:
./src/driver/driver_api.h:181:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  181 | #include <pshpack1.h>
      |          ^
D:/msys64/clang64/include/pshpack1.h:7:9: note: previous '#pragma pack' directive that modifies alignment is here
    7 | #pragma pack(push,1)
      |         ^
In file included from ./src/install.c:44:
./src/driver/driver_api.h:398:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
  398 | #include <poppack.h>
      |          ^
note: previous '#pragma pack' directive that modifies alignment is here
./src/install.c:1341:45: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
 1341 |                         filter_context->switches.add_all_classes = TRUE;
      |                                                                  ^ ~~~~
./src/install.c:1345:48: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
 1345 |                         filter_context->switches.add_device_classes = TRUE;
      |                                                                     ^ ~~~~
./src/install.c:1639:12: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
 1639 |                                 printf(filter_context->wait_string);
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/install.c:1639:12: note: treat the string as an argument to avoid this
 1639 |                                 printf(filter_context->wait_string);
      |                                        ^
      |                                        "%s", 
./src/install.c:1824:48: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
 1824 |                 filter_context->switches.add_default_classes = TRUE;
      |                                                              ^ ~~~~
8 errors generated.
make: *** [Makefile:133: install.2.o] Error 1

Just remove -Werror from CFLAGS is a simple solution , but I think fixing these warnings is better.

mcuee commented 7 months ago

FYI, clang64 is currently not supported. PR will be welcome.