librealsense: ./scripts/patch-arch.sh fails in Arch Linux


Required Info
Camera Model SR305 / D415
Firmware Version ----------------
Operating System & Version Arch Linux
Kernel Version (Linux Only) 5.7.10-arch1-1
Platform PC
SDK Version ----------------
Language python
Segment other

Issue Description

Hello, I’m trying to install librealsense according to https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md in conjuction with https://github.com/IntelRealSense/librealsense/issues/4271.

When I run ./scripts/patch-arch.sh I get the following output:

Extract the kernel
RealSense patch...
patching file drivers/media/usb/uvc/Makefile
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file drivers/media/usb/uvc/Makefile.rej
patching file drivers/media/usb/uvc/uvc_driver.c
Hunk #1 succeeded at 214 with fuzz 2 (offset 66 lines).
patching file drivers/media/usb/uvc/uvcvideo.h
Hunk #1 succeeded at 129 with fuzz 2 (offset 10 lines).
patching file include/uapi/linux/videodev2.h
Hunk #1 FAILED at 621.
1 out of 1 hunk FAILED -- saving rejects to file include/uapi/linux/videodev2.h.rej
patching file drivers/media/usb/uvc/uvc_driver.c
Hunk #1 succeeded at 2983 (offset 77 lines).
patching file drivers/media/usb/uvc/uvcvideo.h
Hunk #1 succeeded at 222 (offset 26 lines).
Prepare the build
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --syncconfig Kconfig
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  LEX     scripts/dtc/dtc-lexer.lex.c
  YACC    scripts/dtc/dtc-parser.tab.[ch]
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTCC  scripts/dtc/yamltree.o
  HOSTLD  scripts/dtc/dtc
  HOSTCXX -fPIC scripts/gcc-plugins/structleak_plugin.o
  HOSTLLD -shared scripts/gcc-plugins/structleak_plugin.so
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/bin2c
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sorttable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/sign-file
  HOSTCC  scripts/extract-cert
scripts/kconfig/conf  --oldconfig Kconfig
#
# No change to .config
#
  SYSTBL  arch/x86/include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_32_ia32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_64_x32.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_64.h
  HYPERCALLS arch/x86/include/generated/asm/xen-hypercalls.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  WRAP    arch/x86/include/generated/uapi/asm/bpf_perf_event.h
  WRAP    arch/x86/include/generated/uapi/asm/errno.h
  WRAP    arch/x86/include/generated/uapi/asm/fcntl.h
  WRAP    arch/x86/include/generated/uapi/asm/ioctl.h
  WRAP    arch/x86/include/generated/uapi/asm/ioctls.h
  WRAP    arch/x86/include/generated/uapi/asm/ipcbuf.h
  WRAP    arch/x86/include/generated/uapi/asm/param.h
  WRAP    arch/x86/include/generated/uapi/asm/poll.h
  WRAP    arch/x86/include/generated/uapi/asm/resource.h
  WRAP    arch/x86/include/generated/uapi/asm/socket.h
  WRAP    arch/x86/include/generated/uapi/asm/sockios.h
  WRAP    arch/x86/include/generated/uapi/asm/termbits.h
  WRAP    arch/x86/include/generated/uapi/asm/termios.h
  WRAP    arch/x86/include/generated/uapi/asm/types.h
  WRAP    arch/x86/include/generated/asm/early_ioremap.h
  WRAP    arch/x86/include/generated/asm/export.h
  WRAP    arch/x86/include/generated/asm/mcs_spinlock.h
  WRAP    arch/x86/include/generated/asm/dma-contiguous.h
  WRAP    arch/x86/include/generated/asm/mm-arch-hooks.h
  WRAP    arch/x86/include/generated/asm/mmiowb.h
  UPD     include/config/kernel.release
  UPD     include/generated/uapi/linux/version.h
  UPD     include/generated/utsrelease.h
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  UPD     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  UPD     include/generated/bounds.h
  UPD     include/generated/timeconst.h
  CC      arch/x86/kernel/asm-offsets.s
  UPD     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  HOSTCC   /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/fixdep.o
  HOSTLD   /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/fixdep-in.o
  LINK     /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/fixdep
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/exec-cmd.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/help.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/pager.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/parse-options.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/run-command.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/sigchain.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/subcmd-config.o
  LD       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/libsubcmd-in.o
  AR       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/libsubcmd.a
  MKDIR    /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/arch/x86/lib/
  GEN      /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/arch/x86/lib/inat-tables.c
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/arch/x86/decode.o
  LD       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/arch/x86/objtool-in.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/builtin-check.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/builtin-orc.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/check.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/orc_gen.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/orc_dump.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/elf.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/special.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/objtool.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/libstring.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/libctype.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/str_error_r.o
  CC       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/librbtree.o
  LD       /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/objtool-in.o
  LINK     /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/tools/objtool/objtool
