Bug 277688 - devel/openocd: libusb not found
Summary: devel/openocd: libusb not found
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Joel Bodenmann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-14 11:58 UTC by Erkki Moorits
Modified: 2024-04-08 12:36 UTC (History)
0 users

See Also:
jbo: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erkki Moorits 2024-03-14 11:58:03 UTC
Regression in Makefile: OpenOCD does no find USB connected Segger Flasher for ARM.

In commit 70c2b83232415954356803e286ea2263f5e98c8d (2024-02-27 18:31:13) has been removed CONFIGURE_ENV variable. This variable allows to build OpenOCD with older libusb: FreeBSD have libusb 1.0.13, but minimum required is 1.0.16.

Commit line that removed libusb support:
-CONFIGURE_ENV+=	libusb_CFLAGS=" " libusb_LIBS="-lusb"

Bug report where was introduced CONFIGURE_ENV:
Bug 256491 - devel/openocd: Update to 0.11.0, enable USB support for J-Link
Comment 1 Joel Bodenmann freebsd_committer freebsd_triage 2024-03-21 17:33:50 UTC
Moin moin,

Thank you for reporting this. I'll be having a look somewhere next week™.

You're once referring to the Segger Flasher but the PR you're referencing is talking about Segger J-Link (these are separate products). Are you also referring to J-Link instead of their dedicated Flasher product(s)?

AFAIK, OpenOCD is deprecating the internal libjaylink. Creating a FreeBSD port of libjaylink is on my ToDo list but that's currently a few months out.

Before the Makefile overhaul of this port, were you using the J-Link as a dumb JTAG/SWD probe (without all the fancy J-Link features) or were you actually able to use it with through OpenOCD's internal libjaylink?
Comment 2 Erkki Moorits 2024-03-22 07:13:10 UTC
(In reply to Joel Bodenmann from comment #1)

Hello,

I have Segger Flasher. But in current case, I think that it does not matter if there is Segger Flasher or Segger J-Link, both seems to use same USB code. The main problem is that OpenOCD has dependency to libusb 1.0.16, but unfortunately FreeBSD have libusb 1.0.13.

Before Makefile overhaul, I was using Segger Flasher for firmware uploading and debugging with GDB. I think that it uses internal libjaylink, because when OpenOCD stops to communicating with Flasher, then error codes came from libjaylink.

I added hare two configure outputs, where one is have defined "CONFIGURE_ENV+= libusb_CFLAGS=" " libusb_LIBS="-lusb"" and another without it.

Configure output without CONFIGURE_ENV:

checking for libusb-1.0 >= 1.0.16... no
checking whether byte ordering is bigendian... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libjaylink/Makefile
config.status: creating libjaylink/version.h
config.status: creating libjaylink.pc
config.status: creating Doxyfile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

libjaylink configuration summary:
 - Package version ................ 0.3.1
 - Library version ................ 2:0:2
 - Installation prefix ............ /usr/local
 - Building on .................... amd64-portbld-freebsd14.0
 - Building for ................... amd64-portbld-freebsd14.0

Enabled transports:
 - USB ............................ no (missing: libusb-1.0)
 - TCP ............................ yes


Configure output with CONFIGURE_ENV:

checking for libusb-1.0 >= 1.0.16... yes
checking whether byte ordering is bigendian... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libjaylink/Makefile
config.status: creating libjaylink/version.h
config.status: creating libjaylink.pc
config.status: creating Doxyfile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

libjaylink configuration summary:
 - Package version ................ 0.3.1
 - Library version ................ 2:0:2
 - Installation prefix ............ /usr/local
 - Building on .................... amd64-portbld-freebsd14.0
 - Building for ................... amd64-portbld-freebsd14.0

Enabled transports:
 - USB ............................ yes
 - TCP ............................ yes
Comment 3 Joel Bodenmann freebsd_committer freebsd_triage 2024-04-06 01:31:53 UTC
Thanks - I can reproduce this.
I'll try to get this handled over the weekend - Thank you for your patience. IRL has been a bit of a drag...
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-04-08 12:36:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cb4b4bccc6cc654a846356e8854f615b364f37d7

commit cb4b4bccc6cc654a846356e8854f615b364f37d7
Author:     Joel Bodenmann <jbo@FreeBSD.org>
AuthorDate: 2024-04-08 12:32:41 +0000
Commit:     Joel Bodenmann <jbo@FreeBSD.org>
CommitDate: 2024-04-08 12:35:18 +0000

    devel/openocd: Fix libusb for libjaylink

    We're using OpenOCD's internal redistribution of libjaylink which
    requires libusb >= 1.0.16.

    PR:             277688
    Approved by:    tcberner (mentor, implicit)

 devel/openocd/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Comment 5 Joel Bodenmann freebsd_committer freebsd_triage 2024-04-08 12:36:42 UTC
Should be fixed - Thank you for reporting this and thank you for your patience!