title: Official V4L2 Driver for raspberry pi, how do I add lrt flags to a makefile?
body: <p>I am creating a small python application that uses v4l on the raspberry pi. After hours of troubleshooting I'm close to installing it. I just need to compile the Official V4L2 Driver. </p>
  
  <p>I'm following this tutorial <a href="https://www.ics.com/blog/raspberry-pi-camera-module#.VAaCHqM0_YQ" rel="nofollow">https://www.ics.com/blog/raspberry-pi-camera-module#.VAaCHqM0_YQ</a>  </p>
  
  <p>When I get to the make step I get this error: <code>undefined reference to symbol 'clock_gettime'</code></p>
  
  <p>A Google search tells me that I need to "Add -lrt to the list of libraries you link to", or put it in the makefile. I don't know anything about make and configure. I tried to read a little but I am doing this for work and don't have time to take a course. I don't know what to do... Please help...</p>
  
  <p>I should also mention that I just dont know do I change makefile or makefile.in or configure? I tried to place <code>"-lrt"</code> in makefile but it is complicated and confusing to figure out where to put it.</p>
  
  <p>Here is the actual error:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I tried to edit Makefile and found a that read "LIBS=" and I changed it to "LIBS=-lrt", This didn't work.</p>
  
  <p>I found line 388 in the Makefile this is what it reads in that area:</p>
  
  <pre><code># 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 &amp;&amp; $(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"
  </code></pre>
  
  <p>So I tried to run make like this: make CFLAGS='-lrt', That didn't do anything.
  I looked at config.status and this is another confusing file.</p>