1

While trying to deploy a code to my Pi, I run into the issue;

Deploying to Pi

-- The C compiler identification is GNU 6.3.0  
-- The CXX compiler identification is GNU 6.3.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  
-- Configuring done  
-- Generating done  
-- Build files have been written to: /home/pi/AzureIoT  
Scanning dependencies of target app  
[ 33%] Building C object CMakeFiles/app.dir/main.c.o  
[ 66%] Building C object CMakeFiles/app.dir/bme280.c.o  
[100%] Linking C executable app  
//usr/local/lib/libiothub_client.a(iothub_client_ll_uploadtoblob.c.o): In function `IoTHubClient_LL_UploadToBlob_step1and2':
iothub_client_ll_uploadtoblob.c:(.text+0x1018): undefined reference to `json_parse_string'  
iothub_client_ll_uploadtoblob.c:(.text+0x1084): undefined reference to `json_value_get_object'
iothub_client_ll_uploadtoblob.c:(.text+0x10fc): undefined reference to `json_object_get_string'
iothub_client_ll_uploadtoblob.c:(.text+0x11e0): undefined reference to `json_object_get_string'
iothub_client_ll_uploadtoblob.c:(.text+0x1258): undefined reference to `json_object_get_string'
iothub_client_ll_uploadtoblob.c:(.text+0x12d0): undefined reference to `json_object_get_string'
iothub_client_ll_uploadtoblob.c:(.text+0x1348): undefined reference to `json_object_get_string'
iothub_client_ll_uploadtoblob.c:(.text+0x1814): undefined reference to `json_value_free'
//usr/local/lib/libaziotsharedutil.a(tlsio_openssl.c.o): In function `create_openssl_instance':
tlsio_openssl.c:(.text+0x2528): undefined reference to `TLS_method'
//usr/local/lib/libaziotsharedutil.a(tlsio_openssl.c.o): In function `tlsio_openssl_init':
tlsio_openssl.c:(.text+0x2a44): undefined reference to `OPENSSL_init_ssl'
tlsio_openssl.c:(.text+0x2a54): undefined reference to `OPENSSL_init_ssl'
tlsio_openssl.c:(.text+0x2a68): undefined reference to `OPENSSL_init_crypto'
CMakeFiles/app.dir/build.make:120: recipe for target 'app' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/app.dir/all' failed
Makefile:83: recipe for target 'all' failed  
collect2: error: ld returned 1 exit status  
make[2]: *** [app] Error 1  
make[1]: *** [CMakeFiles/app.dir/all] Error 2  
make: *** [all] Error 2  
sudo: ./app: command not found

I read from the following link that I do not have a library. By following the instruction I could install the library by calling git clone https://github.com/kgabis/parson.git but the next instruction I do not follow that is; copy parson.h and parson.c to your source code tree.

My question is where do I find the Source Code tree, I see a Source Directory and other directories inside it, but not sure if that is where I need to paste the asked files?

Edit:1
Could resolve some the issues(undefined: json related) by Modifying CMakeLists.txt file to include parson.c and parson.h file in SOURCE variable
Modified the command in deploy.sh to include parson.c and parson.h

Edit:2
SSL related issue were gone as soon as I installed libssl-dev

Now get the following; when I try deploy.sh


Deploying to Pi
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.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
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/AzureIoT
Scanning dependencies of target app
[ 25%] Building C object CMakeFiles/app.dir/main.c.o
[ 50%] Building C object CMakeFiles/app.dir/bme280.c.o
[ 75%] Building C object CMakeFiles/app.dir/parson.c.o
[100%] Linking C executable app
/usr/bin/ld: cannot find -lcurl
collect2: error: ld returned 1 exit status
CMakeFiles/app.dir/build.make:146: recipe for target 'app' failed
make[2]: *** [app] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/app.dir/all' failed
make[1]: *** [CMakeFiles/app.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
sudo: ./app: command not found

Edit:3
I tried understanding the answer provided in this /usr/bin/ld: cannot find -lcurl post but not sure how to use(I am quite new to these systems) Do I need to change something in

target_link_libraries(app wiringPi
                          serializer
                          iothub_client
                          iothub_client_mqtt_transport
                          umqtt
                          aziotsharedutil
                          ssl
                          crypto
                          curl
                          pthread
                          m
                          ssl
                          crypto)
Vivek Shukla
  • 767
  • 6
  • 21
  • Do you have `curl` installed? What is location of `libcurl.so` file? Note, that you should have this file WITHOUT soversion, while searching the library the linker does NOT treat file `/usr/lib/arm-linux-gnueabihf/libcurl.so.4` as corresponded to the library. – Tsyvarev Sep 06 '18 at 07:38
  • When I do apt-cache policy curl I get the following; `curl: Installed: 7.52.1-5+deb9u6 Candidate: 7.52.1-5+deb9u6 Version table: *** 7.52.1-5+deb9u6 500 500 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages 100 /var/lib/dpkg/status` – Vivek Shukla Sep 06 '18 at 15:32
  • I tried using find . -name "*libcurl" and find . -name "*libcurl.so" and got nothing :( – Vivek Shukla Sep 06 '18 at 15:47
  • You probably have only so-version variant of the library. You may create a symlink pointed to that so-version library and name this symlink as `libcurl.so`. The linker should be able to search the library after that. – Tsyvarev Sep 06 '18 at 21:58

0 Answers0