-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add support for non-system usb library on Linux #36
base: master
Are you sure you want to change the base?
Add support for non-system usb library on Linux #36
Conversation
I have the same comment about this as I did about your asyn PR for tirpc. It is a slippery slope. There are lots of other EPICS modules that use libusb or libusb-1.0. Why do you have a PR for usb here, but not in asyn? What is the reason for not installing usb as a system library? Your PR has many instances like this:
That usually won't work if STATIC_BUILD=YES because the EPICS build system will look for a .a file, but often only a .so file exists. This can be worked around by always using SYS_LIBS. If USB_DIR is defined it will search there for SYS_LIBS and will correctly use the .so file. See the documented example here: https://github.com/areaDetector/ADSpinnaker/blob/0decb23f6602c88e775c11e67082b81535cd306c/iocs/spinnakerIOC/spinnakerApp/src/Makefile#L28 |
Hmm, because it wasn't revealed when I compiled asyn, so I didn't realize that asyn had a dependency on that.
Same as for the asyn PR for tirpc.
Interesting. I would say that that's a bug for the |
That is because by default when linking a library on Linux it does not actually check the dependent libraries to make sure the symbols exist. So on Linux you can omit the LIB_LIBS libraries and not get an error. But on Windows you will get an error, because it does check when linking DLLs.
.a files no longer exist for system libraries on Linux, but we can still build static binaries that use them. Similarly, many vendors distribute Linux libraries for their devices, but typically only .so files, not .a files. When building a static executable those need to be listed in SYS_LIBS, not _LIBS. |
Yes, I understand the rationale. There are lots of places where those comments in Makefiles (and CONFIG_SITE files) will be needed if you want to be consistent. The user still needs to edit files to enable non-system locations, but at least they are just removing comment characters. |
Re using
|
6307599
to
a331eda
Compare
I force-pushed to this PR the change that I thought was what you were suggesting that doesn't work to make sure we're on the same page. |
When you build usb-1.0 locally does it produce both a .so and a .a file? If you go back to _LIBS rather than _SYS_LIBS does a static build work? |
Yes:
I added
|
Run ldd on both dynamically and statically built versions and see what libraries they depend on. |
With
Without
|
a331eda
to
0bd3815
Compare
Force-pushed to get back to what was tested last and what produced the with and without |
Add support for building against a
usb
library on Linux that is not a system library.