Open felafel opened 4 years ago
Resolved by applying the patches from https://github.com/rpasek/usbip-wsl2-instructions/pull/15
After applying the patches from #15 by running
sudo ./scripts/apply_patches.sh -d /usr/src/4.19.104-microsoft-standard
I get this output:
Found patches: ./patches/usbip-network-fix-unaligned-member-access.patch ./patches/usbip-strncpy-stringop-truncation.patch
Applying patch: ./patches/usbip-network-fix-unaligned-member-access.patch
patch -d /usr/src/4.19.104-microsoft-standard -p1 < ./patches/usbip-network-fix-unaligned-member-access.patch
patching file tools/usb/usbip/src/usbip_network.c
Hunk #1 succeeded at 62 (offset 12 lines).
patching file tools/usb/usbip/src/usbip_network.h
Applying patch: ./patches/usbip-strncpy-stringop-truncation.patch
patch -d /usr/src/4.19.104-microsoft-standard -p1 < ./patches/usbip-strncpy-stringop-truncation.patch
patching file tools/usb/usbip/libsrc/usbip_common.c
Hunk #1 FAILED at 226.
1 out of 1 hunk FAILED -- saving rejects to file tools/usb/usbip/libsrc/usbip_common.c.rej
patching file tools/usb/usbip/libsrc/usbip_device_driver.c
Hunk #1 FAILED at 103.
Hunk #2 FAILED at 122.
2 out of 2 hunks FAILED -- saving rejects to file tools/usb/usbip/libsrc/usbip_device_driver.c.rej
'_builtin_strcpy' error still occurs. However, as suggested by this Reddit user, simply removing the -Werror flags from the USBIP Makefiles fixes the problem and allows USBIP to build successfully. The error becomes a warning.
In function ‘strncpy’,
inlined from ‘read_usb_vudc_device’ at usbip_device_driver.c:108:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'll have to see if this has an impact on usage.
Some things that may be relevant:
"Navigate in menuconfig to select the USB kernel modules you'd like." I saved this and used the default ".config" for the save name. I assume this was what I was supposed to do after selecting these items.
"After the build completes you'll get a list of what kernel modules have been installed. Mine looks like:" I did not see this list of items so maybe that didn't work.
"Build USBIP tools:" "sudo make install -j 4"
=== Output below with errors ===
Making install in libsrc make[1]: Entering directory '/usr/src/4.19.104-microsoft-standard/tools/usb/usbip/libsrc' CC libusbip_la-usbip_device_driver.lo CC libusbip_la-usbip_common.lo CC libusbip_la-usbip_host_common.lo CC libusbip_la-vhci_driver.lo In file included from /usr/include/string.h:495, from usbip_device_driver.c:25: In function ‘strncpy’, inlined from ‘read_usb_vudc_device’ at usbip_device_driver.c:108:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘builtin_strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation] 106 | return _builtinstrncpy_chk (dest, src, len, bos (dest)); | ^
~~~~~~~~~~~~~ In function ‘strncpy’, inlined from ‘read_usb_vudc_device’ at usbip_device_driver.c:127:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 32 equals destination size [-Werror=stringop-truncation] 106 | return builtin_strncpy_chk (dest, src, len, bos (dest)); | ^~~~~~~~~~~~~~ cc1: all warnings being treated as errors In file included from /usr/include/string.h:495, from usbip_common.h:14, from usbip_common.c:7: In function ‘strncpy’, inlined from ‘read_usb_device’ at usbip_common.c:229:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘builtin_strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation] 106 | return _builtinstrncpy_chk (dest, src, len, bos (dest)); | ^~~~~~~~~~~~~~ In function ‘strncpy’, inlined from ‘read_usb_device’ at usbip_common.c:230:2: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 32 equals destination size [-Werror=stringop-truncation] 106 | return builtin_strncpy_chk (dest, src, len, bos (dest)); | ^~~~~~~~~~~~~~ make[1]: [Makefile:472: libusbip_la-usbip_device_driver.lo] Error 1 make[1]: Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[1]: *** [Makefile:479: libusbip_la-usbip_common.lo] Error 1=========