Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Error while using libcurl in OpenVINO

VSh00
Beginner
461 Views

Hi,

I am working on Pedestrian Demo using OpenVINO. I tried to add a alert using libcurl. Please find my source code below.

I have included the portion of code where the libcurl is used. I have included the following header files.

#include <curl/curlbuild.h>
#include </opt/intel/openvino_2019.1.144/inference_engine/lib/curl-7.50.3/include/curl/curl.h>

source code:

if (should_show) {
            // Drawing colored "worms" (tracks).
            frame = tracker->DrawActiveTracks(frame);

            // Drawing all detected objects on a frame by BLUE COLOR
            for (const auto &detection : detections) {
                cv::rectangle(frame, detection.rect, cv::Scalar(255, 0, 0), 3);
            }

            CURL *curl = curl_easy_init();
            if(curl)
            {
              CURLcode res;
              curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.com");
              res = curl_easy_perform(curl);
                std::cout << std::to_string(res) << std::endl;       
          curl_easy_cleanup(curl);

              
             }

            // Drawing tracked detections only by RED color and print ID and detection
            // confidence level.
            for (const auto &detection : tracker->TrackedDetections()) {
                cv::rectangle(frame, detection.rect, cv::Scalar(0, 0, 255), 3);
                std::string text = std::to_string(detection.object_id) +
                    " conf: " + std::to_string(detection.confidence);
                cv::putText(frame, text, detection.rect.tl(), cv::FONT_HERSHEY_COMPLEX,
                            1.0, cv::Scalar(0, 0, 255), 3);
            }

            cv::resize(frame, frame, cv::Size(), 0.5, 0.5);
            cv::imshow("dbg", frame);
            char k = cv::waitKey(delay);
            if (k == 27)
                break;
        }

While building I got the following error.

sudo ./build_samples.sh

