mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
To: Trent Piepho <>
Cc: Barebox List <>,,,,
Subject: Re: [PATCH 3/4] scripts: unify libusb.h inclusion
Date: Wed, 15 Sep 2021 10:55:58 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 14.09.21 21:22, Trent Piepho wrote:
> On Tue, Sep 14, 2021 at 6:21 AM Ahmad Fatoum <> wrote:
>> I've also run into downstream patches around broken toolchains that
>> change <libusb.h> to <libusb-1.0/libusb.h>, so the header is found.
> How does this become a problem exactly?  If the toolchain has the file
> in the location <includedir>/ibusb-1.0/libusb.h, then shouldn't
> pkg-config --cflags have returned -I<includedir>/libusb-1.0 and it
> would then find the file just fine?
> Or is the problem really that the cross building setup does not have
> correct .pc files?

I ran twice into downstream patches patching imx-usb-loader. So apparently

-lusb1.0 was returned but the CFLAGS were correctl set.

> If it's the latter, then I'll point out that my previous email would
> let someone put CROSS_LIBUSB_CFLAGS=-I<cross-include-dir>/libusb-1.0
> on the make command line and get a build without having .pc files.
> This is pretty much what you get with autoconf configure scripts when
> you put headers in a non-standard place and don't have .pc files setup
> to find them.  You need to supply CFLAGS, LDFLAGS, etc. variables with
> the proper -L and -I options to find them.

I wrote this patch initially to support a pkg-config less build:
If CROSS_PKG_CONFIG wasn't set (no default), we would just use -lusb-1.0
and hope it works. For the header __has_include would try the two paths
that most probably would work.

Now that I dropped that fallback, I should probably drop this patch
as well and let people with broken pkg-config files just fix their

>> +++ b/scripts/libusb.h
> By naming this libusb.h, it requires that "libusb.h" find this file
> and <libusb.h> find a different header of the same name.  That's
> certainly possible by being careful with the "" and <> search paths.
> But it seems unnecessarily fragile.  I suggest using libusb-wrapper.h
> for this file so you avoid name collisions with the real header file.

That's a good point. I'll drop this patch though for v2.

Thanks for your feedback,

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       |  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

barebox mailing list

  reply	other threads:[~2021-09-15  8:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 13:20 [PATCH 1/4] common: remove !SANDBOX dependency for target tools Ahmad Fatoum
2021-09-14 13:20 ` [PATCH 2/4] common: add new menu " Ahmad Fatoum
2021-09-14 16:00   ` Roland Hieber
2021-09-14 13:20 ` [PATCH 3/4] scripts: unify libusb.h inclusion Ahmad Fatoum
2021-09-14 19:22   ` Trent Piepho
2021-09-15  8:55     ` Ahmad Fatoum [this message]
2021-09-14 13:20 ` [PATCH 4/4] scripts: allow building USB loader tools for target as well Ahmad Fatoum
2021-09-14 19:11   ` Trent Piepho
2021-09-15  8:50     ` Ahmad Fatoum
2021-09-15  9:38       ` Trent Piepho
2021-09-15 10:23         ` Ahmad Fatoum
2021-09-15  8:44   ` Enrico Jörns

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH 3/4] scripts: unify libusb.h inclusion' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox