open62541 / open62541

Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541 licensed under Mozilla Public License v2.0
http://open62541.org
Mozilla Public License 2.0
2.59k stars 1.24k forks source link

Compilation error related to mbedTLS #6516

Closed muurc closed 5 months ago

muurc commented 5 months ago

Description

Compilation error related to mbedTLS

Background Information / Reproduction Steps

I cloned the lib succesfully and started configuring the cmake parameters. OpenSSL is my chosen encryption library, which I have installed manually on a different path, however I put the correct path in the advanced cmake parameters. MbedTLS is not enabled.

Then, when I tried to compile, it shows me the following errors: warning: implicit declaration of function ‘UA_OpenSSL_LoadLocalCertificate’; did you mean ‘UA_mbedTLS_LoadLocalCertificate’? warning: nested extern declaration of ‘UA_OpenSSL_LoadLocalCertificate’ error: conflicting types for ‘UA_OpenSSL_LoadLocalCertificate’ note: previous implicit declaration of ‘UA_OpenSSL_LoadLocalCertificate’ was here

and so on...

Why is he trying to take the declarations for the mbedtls function, even though I disabled it? Could this be due to my cmake parameters or could the version be the troublemaker?

Used CMake options:

Commandline options:
-DUA_ENABLE_XML_ENCODING:BOOL="1" -DOPENSSL_CRYPTO_LIBRARY:FILEPATH="/opt/openssl/lib64/libcrypto.so" -DPDFLATEX_COMPILER:FILEPATH="PDFLATEX_COMPILER-NOTFOUND" -Dpkgcfg_lib__OPENSSL_crypto:FILEPATH="/opt/openssl/lib64/libcrypto.so" -DPython3_EXECUTABLE:FILEPATH="/usr/bin/python3.9" -DOPENSSL_INCLUDE_DIR:PATH="/opt/openssl/include/openssl" -DUA_ENABLE_ENCRYPTION:STRING="OPENSSL" -DBUILD_SHARED_LIBS:BOOL="1" -DCMAKE_C_COMPILER_AR:FILEPATH="/usr/bin/gcc-ar-9" -DUA_ENABLE_ENCRYPTION_TPM2:STRING="OFF" -DUA_ENABLE_ENCRYPTION_OPENSSL:BOOL="0" -DMBEDCRYPTO_LIBRARY:FILEPATH="/usr/lib/x86_64-linux-gnu/libmbedcrypto.so" -DUA_ENABLE_HISTORIZING:BOOL="1" -DUA_BUILD_UNIT_TESTS:BOOL="0" -DUA_LOGLEVEL:STRING="100" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo 
" -DUA_AMALGAMATION_MULTIARCH:BOOL="1" -DUA_ENABLE_AMALGAMATION:BOOL="1" -DMBEDTLS_INCLUDE_DIRS:PATH="/usr/include" -DUA_ARCHITECTURE:STRING="posix" -DUA_BUILD_EXAMPLES:BOOL="0" -DMBEDTLS_LIBRARY:FILEPATH="/usr/lib/x86_64-linux-gnu/libmbedtls.so" -DUA_ENABLE_PUBSUB_ENCRYPTION:BOOL="1" -Dpkgcfg_lib__OPENSSL_ssl:FILEPATH="/opt/openssl/lib64/libssl.so" -DOPENSSL_SSL_LIBRARY:FILEPATH="/opt/openssl/lib64/libssl.so" -DMAKEINDEX_COMPILER:FILEPATH="MAKEINDEX_COMPILER-NOTFOUND" -DUA_ENABLE_PARSING:BOOL="1" -DUA_ENABLE_MQTT:BOOL="0" -DCMAKE_C_COMPILER_RANLIB:FILEPATH="/usr/bin/gcc-ranlib-9" -DUA_MULTITHREADING:STRING="100" -DUA_ENABLE_ENCRYPTION_MBEDTLS:BOOL="1" -DUA_NAMESPACE_ZERO:STRING="FULL" -DCMAKE_C_COMPILER:FILEPATH="/usr/bin/cc" -DUA_BUILD_TOOLS:BOOL="0" 

Checklist

Please provide the following information:

jpfr commented 5 months ago

You enable both mbedTLS and OpenSSL in the build flags. But they are mutually exclusive,

It is easiest to use a graphical tool like ccmake for the configuration. There you can only select one of them.