Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.
This repository was archived by the owner on Jun 14, 2022. It is now read-only.

cross compil failed with mbedtls 3.0.0 #100

Description

@nephaste

Hi I am trying to cross compile it to propose the command on Qnap NAS

CXX=${HOST}-g++ LD=${HOST}-ld AS=${HOST}-as AR=${HOST}-ar CC=${HOST}-gcc PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" CFLAGS="-O2 -fPIC -std=gnu99 -I$PREFIX/include " CXXFLAGS="-O2 -fPIC -I$PREFIX/include" LDFLAGS="-L$PREFIX/lib -Wl,-rpath,$PREFIX/lib" CPPFLAGS="-O2 -fPIC -I$PREFIX/include" FFLAGS="-O2 -fPIC -I$PREFIX/include" cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_CROSSCOMPILING=1 -DCMAKE_C_COMPILER=${TOOLCHAIN_PATH}/bin/${HOST}-gcc -DCMAKE_CXX_COMPILER=${TOOLCHAIN_PATH}/bin/${HOST}-g++ -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_LIBRARY_PATH=$PREFIX/lib -DCMAKE_INCLUDE_PATH=$PREFIX/include -DCMAKE_BUILD_TYPE=Release ../
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /data/x-tools/x86_64-QNAP_FW43-linux-gnu/bin/x86_64-QNAP_FW43-linux-gnu-gcc
-- Check for working C compiler: /data/x-tools/x86_64-QNAP_FW43-linux-gnu/bin/x86_64-QNAP_FW43-linux-gnu-gcc -- 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: /data/x-tools/x86_64-QNAP_FW43-linux-gnu/bin/x86_64-QNAP_FW43-linux-gnu-g++
-- Check for working CXX compiler: /data/x-tools/x86_64-QNAP_FW43-linux-gnu/bin/x86_64-QNAP_FW43-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMake version: 3.16.6
-- Used generator: Unix Makefiles
-- Setting installation destination to: /opt/Apache81
-- Common compiler flags for C: -O2 -fPIC -std=gnu99 -I/opt/Apache81/include
-- Release compiler flags for C: -O3 -DNDEBUG
-- Common compiler flags for CXX: -O2 -fPIC -I/opt/Apache81/include
-- Release compiler flags for CXX: -O3 -DNDEBUG
-- Checking symbols
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Checking symbols - done
-- Generating project config
-- Generating project config - done
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.6") found components: doxygen dot
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Using TLS implementation: mbedtls
-- Check for fuse: /opt/Apache81/lib/libfuse.so
-- Found FUSE: /opt/Apache81/include/fuse (Required is at least version "2.6")
-- Found MbedTLS: /opt/Apache81/lib/libmbedtls.a (found suitable version "3.0.0", minimum required is "2.8.0")
-- Found ZLIB: /opt/Apache81/lib/libz.so (found version "1.2.11")
-- Found SQLite3: /opt/Apache81/include (found version "3.36.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /build/pcloud-console-client/build

but on compilation it failed

[ 83%] Building C object src/psync/CMakeFiles/psync.dir/psockets.c.o
[ 85%] Building C object src/psync/CMakeFiles/psync.dir/pssl-mbedtls.c.o
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_ssl_gen_rsa':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:479:3: error: too many arguments to function 'mbedtls_rsa_init'
mbedtls_rsa_init(ctx, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA1);
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:146:6: note: declared here
void mbedtls_rsa_init( mbedtls_rsa_context *ctx );
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_ssl_rsa_get_private':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:512:3: error: too many arguments to function 'mbedtls_rsa_init'
mbedtls_rsa_init(ctx, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA1);
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:146:6: note: declared here
void mbedtls_rsa_init( mbedtls_rsa_context *ctx );
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_ssl_rsa_load_public':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:574:3: error: too many arguments to function 'mbedtls_rsa_init'
mbedtls_rsa_init(rsa, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA1);
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:146:6: note: declared here
void mbedtls_rsa_init( mbedtls_rsa_context *ctx );
^
In file included from /build/pcloud-console-client/src/psync/plibs.h:15:0,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:22:
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_ssl_rsa_load_private':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:593:22: error: too few arguments to function 'mbedtls_pk_parse_key'
if (unlikely(ret = mbedtls_pk_parse_key(&ctx, keydata, keylen, NULL, 0))) {
^
/build/pcloud-console-client/include/pcloudcc/compat/compiler.h:51:25: note: in definition of macro 'unlikely'
#define unlikely(expr) (expr)
^
In file included from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28:0,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/pk.h:699:5: note: declared here
int mbedtls_pk_parse_key( mbedtls_pk_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:598:3: error: too many arguments to function 'mbedtls_rsa_init'
mbedtls_rsa_init(rsa, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA1);
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:146:6: note: declared here
void mbedtls_rsa_init( mbedtls_rsa_context *ctx );
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_ssl_gen_symmetric_key_from_pass':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:625:3: warning: implicit declaration of function 'mbedtls_md_init_ctx' [-Wimplicit-function-declaration]
mbedtls_md_init_ctx(&ctx, mbedtls_md_info_from_type(MBEDTLS_MD_SHA512));
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_ssl_rsa_encrypt_data':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:654:102: error: 'mbedtls_rsa_context' has no member named 'len'
ret=(psync_encrypted_symmetric_key_t)psync_malloc(offsetof(psync_encrypted_data_struct_t, data)+rsa->len);
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:655:90: error: 'MBEDTLS_RSA_PUBLIC' undeclared (first use in this function)
if ((code=mbedtls_rsa_rsaes_oaep_encrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PUBLIC, NULL, 0, datalen, data, ret->data))) {
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:655:90: note: each undeclared identifier is reported only once for each function it appears in
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:655:110: warning: passing argument 5 of 'mbedtls_rsa_rsaes_oaep_encrypt' makes integer from pointer without a cast
if ((code=mbedtls_rsa_rsaes_oaep_encrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PUBLIC, NULL, 0, datalen, data, ret->data))) {
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:657:5: note: expected 'size_t' but argument is of type 'void *'
int mbedtls_rsa_rsaes_oaep_encrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:655:119: warning: passing argument 7 of 'mbedtls_rsa_rsaes_oaep_encrypt' makes pointer from integer without a cast
if ((code=mbedtls_rsa_rsaes_oaep_encrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PUBLIC, NULL, 0, datalen, data, ret->data))) {
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:657:5: note: expected 'const unsigned char *' but argument is of type 'size_t'
int mbedtls_rsa_rsaes_oaep_encrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:655:128: warning: passing argument 8 of 'mbedtls_rsa_rsaes_oaep_encrypt' discards 'const' qualifier from pointer target type
if ((code=mbedtls_rsa_rsaes_oaep_encrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PUBLIC, NULL, 0, datalen, data, ret->data))) {
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:657:5: note: expected 'unsigned char *' but argument is of type 'const unsigned char *'
int mbedtls_rsa_rsaes_oaep_encrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:655:13: error: too many arguments to function 'mbedtls_rsa_rsaes_oaep_encrypt'
if ((code=mbedtls_rsa_rsaes_oaep_encrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PUBLIC, NULL, 0, datalen, data, ret->data))) {
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:657:5: note: declared here
int mbedtls_rsa_rsaes_oaep_encrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:660:19: error: 'mbedtls_rsa_context' has no member named 'len'
ret->datalen=rsa->len;
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_ssl_rsa_decrypt_data':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:669:84: error: 'MBEDTLS_RSA_PRIVATE' undeclared (first use in this function)
if (mbedtls_rsa_rsaes_oaep_decrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PRIVATE, NULL, 0, &len, data, buff, sizeof(buff)))
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:669:105: warning: passing argument 5 of 'mbedtls_rsa_rsaes_oaep_decrypt' makes integer from pointer without a cast
if (mbedtls_rsa_rsaes_oaep_decrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PRIVATE, NULL, 0, &len, data, buff, sizeof(buff)))
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:774:5: note: expected 'size_t' but argument is of type 'void *'
int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:669:114: warning: passing argument 7 of 'mbedtls_rsa_rsaes_oaep_decrypt' from incompatible pointer type
if (mbedtls_rsa_rsaes_oaep_decrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PRIVATE, NULL, 0, &len, data, buff, sizeof(buff)))
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:774:5: note: expected 'const unsigned char *' but argument is of type 'size_t *'
int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:669:120: warning: passing argument 8 of 'mbedtls_rsa_rsaes_oaep_decrypt' discards 'const' qualifier from pointer target type
if (mbedtls_rsa_rsaes_oaep_decrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PRIVATE, NULL, 0, &len, data, buff, sizeof(buff)))
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:774:5: note: expected 'unsigned char *' but argument is of type 'const unsigned char *'
int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:669:126: warning: passing argument 9 of 'mbedtls_rsa_rsaes_oaep_decrypt' makes integer from pointer without a cast
if (mbedtls_rsa_rsaes_oaep_decrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PRIVATE, NULL, 0, &len, data, buff, sizeof(buff)))
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:774:5: note: expected 'size_t' but argument is of type 'unsigned char *'
int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:669:7: error: too many arguments to function 'mbedtls_rsa_rsaes_oaep_decrypt'
if (mbedtls_rsa_rsaes_oaep_decrypt(rsa, ctr_drbg_random_locked, &psync_mbed_rng, MBEDTLS_RSA_PRIVATE, NULL, 0, &len, data, buff, sizeof(buff)))
^
In file included from /opt/Apache81/include/mbedtls/pk.h:32:0,
from /opt/Apache81/include/mbedtls/ssl_ciphersuites.h:28,
from /opt/Apache81/include/mbedtls/ssl.h:32,
from /build/pcloud-console-client/src/psync/pssl-mbedtls.c:16:
/opt/Apache81/include/mbedtls/rsa.h:774:5: note: declared here
int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx,
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_aes256_encode_block_hw':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:747:17: error: 'mbedtls_aes_context' has no member named 'rk'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:747:55: error: 'mbedtls_aes_context' has no member named 'nr'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_aes256_decode_block_hw':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:768:17: error: 'mbedtls_aes_context' has no member named 'rk'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:768:55: error: 'mbedtls_aes_context' has no member named 'nr'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_aes256_encode_2blocks_consec_hw':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:794:17: error: 'mbedtls_aes_context' has no member named 'rk'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:794:55: error: 'mbedtls_aes_context' has no member named 'nr'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_aes256_decode_2blocks_consec_hw':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:820:17: error: 'mbedtls_aes_context' has no member named 'rk'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:820:55: error: 'mbedtls_aes_context' has no member named 'nr'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c: In function 'psync_aes256_decode_4blocks_consec_xor_hw':
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:870:17: error: 'mbedtls_aes_context' has no member named 'rk'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (bxor), "r" (enc->nr)
^
/build/pcloud-console-client/src/psync/pssl-mbedtls.c:870:67: error: 'mbedtls_aes_context' has no member named 'nr'
: "r" (enc->rk), "r" (src), "r" (dst), "r" (bxor), "r" (enc->nr)
^
make[2]: *** [src/psync/CMakeFiles/psync.dir/pssl-mbedtls.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/psync/CMakeFiles/psync.dir/all] Error 2
make: *** [all] Error 2

do you have any fix please ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions