Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

MindConnect Lib on Raspberry Pi

Experimenter
Experimenter

Hello Community

 

I tried to compile MindConnect Lib on a Raspberry Pi. The Raspberry Pi is on a virtual machine.

I followed the instructions from here https://developer.mindsphere.io/resources/mindconnect-lib/resources-mclib-getting-started.html step by step. At the step Building Libcurl, I get some errors and I don't know how to fix.

 

/usr/bin/ld: skipping incompatible /usr/customAgentExample/build/openssl/lib/libssl.so when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/customAgentExample/build/openssl/lib/libssl.a when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/customAgentExample/build/openssl/lib/libcrypto.so when searching for -lcrypto
/usr/bin/ld: skipping incompatible /usr/customAgentExample/build/openssl/lib/libcrypto.a when searching for -lcrypto
../lib/.libs/libcurl.so: undefined reference to `sk_pop_free'
../lib/.libs/libcurl.so: undefined reference to `OPENSSL_add_all_algorithms_noconf'
../lib/.libs/libcurl.so: undefined reference to `sk_value'
../lib/.libs/libcurl.so: undefined reference to `SSL_load_error_strings'
../lib/.libs/libcurl.so: undefined reference to `CONF_modules_free'
../lib/.libs/libcurl.so: undefined reference to `SSLv3_client_method'
../lib/.libs/libcurl.so: undefined reference to `ERR_free_strings'
../lib/.libs/libcurl.so: undefined reference to `EVP_cleanup'
../lib/.libs/libcurl.so: undefined reference to `SSLv23_client_method'
../lib/.libs/libcurl.so: undefined reference to `sk_num'
../lib/.libs/libcurl.so: undefined reference to `SSL_library_init'
../lib/.libs/libcurl.so: undefined reference to `sk_pop'
../lib/.libs/libcurl.so: undefined reference to `SSL_COMP_free_compression_methods'
../lib/.libs/libcurl.so: undefined reference to `SSLeay'
collect2: error: ld returned 1 exit status
Makefile:775: die Regel für Ziel „curl“ scheiterte
make[2]: *** [curl] Fehler 1
make[2]: Verzeichnis „/usr/customAgentExample/curl-7.52.1/src“ wird verlassen
Makefile:1899: die Regel für Ziel „install“ scheiterte
make[1]: *** [install] Fehler 2
make[1]: Verzeichnis „/usr/customAgentExample/curl-7.52.1/src“ wird verlassen
Makefile:894: die Regel für Ziel „install-recursive“ scheiterte
make: *** [install-recursive] Fehler 1

May some one of you know how to fix this issue?

 

Regards,

sivakumm

6 REPLIES

Re: MindConnect Lib on Raspberry Pi

Experimenter
Experimenter

Good luck.  I am a potential MindSphere customer who, as I write this, is sitting in the headquarters for Siemens PLM software in Plano, TX working with their people and so far, they have also been unable to show me how to get MindConnect compiled and running on a Raspberry Pi.  If we ever figure it out, I'll post up here.  I am not confident.

Re: MindConnect Lib on Raspberry Pi

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hi,

I've attached the step-by-step guide (from scratch) on how to build a custom agent and on-board it to MindSphere. Hope this helps.

Re: MindConnect Lib on Raspberry Pi

Siemens Experimenter Siemens Experimenter
Siemens Experimenter

I am seeing following compilation error ... is it something to do with openssl version. what version you guys are usin?

I am using 

 

 

CMAKE_MINIMUM_REQUIRED(VERSION 3.10.2 FATAL_ERROR)


SET(CURL_VERSION_REQUIRED 7.58.0)
SET(OPENSSL_VERSION_NUMBER_REQUIRED 1.1.0)
SET(OPENSSL_VERSION_LETTER_REQUIRED "g")

#=====================================

[ 72%] Building C object src/CMakeFiles/mc.dir/security_handler.c.o
[ 75%] Building C object src/CMakeFiles/mc.dir/security_libcrypto.c.o
/home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c: In function ‘security_initialize’:
/home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c:68:30: warning: passing argument 1 of ‘CRYPTO_set_mem_functions’ from incompatible pointer type [-Wincompatible-pointer-types]
CRYPTO_set_mem_functions(memory_malloc, memory_realloc, memory_free);
^~~~~~~~~~~~~
In file included from /usr/include/openssl/bn.h:33:0,
from /home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c:22:
/usr/include/openssl/crypto.h:264:5: note: expected ‘void * (*)(size_t, const char *, int) {aka void * (*)(long unsigned int, const char *, int)}’ but argument is of type ‘void * (*)(mcl_size_t) {aka void * (*)(long unsigned int)}’
int CRYPTO_set_mem_functions(
^~~~~~~~~~~~~~~~~~~~~~~~
/home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c:68:45: warning: passing argument 2 of ‘CRYPTO_set_mem_functions’ from incompatible pointer type [-Wincompatible-pointer-types]
CRYPTO_set_mem_functions(memory_malloc, memory_realloc, memory_free);
^~~~~~~~~~~~~~
In file included from /usr/include/openssl/bn.h:33:0,
from /home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c:22:
/usr/include/openssl/crypto.h:264:5: note: expected ‘void * (*)(void *, size_t, const char *, int) {aka void * (*)(void *, long unsigned int, const char *, int)}’ but argument is of type ‘void * (*)(void *, mcl_size_t) {aka void * (*)(void *, long unsigned int)}’
int CRYPTO_set_mem_functions(
^~~~~~~~~~~~~~~~~~~~~~~~
/home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c:68:61: warning: passing argument 3 of ‘CRYPTO_set_mem_functions’ from incompatible pointer type [-Wincompatible-pointer-types]
CRYPTO_set_mem_functions(memory_malloc, memory_realloc, memory_free);
^~~~~~~~~~~
In file included from /usr/include/openssl/bn.h:33:0,
from /home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c:22:
/usr/include/openssl/crypto.h:264:5: note: expected ‘void (*)(void *, const char *, int)’ but argument is of type ‘void (*)(void *)’
int CRYPTO_set_mem_functions(
^~~~~~~~~~~~~~~~~~~~~~~~
/home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c: In function ‘security_rsa_get_modulus_and_exponent’:
/home/infodba/customAgentExample/MCL_Core/src/security_libcrypto.c:188:41: error: dereferencing pointer to incomplete type ‘RSA {aka struct rsa_st}’
code = _base64_encode_big_number(rsa->n, modulus);
^~
src/CMakeFiles/mc.dir/build.make:638: recipe for target 'src/CMakeFiles/mc.dir/security_libcrypto.c.o' failed
make[3]: *** [src/CMakeFiles/mc.dir/security_libcrypto.c.o] Error 1
CMakeFiles/Makefile2:196: recipe for target 'src/CMakeFiles/mc.dir/all' failed
make[2]: *** [src/CMakeFiles/mc.dir/all] Error 2
CMakeFiles/Makefile2:208: recipe for target 'src/CMakeFiles/mc.dir/rule' failed
make[1]: *** [src/CMakeFiles/mc.dir/rule] Error 2
Makefile:212: recipe for target 'mc' failed
make: *** [mc] Error 2

Re: MindConnect Lib on Raspberry Pi

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Here are the versions I tried recently and was successfully able to build:

 

 

CMAKE_MINIMUM_REQUIRED(VERSION 3.7 FATAL_ERROR)

PROJECT(MindConnectLibrary VERSION "03.01.02.00" LANGUAGES C)

#Required CURL and OpenSSL versions
SET(CURL_VERSION_REQUIRED 7.52.1)
SET(OPENSSL_VERSION_NUMBER_REQUIRED 1.0.2)
SET(OPENSSL_VERSION_LETTER_REQUIRED "q")

 

Installed version on my Pi:

 

Curl version 3.7.2

OpenSSL 1.1.0j

Curl 7.52.1

 

My RPi OS details (I'm using a RPi 3 Model B):

 

pi@pi:~/customAgentExample/agent/build $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

 

Also tested with this OS on RPi 3 Model B:

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

 

Re: MindConnect Lib on Raspberry Pi

Experimenter
Experimenter

This error is circumvented by installing libssl1.0-dev package but will resurface at the very end. Regardless, I think the tutorial above only works on Raspberry Pi 3

 

I received the same errors as you using Scratch and Jessie on Raspberry Pi 2. Have yet to get my hands on a Pi 3 to verify the tutorial...

Re: MindConnect Lib on Raspberry Pi

Creator
Creator

Hi @sriram-siva,

Required openssl and curl versions of MindConnect Lib are decreased in your guide.

Because MindConnect Lib is tested with the required versions, it is not recommended to use older versions.

It would be better to build openssl 1.0.2q and curl 7.52.1 for the target device, Raspberry Pi 3.

 

Hi @sivakumm,

I attached a bash file that downloads and builds openssl and curl, then builds MindConnect Lib and custom agent.

Just copy "build_mcl.sh", "MindConnect_Library_V3.1.2.0.zip" and "agent.c" in "/home/pi" folder and execute bash file.

If your agent has additional dependencies you may need to modify last line of the bash file.