mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Trent Piepho <trent.piepho@igorinstitute.com>
Cc: Barebox List <barebox@lists.infradead.org>,
	ejo@pengutronix.de, rhi@pengutronix.de, uol@pengutronix.de,
	renaud.barbier@abaco.com
Subject: Re: [PATCH 3/4] scripts: unify libusb.h inclusion
Date: Wed, 15 Sep 2021 10:55:58 +0200
Message-ID: <fda4d46a-1025-4bde-4ee0-bebbe20932ab@pengutronix.de> (raw)
In-Reply-To: <CAMHeXxMyGYAM=TSE=V9h8jnkO8rmDE-e5axKeCwURvqcYoG63A@mail.gmail.com>

On 14.09.21 21:22, Trent Piepho wrote:
> On Tue, Sep 14, 2021 at 6:21 AM Ahmad Fatoum <a.fatoum@pengutronix.de> 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
brokenness.

>> +++ 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,
Ahmad


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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=fda4d46a-1025-4bde-4ee0-bebbe20932ab@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ejo@pengutronix.de \
    --cc=renaud.barbier@abaco.com \
    --cc=rhi@pengutronix.de \
    --cc=trent.piepho@igorinstitute.com \
    --cc=uol@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

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

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git