Skip to contentSkip to conversation

libusb-compat: fix a build issue with undefined PATH_MAX

PATCH New Bartosz Golaszewski 4 participants 8 messages Jul 3, 2017 – Jul 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

libsigrok build failed because of PATH_MAX not being defined in usb.h. On linux it is defined in linux/limits.h, but usb.h only includes limit.h. Add a patch fixing the header in libusb-compat.

While we're at it: remove the patch numbering from previous patch.

---
 ...andard-fixed-width-integer-types-in-usb.h.patch |  7 +++--
 .../0002-fix-a-build-issue-on-linux.patch          | 32 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 package/libusb-compat/0002-fix-a-build-issue-on-linux.patch
package/libusb-compat/0001-Use-C99-standard-fixed-width-integer-types-in-usb.h.patch +4 -3
index ad71199..35872a9 100644
@@ -1,7 +1,7 @@
-From 2e9b6bbebb7cf1ef0095516ec6d5203deb3822e8 Mon Sep 17 00:00:00 2001
+From 87adda6abc3467ede45a6d2a87df2b9efdf5bb33 Mon Sep 17 00:00:00 2001
 From: Nathan Hjelm <[email protected]>
 Date: Fri, 9 Oct 2015 15:03:10 -0600
-Subject: [PATCH 1/1] Use C99 standard fixed width integer types in usb.h
+Subject: [PATCH] Use C99 standard fixed width integer types in usb.h
 
 This patch modifies the integer types in usb.h of the form u_int* to the
 C99 standard uint* types.
@@ -13,6 +13,7 @@ https://github.com/libusb/libusb-compat-0.1/commit/2e9b6bbebb7cf1ef0095516ec6d52
 
 Signed-off-by: Gwenhael Goavec-Merou <[email protected]>
 Signed-off-by: Nathan Hjelm <[email protected]>
+Signed-off-by: Bartosz Golaszewski <[email protected]>
 ---
  libusb/usb.h | 130 ++++++++++++++++++++++++++++++++---------------------------
  1 file changed, 70 insertions(+), 60 deletions(-)
@@ -232,5 +233,5 @@ index 84e730f..d2c30aa 100644
    struct usb_device *root_dev;
  };
 -- 
-2.4.9
+2.9.3
 
package/libusb-compat/0002-fix-a-build-issue-on-linux.patch new file +32 -0
new file mode 100644
index 0000000..d2e26b3
@@ -0,0 +1,32 @@
+From af07587e8775c25450cda8ba9e9a8b1a58072634 Mon Sep 17 00:00:00 2001
+From: Bartosz Golaszewski <[email protected]>
+Date: Mon, 3 Jul 2017 15:55:00 +0200
+Subject: [PATCH] fix a build issue on linux
+
+On linux PATH_MAX is defined in linux/limits.h. If we include usb.h
+without previously having indirectly included it, the build fails.
+
+Signed-off-by: Bartosz Golaszewski <[email protected]>
+---
+ libusb/usb.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/libusb/usb.h b/libusb/usb.h
+index d2c30aa..7ad9a66 100644
+--- a/libusb/usb.h
++++ b/libusb/usb.h
+@@ -41,6 +41,11 @@ typedef unsigned __int32  uint32_t;
+ #include <stdint.h>
+ #endif
+ 
++/* On linux PATH_MAX is defined in linux/limits.h. */
++#if defined(__linux__)
++#include <linux/limits.h>
++#endif
++
+ /*
+  * USB spec information
+  *
+-- 
+2.9.3
+
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

Hi Bartosz,

Quoted 3 lines · Bartosz Golaszewski

libsigrok build failed because of PATH_MAX not being defined in usb.h. On linux it is defined in linux/limits.h, but usb.h only includes limit.h. Add a patch fixing the header in libusb-compat.

This doesn't sound right: according to POSIX [1], limits.h should define
PATH_MAX. And indeed, if you do

echo '#include <usb.h>' | host/usr/bin/x86_64-amd-linux-gnu-gcc -x c -E -

you'll see that PATH_MAX gets properly expanded to 4096. So something else is going on.

Quoted 2 lines

While we're at it: remove the patch numbering from previous patch.

Good idea, but no need to add your SoB just for that.

Regards,
Arnout

Quoted 2 lines

[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

Quoted 7 lines · Arnout Vandecappelle

Hi Bartosz,

Quoted 3 lines · Bartosz Golaszewski

libsigrok build failed because of PATH_MAX not being defined in usb.h. On linux it is defined in linux/limits.h, but usb.h only includes limit.h. Add a patch fixing the header in libusb-compat.

Quoted 7 lines

This doesn't sound right: according to POSIX [1], limits.h should define
PATH_MAX. And indeed, if you do

echo '#include <usb.h>' | host/usr/bin/x86_64-amd-linux-gnu-gcc -x c -E -

you'll see that PATH_MAX gets properly expanded to 4096. So something else is going on.

OK so I investigated a little more, and it turns out that -std=c99 is the
culprit. And apparently people on the 'net are advising to use linux/limits.h to get at PATH_MAX. So perhaps this is the right approach after all.

What's the upstream status of this patch?

Regards,
Arnout

Quoted 17 lines
Quoted 4 lines

While we're at it: remove the patch numbering from previous patch.

Good idea, but no need to add your SoB just for that.

Regards,
Arnout

Quoted 2 lines

[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#3 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

2017-07-03 17:48 GMT+02:00 Arnout Vandecappelle <[email protected]>:

Quoted 18 lines · Arnout Vandecappelle
Quoted 7 lines

Hi Bartosz,

Quoted 3 lines · Bartosz Golaszewski

libsigrok build failed because of PATH_MAX not being defined in usb.h. On linux it is defined in linux/limits.h, but usb.h only includes limit.h. Add a patch fixing the header in libusb-compat.

Quoted 7 lines

This doesn't sound right: according to POSIX [1], limits.h should define
PATH_MAX. And indeed, if you do

echo '#include <usb.h>' | host/usr/bin/x86_64-amd-linux-gnu-gcc -x c -E -

you'll see that PATH_MAX gets properly expanded to 4096. So something else is going on.

Quoted 8 lines

OK so I investigated a little more, and it turns out that -std=c99 is the
culprit. And apparently people on the 'net are advising to use linux/limits.h to get at PATH_MAX. So perhaps this is the right approach after all.

What's the upstream status of this patch?

Regards,
Arnout

Submitted, no answer yet.

Thanks,
Bartosz

#4 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bartosz" == Bartosz Golaszewski <[email protected]> writes:

Hi,

Quoted 7 lines
Quoted 5 lines

OK so I investigated a little more, and it turns out that -std=c99 is the culprit. And apparently people on the 'net are advising to use linux/limits.h to get at PATH_MAX. So perhaps this is the right approach after all.

What's the upstream status of this patch?

Submitted, no answer yet.

Out of interest, where did you submit it? I don't seem to find a pull request or a patch on the libusb-devel list?

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

2017-07-19 15:08 GMT+02:00 Peter Korsgaard <[email protected]>:

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bartosz" == Bartosz Golaszewski <[email protected]> writes:

Hi,

Quoted 5 lines
Quoted 5 lines

OK so I investigated a little more, and it turns out that -std=c99 is the culprit. And apparently people on the 'net are advising to use linux/limits.h to get at PATH_MAX. So perhaps this is the right approach after all.

What's the upstream status of this patch?

Quoted 7 lines
Quoted 1 line

Submitted, no answer yet.

Out of interest, where did you submit it? I don't seem to find a pull request or a patch on the libusb-devel list?

--
Bye, Peter Korsgaard

It's here: http://marc.info/?l=libusb-devel&m=149909307123038&w=2

Thanks,
Bartosz

#6 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bartosz" == Bartosz Golaszewski <[email protected]> writes:

Hi,

Quoted 11 lines
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

What's the upstream status of this patch?

Submitted, no answer yet.

Out of interest, where did you submit it? I don't seem to find a pull request or a patch on the libusb-devel list?

--
Bye, Peter Korsgaard

It's here: http://marc.info/?l=libusb-devel&m=149909307123038&w=2

Sorry, I must have missed it - Thanks for the heads up!

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH 1/1 libusb-compat: fix a build issue with undefined PATH_MAX

In reply to Bartosz Golaszewski

Hello,

Quoted 6 lines · Bartosz Golaszewski

libsigrok build failed because of PATH_MAX not being defined in usb.h. On linux it is defined in linux/limits.h, but usb.h only includes limit.h. Add a patch fixing the header in libusb-compat.

While we're at it: remove the patch numbering from previous patch.

Quoted 7 lines
---
 ...andard-fixed-width-integer-types-in-usb.h.patch |  7 +++--
 .../0002-fix-a-build-issue-on-linux.patch          | 32 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 package/libusb-compat/0002-fix-a-build-issue-on-linux.patch

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com