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

[compatibility] LIBUSBX_API_VERSION undef #782

Closed
goog opened this issue Mar 18, 2019 · 17 comments · Fixed by #895
Closed

[compatibility] LIBUSBX_API_VERSION undef #782

goog opened this issue Mar 18, 2019 · 17 comments · Fixed by #895

Comments

@goog
Copy link

goog commented Mar 18, 2019

build on ubuntu12.04

cheng@ubuntu:~/stlink$ pkg-config --libs --cflags libusb-1.0
-I/usr/include/libusb-1.0 -lusb-1.0

/home/cheng/stlink/src/sg.c: In function ‘stlink_open’:
/home/cheng/stlink/src/sg.c:969:5: error: "LIBUSBX_API_VERSION" is not defined [-Werror=undef]
cc1: all warnings being treated as errors

I make it pass by this

#define LIBUSB_API_VERSION 0x01000105
#define LIBUSBX_API_VERSION LIBUSB_API_VERSION 
#if LIBUSBX_API_VERSION < 0x01000106
    libusb_set_debug(slsg->libusb_ctx, 3);

but i dont know is it the right method for me.

@xor-gate
Copy link
Member

This is bug, it must compile on Ubuntu. I know there are some differences between libusb versions.

@goog
Copy link
Author

goog commented Mar 27, 2019

what i have changed will have a side effect on flash program? @xor-gate

@xor-gate
Copy link
Member

Sorry @goog for the late reply, no it will not effect the working of the flashing of the binary data to the controller.

@goog goog closed this as completed May 23, 2019
@xor-gate xor-gate reopened this May 31, 2019
@xor-gate xor-gate added this to the Unplanned (Contributions Welcome) milestone May 31, 2019
@xor-gate
Copy link
Member

xor-gate commented May 31, 2019

We need a patch for this, so reopened

@Nightwalker-87 Nightwalker-87 modified the milestones: Unplanned (Contributions Welcome), Next Feb 19, 2020
@Nightwalker-87
Copy link
Member

Nightwalker-87 commented Feb 22, 2020

Please verify if the problem still exists in Release v1.6.0.
I can find these code lines in /src/sg.c, as this problem seems to be related to #733 which targeted FreeBSD. Therefore this does not help you with Ubuntu: #if defined (__FreeBSD__)
This condition should be defined in such a way that all affected operating systems are listed and not only FreeBSD. Please comment on this.

@Nightwalker-87 Nightwalker-87 modified the milestones: General, Feedback required Feb 22, 2020
@Nightwalker-87 Nightwalker-87 self-assigned this Feb 22, 2020
@slyshykO
Copy link
Collaborator

LIBUSB_API_VERSION defined since libusb 1.0.13.
The lastest supported Ubuntu 16.04 provide libusb 1.0.20.

Also LIBUSB_API_VERSION for FreeBSD almost 4 years (https://svnweb.freebsd.org/base/head/lib/libusb/libusb.h?revision=301957&view=markup)

@Nightwalker-87
Copy link
Member

Thanks for the feedback @slyshykO !

Debian Jessie (oldoldstable), which is currently the oldest Debian distribution version supported, uses libusb 1.0.19. Taking the Debian project as a reference for longterm support (oldoldstable branch) this would mean that we are looking back to 2015 when this version was released. This is 5 years in time. Looking at this, I feel like no one should expect the stlink project to ensure full software compatibility dating back any longer. We don't do ourself any favour with this.

To me this would imply that we completely throw out LIBUSBX_API_VERSION and have it replaced with LIBUSB_API_VERSION. @bmarvo any other thoughts on this?

@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, v1.6.1 Feb 22, 2020
@Nightwalker-87
Copy link
Member

@slyshykO: #211 told me something about the background of this issue. This is where LIBUSBX_API_VERSION comes from. I think we should get rid of this now, as it is still found in /src/sg.c L940ff. It smells... <º))))>< ...rotten. :-D We neither need it nor do I like to keep it.

@slyshykO
Copy link
Collaborator

@Nightwalker-87
Copy link
Member

Yes, I came across that somewhere else in relation to the mentioned issue above.
It doesn't change my opinion though...

@Nightwalker-87
Copy link
Member

EDIT: ...BUT as #733 reveals by the state of August 2018: At least FreeBSD v11.3 still seems to rely on it, as they indeed appear to use an old version. Can a FreeBSD user clarify or confirm this to ensure we do not run into a regression here? BTW: What about Fedora (see #211)? We may not care about the remaining distros in that list.

@slyshykO
Copy link
Collaborator

LIBUSB_API_VERSION defined since libusb 1.0.13.
The lastest supported Ubuntu 16.04 provide libusb 1.0.20.

Also LIBUSB_API_VERSION for FreeBSD almost 4 years (https://svnweb.freebsd.org/base/head/lib/libusb/libusb.h?revision=301957&view=markup)

This

@Nightwalker-87
Copy link
Member

Nightwalker-87 commented Mar 23, 2020

Sorry, I missed the second part of it. :$
Let's get rid of it then... <º))))>< --> |_|

@slyshykO
Copy link
Collaborator

My opinion is since libusbx reunited with libusb in 2014 we should not care about it.

@Nightwalker-87
Copy link
Member

I'm on about this:

... is still found in /src/sg.c L940ff.

@Nightwalker-87
Copy link
Member

I agree that cleaning this up does close this ticket as well as #211.

Nightwalker-87 added a commit that referenced this issue Mar 23, 2020
Nightwalker-87 added a commit that referenced this issue Mar 24, 2020
@Nightwalker-87 Nightwalker-87 linked a pull request Mar 26, 2020 that will close this issue
@Nightwalker-87 Nightwalker-87 changed the title LIBUSBX_API_VERSION undef [compatibility] LIBUSBX_API_VERSION undef Mar 26, 2020
@Nightwalker-87
Copy link
Member

Reopening this, as topic is not solved by now.

grevaillot pushed a commit to grevaillot/stlink that referenced this issue Mar 31, 2020
grevaillot pushed a commit to grevaillot/stlink that referenced this issue Mar 31, 2020
@Nightwalker-87 Nightwalker-87 linked a pull request Apr 2, 2020 that will close this issue
grevaillot pushed a commit to grevaillot/stlink that referenced this issue Apr 6, 2020
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 23, 2020
@Nightwalker-87 Nightwalker-87 moved this to Done in Release v1.6.1 Apr 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants