【问题标题】:Official V4L2 Driver for raspberry pi, how do I add lrt flags to a makefile?用于树莓派的官方 V4L2 驱动程序,如何将 lrt 标志添加到 makefile?
【发布时间】:2014-09-03 06:03:21
【问题描述】:

我正在创建一个在树莓派上使用 v4l 的小型 python 应用程序。经过数小时的故障排除后,我即将安装它。我只需要编译Official V4L2 Driver。

我正在关注这个教程https://www.ics.com/blog/raspberry-pi-camera-module#.VAaCHqM0_YQ

当我进入 make 步骤时,我收到此错误:undefined reference to symbol 'clock_gettime'

Google 搜索告诉我,我需要“将 -lrt 添加到您链接到的库列表中”,或者将其放入 makefile 中。我对制作和配置一无所知。我试着读了一点,但我这样做是为了工作,没有时间参加课程。我不知道该怎么办...请帮助...

我还应该提到,我只是不知道我应该更改 makefile 或 makefile.in 还是配置?我试图将"-lrt" 放在makefile 中,但要弄清楚它放在哪里很复杂。

这是实际的错误:

Making all in v4l2-compliance
make[3]: Entering directory '/home/pi/v4l-utils/utils/v4l2-compliance'
  CXXLD  v4l2-compliance
/usr/bin/ld: v4l2-test-buffers.o: undefined reference to symbol 'clock_gettime@@
GLIBC_2.4'
//lib/arm-linux-gnueabihf/librt.so.1: error adding symbols: DSO missing from com
mand line
collect2: ld returned 1 exit status
Makefile:388: recipe for target 'v4l2-compliance' failed
make[3]: *** [v4l2-compliance] Error 1
make[3]: Leaving directory '/home/pi/v4l-utils/utils/v4l2-compliance'
Makefile:347: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/pi/v4l-utils/utils'
Makefile:386: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/v4l-utils'
Makefile:315: recipe for target 'all' failed
make: *** [all] Error 2

我尝试编辑 Makefile 并找到一个读取“LIBS=”的文件,然后将其更改为“LIBS=-lrt”,这不起作用。

我在 Makefile 中找到了第 388 行,这是它在该区域中读取的内容:

# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
#     (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
    @fail= failcom='exit 1'; \
    for f in x $$MAKEFLAGS; do \
      case $$f in \
        *=* | --[!k]*);; \
        *k*) failcom='fail=yes';; \
      esac; \
    done; \
    dot_seen=no; \
    target=`echo $@ | sed s/-recursive//`; \
    list='$(SUBDIRS)'; for subdir in $$list; do \
      echo "Making $$target in $$subdir"; \
      if test "$$subdir" = "."; then \
        dot_seen=yes; \
        local_target="$$target-am"; \
      else \
        local_target="$$target"; \
      fi; \
      ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
      || eval $$failcom; \
    done; \
    if test "$$dot_seen" = "no"; then \
      $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
    fi; test -z "$$fail"

所以我尝试像这样运行 make:make CFLAGS='-lrt',但什么也没做。 我查看了 config.status,这是另一个令人困惑的文件。

【问题讨论】:

  • 我也遇到了make 的问题,在阅读自述文件后发现必须在 ./configure 之前运行 ./bootstrap.sh,这在 ics.com 教程中没有提到。

标签: python makefile raspberry-pi v4l2


【解决方案1】:

这也有效:-

LDFLAGS=-lrt ./configure
make

【讨论】:

    【解决方案2】:

    好吧,我付钱给了一位顾问,他让我更改两个不同的文件。

    第一个文件:
    /v4l-utils/utils/v4l2-compliance/Makefile

    第二个文件:
    /v4l-utils/utils/v4l2-ctl/Makefile

    将带有“LDFLAGS =”的行更改为“LDFLAGS = -lrt”

    之后 V4l2 在 Raspberry Pi 上编译得很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-28
      • 1970-01-01
      • 2019-02-14
      • 2022-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-16
      相关资源
      最近更新 更多