BreeeZe / rpos

Raspberry Pi Onvif Server
http://breeeze.github.io/rpos
MIT License
643 stars 146 forks source link

error compiling v4l2rtspserver main.cpp #93

Open edefranco opened 3 years ago

edefranco commented 3 years ago

Hi, I try to install rpos on a RPI B+ with wheezy, gcc updated to 4.9.2, cmake 3.0.2 and kernel 4.1.19+, npm 8.4.0

I followed the instructions and all go fine until point 5.b: when I execute sh setup_v4l2rtspserver.sh, when starting compiling, I get this error: `[100%] Building CXX object CMakeFiles/v4l2rtspserver.dir/main.cpp.o

/root/rpos/v4l2rtspserver/main.cpp: In function ‘std::string getV4l2Alsa(const string&)’:

/root/rpos/v4l2rtspserver/main.cpp:157:58: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 deviceid = std::string(std::istreambuf_iterator{ifsd}, {});

/root/rpos/v4l2rtspserver/main.cpp:157:66: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 deviceid = std::string(std::istreambuf_iterator{ifsd}, {});

/root/rpos/v4l2rtspserver/main.cpp:179:70: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 std::string deviceid = std::string(std::istreambuf_iterator{ifs}, {});

/root/rpos/v4l2rtspserver/main.cpp:179:77: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 std::string deviceid = std::string(std::istreambuf_iterator{ifs}, {});

/root/rpos/v4l2rtspserver/main.cpp:197:7: error: ‘deviceid’ does not name a type auto deviceid = videodevices.find(getDeviceName(v4l2device));

/root/rpos/v4l2rtspserver/main.cpp:198:6: error: ‘deviceid’ was not declared in this scope if (deviceid != videodevices.end()) {

/root/rpos/v4l2rtspserver/main.cpp:199:8: error: ‘audioDeviceIt’ does not name a type auto audioDeviceIt = audiodevices.find(deviceId->second);

/root/rpos/v4l2rtspserver/main.cpp:201:7: error: ‘audioDeviceIt’ was not declared in this scope if (audioDeviceIt != audiodevices.end()) {

CMakeFiles/v4l2rtspserver.dir/build.make:54: set di istruzioni per l'obiettivo "CMakeFiles/v4l2rtspserver.dir/main.cpp.o" non riuscito

make[2]: *** [CMakeFiles/v4l2rtspserver.dir/main.cpp.o] Errore 1

CMakeFiles/Makefile2:96: set di istruzioni per l'obiettivo "CMakeFiles/v4l2rtspserver.dir/all" non riuscito

make[1]: *** [CMakeFiles/v4l2rtspserver.dir/all] Errore 2

Makefile:147: set di istruzioni per l'obiettivo "all" non riuscito

make: *** [all] Errore 2`

I am not a programmer, I don't understand the problem ... there are some one that can help me ?

Thank in advance,

Emilio

edefranco commented 3 years ago

searching on google I understand that the problem was related to compiler directive. Changing in the file CMakeList.txt into the dir v4l2rtspserver the row:

set(CMAKE_CXX_STANDARD 11)

into

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

the error is resolved, but now, during the execution of cmake (or make I don't know) before execute make install there are this:

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Configuring done CMake Error at CMakeLists.txt:25 (add_executable): Target "v4l2rtspserver" links to target "Threads::Threads" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

and, during the execution of make install:

Linking CXX executable v4l2rtspserver /usr/bin/ld: impossibile trovare -lThreads::Threads collect2: error: ld returned 1 exit status CMakeFiles/v4l2rtspserver.dir/build.make:89: set di istruzioni per l'obiettivo "v4l2rtspserver" non riuscito make[2]: [v4l2rtspserver] Errore 1 CMakeFiles/Makefile2:96: set di istruzioni per l'obiettivo "CMakeFiles/v4l2rtspserver.dir/all" non riuscito make[1]: [CMakeFiles/v4l2rtspserver.dir/all] Errore 2 Makefile:147: set di istruzioni per l'obiettivo "all" non riuscito make: *** [all] Errore 2

Any suggestion is welcome !

Emilio

edefranco commented 3 years ago

installing pkg-config resolve the relative error, but now the problem is:

CMake Error at CMakeLists.txt:25 (add_executable): Target "v4l2rtspserver" links to target "Threads::Threads" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

And, about this I have no idea!

Can some one help me ?

Thank, Emilio

edefranco commented 3 years ago

After other google searching I modified the the CMakeList.txt from:

find_package (Threads) target_link_libraries (${PROJECT_NAME} Threads::Threads)

to

find_package (Threads)

target_link_libraries (${PROJECT_NAME})

if (TARGET Threads::Threads) target_link_libraries (${PROJECT_NAME} Threads::Threads) endif()

I am not sure that this is correct but the error about Thread is resolved.

Now I get a new error during cmake . && make:

Linking CXX executable v4l2rtspserver /usr/bin/ld: liblibv4l2rtspserver.a(DeviceSource.cpp.o): undefined reference to symbol 'pthread_join@@GLIBC_2.4' //lib/arm-linux-gnueabihf/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status CMakeFiles/v4l2rtspserver.dir/build.make:89: set di istruzioni per l'obiettivo "v4l2rtspserver" non riuscito make[2]: [v4l2rtspserver] Errore 1 CMakeFiles/Makefile2:96: set di istruzioni per l'obiettivo "CMakeFiles/v4l2rtspserver.dir/all" non riuscito make[1]: [CMakeFiles/v4l2rtspserver.dir/all] Errore 2 Makefile:147: set di istruzioni per l'obiettivo "all" non riuscito make: *** [all] Errore 2

Looking here: https://github.com/Microsoft/cpprestsdk/issues/927

I believe that the problem maybe is correlated to the linking order of pthreads ... but I am no sure also about my previous modified to CMakeList.txt about Thread ...

There are some person that can help me ?

Emilio