librealsense: Build error v2.50.0 SDK without patching Kernel

Issue Description

I want to use realsense-ros with ROS1, it recommands to use v2.50.0 SDK, the apt get seems only install last stable version, so I have to install from source following installation.md. The problem is my corporation IT do not allow disabling secure-boot, so I can’t patch the kernel. I build v2.50.0 with DFORCE_RSUSB_BACKEND=true flag, it shows following error:

[ 99%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/easyloggingpp/src/easylogging++.cc.o
[100%] Linking CXX executable realsense-viewer
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(easy.c.o): relocation R_X86_64_32S against symbol `malloc@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(getinfo.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(mime.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(mprintf.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(multi.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(progress.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(rand.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(sendf.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(setopt.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(share.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(socketpair.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(socks.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(speedcheck.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(strerror.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(transfer.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(url.c.o): relocation R_X86_64_32S against symbol `fwrite@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(urlapi.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(vtls.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(altsvc.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(asyn-thread.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(base64.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(conncache.c.o): relocation R_X86_64_32 against hidden symbol `Curl_hash_str' can not be used when making a PIE object
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(connect.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(content_encoding.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(cookie.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(curl_ctype.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(curl_threads.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(dotdot.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(escape.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(hash.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(hostip.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(http.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(http_chunks.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(http_proxy.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(inet_ntop.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(netrc.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(parsedate.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(openssl.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(doh.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(formdata.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(hostcheck.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(keylog.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make[2]: *** [tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/build.make:498: tools/realsense-viewer/realsense-viewer] Error 1
make[1]: *** [CMakeFiles/Makefile2:2076: tools/realsense-viewer/CMakeFiles/realsense-viewer.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/on-chip-calib.cpp.o
[ 96%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/updates-model.cpp.o
[ 97%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/sw-update/http-downloader.cpp.o
[ 97%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/sw-update/dev-updates-profile.cpp.o
[ 97%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/sw-update/versions-db-manager.cpp.o
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/reflectivity/reflectivity.cpp.o
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/common/utilities/imgui/wrap.cpp.o
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/rs-depth-quality.cpp.o
[ 98%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/depth-quality-model.cpp.o
[ 99%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/imgui/imgui.cpp.o
[ 99%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/imgui/imgui_draw.cpp.o
[ 99%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/imgui/imgui_impl_glfw.cpp.o
[100%] Building C object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/glad/glad.c.o
[100%] Building C object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/tinyfiledialogs/tinyfiledialogs.c.o
[100%] Building CXX object tools/depth-quality/CMakeFiles/rs-depth-quality.dir/__/__/third-party/easyloggingpp/src/easylogging++.cc.o
[100%] Linking CXX executable rs-depth-quality
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(easy.c.o): relocation R_X86_64_32S against symbol `malloc@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(getinfo.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(mime.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(mprintf.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(multi.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(progress.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(rand.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(sendf.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(setopt.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(share.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(socketpair.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(socks.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(speedcheck.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(strerror.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(transfer.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(url.c.o): relocation R_X86_64_32S against symbol `fwrite@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(urlapi.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(vtls.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(altsvc.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(asyn-thread.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(base64.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(conncache.c.o): relocation R_X86_64_32 against hidden symbol `Curl_hash_str' can not be used when making a PIE object
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(connect.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(content_encoding.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(cookie.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(curl_ctype.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(curl_threads.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(dotdot.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(escape.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(hash.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(hostip.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(http.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(http_chunks.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(http_proxy.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(inet_ntop.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(netrc.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(parsedate.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(openssl.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(doh.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(formdata.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(hostcheck.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../libcurl/libcurl_install/lib/libcurl.a(keylog.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make[2]: *** [tools/depth-quality/CMakeFiles/rs-depth-quality.dir/build.make:513: tools/depth-quality/rs-depth-quality] Error 1
make[1]: *** [CMakeFiles/Makefile2:2106: tools/depth-quality/CMakeFiles/rs-depth-quality.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Required Info
Camera Model D400
Firmware Version NA
Operating System & Version Linux (Ubuntu 20.04)
Kernel Version (Linux Only) 5.4.0-136-generic
Platform PC
SDK Version v2.50.0
Language C
Segment Robot

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21

Most upvoted comments

Finally, I manage to make it work by

sudo apt install librealsense2=2.50.0-0~realsense0.6128 librealsense2-gl=2.50.0-0~realsense0.6128 librealsense2-net=2.50.0-0~realsense0.6128
sudo apt install librealsense2-utils=2.50.0-0~realsense0.6128

if using the wrapper’s Method 1 worked for you but you need to install your own custom version of the wrapper, a workaround may be:

  1. Install both librealsense and the wrapper from packages with Method 1.

  2. Remove the RealSense ROS1 Noetic wrapper package.

sudo apt-get remove ros-noetic-realsense2-camera

  1. Build your custom ROS1 wrapper from source code.