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] undefined reference to `libusb_set_option' #896

Closed
pur-jus opened this issue Mar 25, 2020 · 12 comments · Fixed by #895
Closed

[compatibility] undefined reference to `libusb_set_option' #896

pur-jus opened this issue Mar 25, 2020 · 12 comments · Fixed by #895

Comments

@pur-jus
Copy link

pur-jus commented Mar 25, 2020

Hi all,

I will try to compile the project on Windows 10 with MinGW-w64 without success.
The error is:
C:/stlink/src/sg.c:972: undefined reference to 'libusb_set_option'

My environement is:

  • Windows 10
  • texane/stlink 1.6.0 => This version requires the libusb-1.0.22.7z (downloaded manually)
  • MinGW-w64 i686-8.1.0-posix-dwarf-rt_v6-rev0

Can you help me?

Complete log of the compilation: log.txt

Thank you in advance.

Ju

@Nightwalker-87
Copy link
Member

Nightwalker-87 commented Mar 25, 2020

Please try the develop branch instead. I think there were some fixes related to libusb since Release v1.6.0.

@pur-jus
Copy link
Author

pur-jus commented Mar 25, 2020

The mentionned error isn't displayed but the compilation failed.

log_w_develop_latest_commit_a09ef54.txt

@pur-jus
Copy link
Author

pur-jus commented Mar 25, 2020

I want to add a remark.

The last log indicates that I have already libusb in my system.
-- Found Libusb: C:/Windows/System32/libusb-1.0.dll
Sure this version is old.

What is your opinion about this.

@slyshykO
Copy link
Collaborator

@purjus74 I think the problem with libusb, that you download manually.
Please remove it. Clear all builds. And try one more time.

@pur-jus
Copy link
Author

pur-jus commented Mar 25, 2020

Just to give more details:
Before to use your project, my system had already a libusb instance.
libusb_on_my_windows_10

If I let the batch mingw64-build.bat to download the libusb-1.0.22.7z, the extraction fails:

...
-- Could NOT find Libusb (missing: LIBUSB_INCLUDE_DIR)
-- downloading libusb 1.0.22

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 2601 bytes (3 KiB)

Extracting archive: C:\stlink-develop\scripts\libusb-1.0.22.7z
ERROR: C:\stlink-develop\scripts\libusb-1.0.22.7z
C:\stlink-develop\scripts\libusb-1.0.22.7z
Open ERROR: Can not open the file as [7z] archive


ERRORS:
Is not archive
...

It seems that the archive is file is corrupted :(
image

@Nightwalker-87
Copy link
Member

@slyshykO: You are right, I did not notice at first that an external libusb library was present.

@pur-jus
Copy link
Author

pur-jus commented Mar 25, 2020

I think this behavior (error during libusb-1.0.22.7z extraction) is due to my compagny protection :(
This f*#! protection creates the wanted archive file but it contains an error html page !!!

html_page

But I'm not sure that is a problem to download before the good libusb archive and put it inside the build folder.
My first log illustrates that the mingw64-build.bat finds the archive, extracts it and uses it:

-- libusb archive already in build folder

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 980895 bytes (958 KiB)

Extracting archive: C:\stlink\scripts\libusb-1.0.22.7z
--
Path = C:\stlink\scripts\libusb-1.0.22.7z
Type = 7z
Physical Size = 980895
Headers Size = 682
Method = LZMA2:23 BCJ
Solid = +
Blocks = 2

Everything is Ok

@Nightwalker-87
Copy link
Member

@purjus74: Does your whole compilation succeed now?
@slyshykO: I think we should add a note to the instructions on not to use external libusb packages when installing on windows, as this is not the first issue of its kind.

@slyshykO
Copy link
Collaborator

The problem is that windows have many options on how to install libusb, also many compilers with different ABI. That is why we should provide windows builds.

@pur-jus
Copy link
Author

pur-jus commented Mar 25, 2020

I just tried on other machine (without old libusb inside C:\Windows\System32) and it's work (with develop branch, last commit #a09ef54).
Therefore, the problem is due to other libusb version already stored and used by the others projects.

@pur-jus
Copy link
Author

pur-jus commented Mar 25, 2020

Thank you for your support and for your job ;)

@Nightwalker-87
Copy link
Member

Reopening this as documentation and related work remains outstanding...

@Nightwalker-87 Nightwalker-87 linked a pull request Mar 27, 2020 that will close this issue
@Nightwalker-87 Nightwalker-87 changed the title undefined reference to `libusb_set_option' [compatibility] undefined reference to `libusb_set_option' Mar 28, 2020
@Nightwalker-87 Nightwalker-87 linked a pull request Apr 3, 2020 that will close this issue
Nightwalker-87 added a commit that referenced this issue Apr 3, 2020
- Added info on version support
- Updated compiling instructions
- Minor formatting fixes

(Closes #896, #897)
Nightwalker-87 added a commit that referenced this issue Apr 4, 2020
- Added info on version support
- Updated compiling instructions
- Updated minGW-w64 gcc-TC to v8.1.0
- Minor formatting fixes

(Closes #896, #897, #899)
grevaillot pushed a commit to grevaillot/stlink that referenced this issue Apr 10, 2020
- Added info on version support
- Updated compiling instructions
- Updated minGW-w64 gcc-TC to v8.1.0
- Minor formatting fixes

(Closes stlink-org#896, stlink-org#897, stlink-org#899)
@stlink-org stlink-org locked as resolved and limited conversation to collaborators May 6, 2020
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.

3 participants