-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Compile error due to libusb in Ubuntu 19.10 #6458
Comments
I have had a case where Librealsense has been successfully built in Ubuntu 19.10 using the FORCE RSUSB method, so it should be possible. Assuming that you have an internet connection (which is a requirement of this installation method), does the build succeed if you do not include the -DBUILD_PYTHON_BINDINGS=true statement please? |
Thanks @MartyG-RealSense . I tried without -DBUILD_PYTHON_BINDINGS=true and got the same result unfortunately. |
Are you launching the CMake instruction whilst in the Build folder of Librealsense please? (Librealsense > Build) If you do not have a Build directory in your Librealsense root folder, it can be created and then navigated to by running the instruction below whilst in the Librealsense folder: mkdir build && cd build |
Thanks @MartyG-RealSense
Any other thoughts on this. |
I have never seen these libusb error messages before. It looks as though it is tripping up on building the hello-realsense example program though. Try leaving out -DBUILD_EXAMPLES=true this time please. |
It seems that the problem program hello-realsense is still being built despite removing examples from the cmake command. New cmake command is below followed by the tail of the build output. Same errors as before.
|
It looks as though you have stripped the CMake build instruction about as far as you can go. Did you do any other Librealsense installations on this computer before doing the RSUSB method? If there are multiple conflicting installations then it may be better to start with a fresh install of Linux. |
I did try using a Linux package to install it though it didn't work out so I went this route. I thought I uninstalled all remnants of the package however. Could my error be related to this issue with libusb which I found here #555 |
Though that case relates to the current SDK's predecessor Librealsense1, there is a potential for conflicts in any situation where you have files with the same filename and different ages. |
I noticed I have a libusb-0.1-4 on my system as well. Maybe that is causing an issue? /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4 /usr/share/doc/libusb-0.1-4 /usr/share/doc/libusb-0.1-4/README.Debian /usr/share/doc/libusb-0.1-4/changelog.Debian.gz /usr/share/doc/libusb-0.1-4/copyright /lib/x86_64-linux-gnu/libusb-0.1.so.4 `
|
I found an older Librealsense1 case where an old libusb file was also causing the libusb_get_port_numbers error: |
Thanks @MartyG-RealSense . I uninstalled libusb-0.1-4 but still no change. such a mystery.. |
I'm not sure why it would be having such difficulty over building a simply constructed program such as rs-hello-realsense.cpp If you have another PC available, you could try installing it on that and see if it makes a difference. |
I did further research and found other cases where the build fails at 59%, at the same step (hello-realsense) or the step directly after it (software-device). One user with this problem solved it by explicitly stating -DBUILD_EXAMPLES=false in their CMake instruction. |
Thank you I will try this later today and get back to you. It would be nice however to be able to build the examples but one step at a time I guess. |
Ok @MartyG-RealSense that worked! Thanks! Strangely it also built pyrealsense2 even though it wasn't asked to build the python bindings? It seems as if there is something wrong with the cmake flags. The command I used is
Now any thoughts on how I can build the examples? |
Great news - congratulations! Advice on only building the samples is offered here: I think it means just doing this in the Build folder: cmake .. -DBUILD_EXAMPLES=true |
Yes I tried that . When building only the examples I get the same errors as previously. |
Any luck if you do make after CMake? cmake .. -DBUILD_EXAMPLES=true && make -J && sudo make install |
No that is what I tried but I get the same errors as before. |
Please try to build it "headless" (no examples that use a graphics interface such as OpenGL) in case the building of the examples is breaking due to a graphics related issue: cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false |
Ok I tried that and get the same result which I would expect since it seems to be a libusb issue, not really graphics related from what I can see. |
Would it be possible to use Ubuntu 18.04 instead, since that is more of a known quantity in regard to Librealsense installation. |
Sorry no I can't go back to 18.04. I was actually hoping to migrate up to 20.04 soon. I ran make with the -d option and here is the tail of that in case that is of use..
` |
I'm not sure that there is anything else that can be done to rescue this build. It has ended up with the same errors that were present at the start of the case (libusb_handle_events_completed and libusb_get_port_numbers). It may be better to try again with the upcoming SDK version (probably 2.35.0) or wait until you upgrade to Ubuntu 20.04, do another -DFORCE_RSUSB_BACKEND build and see if the clean and fresh Ubuntu install that 20.04 will provide on your computer removes whatever was preventing the examples from building. |
Thanks @MartyG-RealSense I guess I am a bit surprised that none of the developers have a sense from the error messages what is going wrong with the build. I don't really see downloading a new distribution as a great solution. I would prefer to know what is throwing the error message and why. |
I have never seen the 'Trying pattern rule with stem' error before. It seems to result from CMake rather than Librealsense. It is recommended to use CMake version 3.8 or newer for Librealsense building. Could you check which version you have and update to a newer one from the CMake website if it is old please? |
My cmake version is much newer that 3.8 ie. |
I will refer your case to a support manager for further guidance. I apologise for the delay in resolving your problem in the meantime. |
Thank you. I really appreciate the support. |
Ok I figured this out. I rebuilt and installed the latest libusb. This may not be necessary however what was important was to get rid of an older version of libusb-1.0.so that was in /usr/local/lib which is where librealsense2.so.2.34 lives. Installing the new libusb put it in /usr/lib . I suppose I could have linked the old libusb to this one as well but the build process was able to find the new libusb anyway. |
Thanks for the update! Is it all working okay now? |
Everything built so that's good. I am still waiting for my sensor to arrive but I think all is good. I believe we can close this issue. |
Awesome news - thanks a lot for your patience during this process. I will close the case now. Good luck! |
I am having trouble building librealsense on Ubuntu 19.10 . All builds fine till I get to these errors shown below.
/usr/bin/ld: ../../librealsense2.so.2.34.0: undefined reference tlibusb_get_port_numbers
/usr/bin/ld: ../../librealsense2.so.2.34.0: undefined reference to libusb_handle_events_completed
My cmake command is
cmake ../ -DFORCE_RSUSB_BACKEND=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true -DBUILD_PYTHON_BINDINGS=true
Any idea what I need to fix the libusb errors. The tail end of the build is shown below.
[ 59%] Building CXX object examples/hello-realsense/CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o cd /home/jim/Downloads/librealsense/build/examples/hello-realsense && ccache /usr/bin/c++ -DBUILD_EASYLOGGINGPP -DBUILD_SHARED_LIBS -DELPP_NO_DEFAULT_LOG_FILE -DELPP_THREAD_SAFE -DGLFW_DLL -DHWM_OVER_XU -DRS2_USE_LIBUVC_BACKEND -DUNICODE -I/home/jim/Downloads/librealsense/realsense2 -I/home/jim/Downloads/librealsense/src -I/home/jim/Downloads/librealsense/examples/hello-realsense/rs-hello-realsense -I/home/jim/Downloads/librealsense/build -I/home/jim/Downloads/librealsense/include -pedantic -g -Wno-missing-field-initializers -Wno-switch -Wno-multichar -Wsequence-point -Wformat -Wformat-security -mssse3 -pthread -O3 -DNDEBUG -fPIE -std=gnu++11 -o CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o -c /home/jim/Downloads/librealsense/examples/hello-realsense/rs-hello-realsense.cpp [ 59%] Linking CXX executable rs-hello-realsense cd /home/jim/Downloads/librealsense/build/examples/hello-realsense && /usr/bin/cmake -E cmake_link_script CMakeFiles/rs-hello-realsense.dir/link.txt --verbose=1 ccache /usr/bin/c++ -pedantic -g -Wno-missing-field-initializers -Wno-switch -Wno-multichar -Wsequence-point -Wformat -Wformat-security -mssse3 -pthread -O3 -DNDEBUG -rdynamic CMakeFiles/rs-hello-realsense.dir/rs-hello-realsense.cpp.o -o rs-hello-realsense -Wl,-rpath,/home/jim/Downloads/librealsense/build: ../../librealsense2.so.2.34.0 /usr/lib/x86_64-linux-gnu/libglfw.so.3.3 -lGL -lGLU /usr/bin/ld: ../../librealsense2.so.2.34.0: undefined reference to
libusb_get_port_numbers'/usr/bin/ld: ../../librealsense2.so.2.34.0: undefined reference to `libusb_handle_events_completed'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/hello-realsense/CMakeFiles/rs-hello-realsense.dir/build.make:88: examples/hello-realsense/rs-hello-realsense] Error 1
make[2]: Leaving directory '/home/jim/Downloads/librealsense/build'
make[1]: *** [CMakeFiles/Makefile2:496: examples/hello-realsense/CMakeFiles/rs-hello-realsense.dir/all] Error 2
make[1]: Leaving directory '/home/jim/Downloads/librealsense/build'
make: *** [Makefile:130: all] Error 2
`
The text was updated successfully, but these errors were encountered: