在尝试向我的Pi部署代码时,我遇到了问题;
部署到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
我从以下link中了解到我没有图书馆。按照该说明,我可以通过调用git clone https://github.com/kgabis/parson.git
来安装该库,但是我不遵循的下一条说明是:将parson.h和parson.c复制到your source code tree
。
我的问题是在哪里可以找到源代码树,可以在其中找到源目录和其他目录,但是不确定是否是我需要粘贴询问文件的地方?
修改:1
通过修改undefined: json related
文件以将CMakeLists.txt
文件包含在parson.c and parson.h
变量中,可以解决某些问题(SOURCE
)
修改了deploy.sh中的命令以包括parson.c and parson.h
编辑:2
我安装libssl-dev
现在获得以下信息;当我尝试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
编辑:3
我尝试了解此 /usr/bin/ld: cannot find -lcurl帖子中提供的答案,但不确定如何使用(对于这些系统,我是相当陌生的)
我需要在
target_link_libraries(app wiringPi
serializer
iothub_client
iothub_client_mqtt_transport
umqtt
aziotsharedutil
ssl
crypto
curl
pthread
m
ssl
crypto)