Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors on Build USBIP tools step #14

Open
felafel opened this issue Jun 11, 2020 · 2 comments
Open

Errors on Build USBIP tools step #14

felafel opened this issue Jun 11, 2020 · 2 comments

Comments

@felafel
Copy link

felafel commented Jun 11, 2020

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 __builtin___strncpy_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 __builtin___strncpy_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

=========

@dkozel
Copy link

dkozel commented Jun 19, 2020

Resolved by applying the patches from #15

@TheProgramableTurtle
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants