Raspberry PI program makes 'undefined reference to symbol' clock_gettime@@GLIBC_2.4' error, etc.

Asked 2 years ago, Updated 2 years ago, 88 views

While reading the January 2014 issue of Interface, Raspberry Pie x Camera for authentic image processing, I am trying to run the Raspberry PI camera module with OpenCV.

I'm going to compile and run on page 36, but when I try to $make after CMakeLists.txt is cmake,

Linking CXX executable simpleface
/usr/bin/ld:CMakeFiles/simpleface.dir/simpleface.cpp.o: undefined reference to symbol'clock_gettime@@GLIBC_2.4'
// lib/arm-linux-gnueabihf/librt.so.1: error adding symbols:DSO missing from command line
collect2 —ld returned 1 exit status
CMakeFiles/simpleface.dir/build.make:183:recipe for target'simpleface'failed
make[2]:***[simpleface] Error 1
CMakeFiles/Makefile2:63:recipe for target'CMakeFiles/simpleface.dir/all'failed
make[1]:***[CMakeFiles/simpleface.dir/all] Error 2
Makefile:75:recipe for target 'all' failed
make: ***[all] Error 2

make I can't...

I also looked at the blog post Think RPI:OpenCV and Pi Camera Board, but I still get the same error.

If you know what to do, please take care of me.

opencv raspberry-pi makefile

2022-09-30 20:16

2 Answers

There seems to be a difference in the library, so for now...

$sudo apt-get update
$ sudo apt-get upgrade
$ sudorpi-update
$ sudo reboot

Why don't you try and try again?(It will take some time.)
Using OpenCV with gcc and CMake was fine.

By the way, the glibc version is as follows:

$/lib/arm-linux-gnueabihf/libc.so.6
GNUC Library (Debian EGLIBC 2.13-38 + rpi2 + deb7u6) stable release version 2.13, by Roland McGrath et al.
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.6.3.
Compiled on a Linux 3.2.51 system on 2015-01-11.
Available extensions:
        crypto add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josephson
        Native POSIX Threads Library by Ulrich Drepper et al
        Support for some architectures added on, not maintained in glibc core.
        BIND-8.2.3-T5B
libc ABIs:UNIQUE
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
$

I tried using 2014-12-24- wheezy-raspbian.img with a beautiful heart, but somehow it came out.

(Correction) If you are using the latest Raspbian from the beginning, 2.13 is the start, so the following is a complete delusion, so I will withdraw it.(I feel like I have to look at the original CMakeLists.txt to see how OpenCV is put in.)

When I was doing it, I realized that I don't have a magazine, so I can imagine that OpenCV is being introduced by making it from the source code.
If so, I am delusional that the reason for the error is that there is a conflict between the glibc version when I created the OpenCV library and the current glibc version.

Other dependent libraries may also be affected, so there may be other problems besides the timing of OpenCV make, so I can't say for sure, but if the delusion is correct,

Once you uninstall OpenCV using here, you can re-make it in your environment or leave it to Raspbian's package management if the program you are creating does not depend on latest features and use apt-get

If apt-get is acceptable, after uninstalling OpenCV, for example,

$sudo apt-get install libopencv-dev
$ sudo apt-get install cmake

If so,

$mkdir opencv_test
$ cdopencv_test
$ vi DisplayImage.cpp
...
$ viCMakeLists.txt
...
$ cmake
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc --works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info-done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ --works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info-done
-- Configuring done
-- Generating done
-- Build files have been written to :/home/pi/opencv
$ make
Scanning dependencies of target DisplayImage
[100%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o
Linking CXX executable DisplayImage
[100%] Build target DisplayImage
$

(DisplayImage.cpp and CMakeLists.txt remain Using OpenCV with gcc and CMake above.)
I think I will be able to do things like that.


2022-09-30 20:16

You seem to be using Realtime Extensions, but is rt included in the CMakeLists.txt setting?
To CMakeLists.txt

target_link_libraries(...rt...)

As shown in , I don't think I can use Realtime Extensions (clock_gettime) without rt.

Also check if librt.so itself exists.


2022-09-30 20:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.