Setting environment variables for building samples...
[setupvars.sh] OpenVINO environment initialized
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include unistd.h
-- Looking for C++ include unistd.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include fnmatch.h
-- Looking for C++ include fnmatch.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Looking for strtoll
-- Looking for strtoll - found
-- Found InferenceEngine: /opt/intel/openvino_2019.1.144/deployment_tools/inference_engine/lib/intel64/libinference_engine.so (Required is at least version "1.6")
-- Performing Test HAVE_CPUID_INFO
-- Performing Test HAVE_CPUID_INFO - Success
-- Host CPU features:
--   3DNOW not supported
--   3DNOWEXT not supported
--   ABM not supported
--   ADX supported
--   AES supported
--   AVX supported
--   AVX2 supported
--   AVX512CD not supported
--   AVX512F not supported
--   AVX512ER not supported
--   AVX512PF not supported
--   BMI1 supported
--   BMI2 supported
--   CLFSH supported
--   CMPXCHG16B supported
--   CX8 supported
--   ERMS supported
--   F16C supported
--   FMA supported
--   FSGSBASE supported
--   FXSR supported
--   HLE not supported
--   INVPCID supported
--   LAHF supported
--   LZCNT supported
--   MMX supported
--   MMXEXT not supported
--   MONITOR supported
--   MOVBE supported
--   MSR supported
--   OSXSAVE supported
--   PCLMULQDQ supported
--   POPCNT supported
--   PREFETCHWT1 not supported
--   RDRAND supported
--   RDSEED supported
--   RDTSCP supported
--   RTM not supported
--   SEP supported
--   SHA not supported
--   SSE supported
--   SSE2 supported
--   SSE3 supported
--   SSE4.1 supported
--   SSE4.2 supported
--   SSE4a not supported
--   SSSE3 supported
--   SYSCALL supported
--   TBM not supported
--   XOP not supported
--   XSAVE supported
-- TBB include: /opt/intel/openvino_2019.1.144/deployment_tools/inference_engine/external/tbb/include
-- TBB Release lib: /opt/intel/openvino_2019.1.144/deployment_tools/inference_engine/external/tbb/lib/libtbb.so
-- TBB Debug lib: /opt/intel/openvino_2019.1.144/deployment_tools/inference_engine/external/tbb/lib/libtbb_debug.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ioz/inference_engine_samples_build
[  3%] Built target gflags_nothreads_static
[  4%] Built target hello_autoresize_classification
[  5%] Built target hello_classification
[  8%] Built target format_reader
[ 10%] Built target hello_request_classification
[ 12%] Built target end2end_video_analytics_opencv
[ 12%] Built target lenet_network_graph_builder
[ 15%] Built target human_pose_estimation_demo
[ 38%] Built target ie_cpu_extension
[ 39%] Built target classification_sample_async
[ 40%] Built target benchmark_app
[ 41%] Built target end2end_video_analytics_ie
[ 42%] Built target classification_sample
[ 43%] Built target crossroad_camera_demo
[ 44%] Built target hello_shape_infer_ssd
[ 47%] Built target interactive_face_detection_demo
[ 54%] Built target calibration_tool
[ 55%] Built target object_detection_demo
[ 56%] Built target object_detection_demo_ssd_async
[ 58%] Built target object_detection_demo_yolov3_async
[ 59%] Built target mask_rcnn_demo
[ 64%] Built target common
[ 65%] Built target object_detection_sample_ssd
Scanning dependencies of target pedestrian_tracker_demo
[ 67%] Built target segmentation_demo
[ 68%] Built target security_barrier_camera_demo
[ 69%] Built target super_resolution_demo
[ 70%] Built target perfcheck
[ 71%] Built target speech_sample
[ 72%] Built target style_transfer_sample
[ 78%] Built target smart_classroom_demo
[ 78%] Building CXX object pedestrian_tracker_demo/CMakeFiles/pedestrian_tracker_demo.dir/main.cpp.o
[ 84%] Built target validation_app
[ 86%] Built target multi-channel-face-detection-demo
[ 94%] Built target multi-channel-human-pose-estimation-demo
[ 94%] Built target text_detection_demo
[ 95%] Linking CXX executable ../intel64/Release/pedestrian_tracker_demo
CMakeFiles/pedestrian_tracker_demo.dir/main.cpp.o: In function `main_work(int, char**)':
main.cpp:(.text+0x1988): undefined reference to `curl_easy_init'
main.cpp:(.text+0x19a8): undefined reference to `curl_easy_setopt'
main.cpp:(.text+0x19b0): undefined reference to `curl_easy_perform'
main.cpp:(.text+0x1a47): undefined reference to `curl_easy_cleanup'
collect2: error: ld returned 1 exit status
pedestrian_tracker_demo/CMakeFiles/pedestrian_tracker_demo.dir/build.make:212: recipe for target 'intel64/Release/pedestrian_tracker_demo' failed

make[2]: *** [intel64/Release/pedestrian_tracker_demo] Error 1
CMakeFiles/Makefile2:1530: recipe for target 'pedestrian_tracker_demo/CMakeFiles/pedestrian_tracker_demo.dir/all' failed
make[1]: *** [pedestrian_tracker_demo/CMakeFiles/pedestrian_tracker_demo.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Error on or near line 71; exiting with status 1

Can you suggest me how to overcome this issue.

Thanks in advance.

0 Kudos
2 Replies
Shubha_R_Intel
Employee
461 Views

Dear G, Shanmuga vadivelu

 Those link errors you have are unrelated to OpenVino. Perhaps the following stack overflow article will help you. You need to statically link libcurl.lib to your project. You can do this by editing your CMakeLists.txt file.

https://stackoverflow.com/questions/4176503/unresolved-symbols-when-linking-a-program-using-libcurl

Hope it helps,

Shubha

0 Kudos
Kenneth_C_Intel
Employee
461 Views

Looks like you just forgot to link libcurl. 

It isnt an openvino error at all. 

You can see a similar error here https://stackoverflow.com/questions/16476196/undefined-reference-to-curl-global-init-curl-easy-init-and-other-functionc

0 Kudos
Reply