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

Link order issue with libusb #1885

Closed
SirLynix opened this issue Dec 4, 2021 · 2 comments
Closed

Link order issue with libusb #1885

SirLynix opened this issue Dec 4, 2021 · 2 comments
Labels

Comments

@SirLynix
Copy link
Member

SirLynix commented Dec 4, 2021

Describe the bug

I have a CI failing because of a linking order issue with one of the dep of libusb (udev).

Here's the run: https://github.com/SirLynix/obs-kinect/runs/4413978328

We can see that it test correctly libusb (usb-1.0 then udev):

checking for c includes(libusb-1.0/libusb.h)
checking for c funcs(libusb_init)
checking for c links(usb-1.0, udev, pthread)
checking for c snippet(has_cfuncs)
=> install libusb v1.0.24 .. ok

But with one dependency that uses libusb (libfreenect), it fails:
https://github.com/SirLynix/obs-kinect/runs/4413978328?check_suite_focus=true#step:11:3192

checking for c includes(libfreenect/libfreenect.h)
checking for c funcs(freenect_init)
checking for c links(freenect, udev, usb-1.0, pthread)
checking for c snippet(has_cfuncs)
error: /usr/bin/ld: /home/runner/.config/.xmake/packages/l/libusb/v1.0.24/29cd4120aa6849118d1fbd13749847f7/lib/libusb-1.0.a(linux_udev.o): in function linux_udev_start_event_monitor': linux_udev.c:(.text+0xb4): undefined reference to udev_new'

udev got in front of usb-1.0, which fails as usb-1.0 requires udev.

I don't know why that happens, and I can't reproduce it on my computer where the link order is correct:

> checking for c includes(libfreenect/libfreenect.h)
> checking for c funcs(freenect_init)
> checking for c links(freenect, usb-1.0, udev, pthread)
> checking for c snippet(has_cfuncs)
  => install libfreenect v0.6.2 .. ok

Expected behavior

That the link order is correct on the CI.

Related Environment

  • xmake version: 2.6.1
  • os: Ubuntu-latest on CI
@SirLynix SirLynix added the bug label Dec 4, 2021
@waruqi
Copy link
Member

waruqi commented Dec 4, 2021

I have fixed it.

@SirLynix
Copy link
Member Author

SirLynix commented Dec 4, 2021

I can confirm it works, thanks!

@SirLynix SirLynix closed this as completed Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants