Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Trying to Install OpenCV with CMake on Raspberry Pi 3+

Hola. I have been trying to install OpenCV with CMake for the last two weeks on my Raspberry Pi 3+. I have tried around ten different tutorials just trying to get it to work, but I always have a problem at the same spot where I start the compilation of OpenCV Python. Anywhere between the 30% and 70% mark, usually, I always get the same error. I have looked everywhere for a solution with no results. I've reflashed my SD card so many times with different Raspbian images and doing my best with workarounds, I am not savvy with all this coding and stuff. I'm just trying to follow these tutorials so I can get an OpenCV People Counter working for my little shop. If anyone could help me, I'd greatly appreciate it.

/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/build.make:66: modules/core/precomp.hpp.gch/opencv_core_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:2896: modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2

make[1]: * Waiting for unfinished jobs.... /usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/ts/CMakeFiles/pch_Generate_opencv_ts.dir/build.make:66: modules/ts/precomp.hpp.gch/opencv_ts_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:8173: modules/ts/CMakeFiles/pch_Generate_opencv_ts.dir/all] Error 2 /usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/imgproc/CMakeFiles/pch_Generate_opencv_imgproc.dir/build.make:66: modules/imgproc/precomp.hpp.gch/opencv_imgproc_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:3228: modules/imgproc/CMakeFiles/pch_Generate_opencv_imgproc.dir/all] Error 2 /usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/imgcodecs/CMakeFiles/pch_Generate_opencv_imgcodecs.dir/build.make:66: modules/imgcodecs/precomp.hpp.gch/opencv_imgcodecs_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:6108: modules/imgcodecs/CMakeFiles/pch_Generate_opencv_imgcodecs.dir/all] Error 2

make: * [Makefile:163: all] Error 2

Trying to Install OpenCV with CMake on Raspberry Pi 3+

Hola. I have been trying to install OpenCV with CMake for the last two weeks on my Raspberry Pi 3+. I have tried around ten different tutorials just trying to get it to work, but I always have a problem at the same spot where I start the compilation of OpenCV Python. Anywhere between the 30% and 70% mark, usually, I always get the same error. I have looked everywhere for a solution with no results. I've reflashed my SD card so many times with different Raspbian images and doing my best with workarounds, I am not savvy with all this coding and stuff. I'm just trying to follow these tutorials so I can get an OpenCV People Counter working for my little shop. If anyone could help me, I'd greatly appreciate it.

/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/build.make:66: modules/core/precomp.hpp.gch/opencv_core_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:2896: modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2

make[1]: * Waiting for unfinished jobs.... /usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/ts/CMakeFiles/pch_Generate_opencv_ts.dir/build.make:66: modules/ts/precomp.hpp.gch/opencv_ts_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:8173: modules/ts/CMakeFiles/pch_Generate_opencv_ts.dir/all] Error 2 /usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/imgproc/CMakeFiles/pch_Generate_opencv_imgproc.dir/build.make:66: modules/imgproc/precomp.hpp.gch/opencv_imgproc_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:3228: modules/imgproc/CMakeFiles/pch_Generate_opencv_imgproc.dir/all] Error 2 /usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/8/../../../arm-linux-gnueabihf/crt1.o: in function `_start':

(.text+0x34): undefined reference to `main'

collect2: error: ld returned 1 exit status

make[2]: * [modules/imgcodecs/CMakeFiles/pch_Generate_opencv_imgcodecs.dir/build.make:66: modules/imgcodecs/precomp.hpp.gch/opencv_imgcodecs_Release.gch] Error 1

make[1]: * [CMakeFiles/Makefile2:6108: modules/imgcodecs/CMakeFiles/pch_Generate_opencv_imgcodecs.dir/all] Error 2

make: * [Makefile:163: all] Error 2

Also, if anyone cares to know, these are a few of the tutorials I have tried to follow along with and I always get stuck at this issue. https://linuxize.com/post/how-to-install-opencv-on-raspberry-pi/#disqus_thread https://tutorials-raspberrypi.com/installing-opencv-on-the-raspberry-pi/ https://www.learnopencv.com/install-opencv-4-on-raspberry-pi/ https://www.pyimagesearch.com/2018/08/13/opencv-people-counter/