Beginning compilation of uvc...
make: Entering directory '/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10'
  CC [M]  /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.o
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:240:11: error: ‘V4L2_PIX_FMT_RAW8’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_PAL8’?
  240 |   .fcc  = V4L2_PIX_FMT_RAW8,
      |           ^~~~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_PAL8
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:245:11: error: ‘V4L2_PIX_FMT_RW16’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_Z16’?
  245 |   .fcc  = V4L2_PIX_FMT_RW16,
      |           ^~~~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_Z16
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:250:11: error: ‘V4L2_PIX_FMT_INVZ’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_INZI’?
  250 |   .fcc  = V4L2_PIX_FMT_INVZ,
      |           ^~~~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_INZI
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:260:11: error: ‘V4L2_PIX_FMT_INVR’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_INZI’?
  260 |   .fcc  = V4L2_PIX_FMT_INVR,
      |           ^~~~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_INZI
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:265:11: error: ‘V4L2_PIX_FMT_INRI’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_INZI’?
  265 |   .fcc  = V4L2_PIX_FMT_INRI,
      |           ^~~~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_INZI
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:270:11: error: ‘V4L2_PIX_FMT_INVI’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_INZI’?
  270 |   .fcc  = V4L2_PIX_FMT_INVI,
      |           ^~~~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_INZI
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:275:11: error: ‘V4L2_PIX_FMT_RELI’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_INZI’?
  275 |   .fcc  = V4L2_PIX_FMT_RELI,
      |           ^~~~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_INZI
/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.c:280:11: error: ‘V4L2_PIX_FMT_Y8’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_Y8I’?
  280 |   .fcc  = V4L2_PIX_FMT_Y8,
      |           ^~~~~~~~~~~~~~~
      |           V4L2_PIX_FMT_Y8I
make[1]: *** [scripts/Makefile.build:267: /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc//uvc_driver.o] Error 1
make: *** [Makefile:1732: /home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc/] Error 2
make: Leaving directory '/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10'
cp: cannot stat '/home/lada/programs/librealsense/scripts/kernel/linux-5.7.10/drivers/media/usb/uvc/uvcvideo.ko': No such file or directory
Unloading existing uvcvideo driver...
modprobe: ERROR: could not insert 'uvcvideo': Unknown symbol in module, or unknown parameter (see dmesg)
Script has completed. Please consult the installation guide for further instruction.

It seems two patches failed to apply, therefore causing the compilation to fail.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25

Most upvoted comments

So it finally works! 😃 To recapitulate what I just did to make it work for others in the future:

a) I followed the steps to build pyrealsense2 wrapper from source: https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python. I needed to call cmake with python bindings and then make -j4 which created pyrealsense2 library files (.so files) in build/wrappers/python folder.

b) Now, one has to make sure Python knows about these libraries. Because I use conda, there is, I believe, no reason to change PYTHONPATH, since conda does not use it. There are many ways to achieve this as described here https://stackoverflow.com/questions/37006114/anaconda-permanently-include-external-packages-like-in-pythonpath. I executed conda develop build/wrappers/python/ which created .pth file in anaconda3/envs/ibt/lib/python3.7/site-packages folder.

From now on, I can import pyrealsense2 as rs and it works just fine.

Thank you @MartyG-RealSense for all the help! 😃