При попытке развернуть код на моем 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
Я прочитал по следующей ссылке , что у меня нет библиотеки. Следуя инструкции, я мог установить библиотеку, вызвав git clone https://github.com/kgabis/parson.git
, но следующая инструкция, которой я не следую, это; скопируйте parson.h и parson.c в your source code tree
.
У меня вопрос: где я могу найти дерево исходного кода, я вижу в нем исходный каталог и другие каталоги, но не уверен, что именно здесь мне нужно вставить запрашиваемые файлы?
Edit: 1
Может решить некоторые проблемы (undefined: json related
), изменив файл CMakeLists.txt
, включив в него файл parson.c and parson.h
в SOURCE
переменную
Изменена команда в deploy.sh для включения parson.c and parson.h
Edit: 2
Проблема с SSL исчезла, как только я установил 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
Edit: 3
Я попытался понять ответ, приведенный в этом / usr / bin / ld: не могу найти пост -lcurl , но не уверен, как его использовать (я новичок в этих системах)
Нужно ли что-то менять в
target_link_libraries(app wiringPi
serializer
iothub_client
iothub_client_mqtt_transport
umqtt
aziotsharedutil
ssl
crypto
curl
pthread
m
ssl
crypto)