Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error: "invalid use of incomplete type ‘RSA {aka struct rsa_st}’" #11

Open
James-ZHANG opened this issue Sep 11, 2018 · 5 comments

Comments

@James-ZHANG
Copy link

Hello, first thanks for developing this MPC project.
I followed the compilation instruction but the make step failed with a bunch of "incomplete type" errors. The first such error looks like the following:

In file included from /usr/include/openssl/crypto.h:31:0,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/asn1.h:16,
                 from /usr/include/openssl/rsa.h:16,
                 from /home/yzhangad/workspace/TinyGarble/crypto/OT.h:23,
                 from /home/yzhangad/workspace/TinyGarble/crypto/OT.cpp:19:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
 typedef struct rsa_st RSA;
                ^
In file included from /home/yzhangad/workspace/TinyGarble/crypto/OT.cpp:25:0:
/home/yzhangad/workspace/TinyGarble/crypto/OT.cpp:50:27: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
   CHECK(SendBN(connfd, rsa->e));

The ./configure output looks like this:

-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Release build.
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   program_options
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.0g")

My OS is ubuntu 16.04 and the CPU architecture is x86_64.
Any feedback will be appreciated.

@quinamatics
Copy link

Hi, I have the exact same problem. Have you found a fix?

Thanks

Here is the error log.

/--------------------------------------------------------------------
brandon@brandon-OMEN-by-HP-Laptop:~/src/TinyGarble-master/bin$ make OT_Main
[ 12%] Built target Util_Util
[ 25%] Building CXX object crypto/CMakeFiles/Crypto_OT.dir/OT.cpp.o
In file included from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:25:0:
/home/brandon/src/TinyGarble-master/crypto/OT.cpp: In function ‘int OTSendBN(const BIGNUM
const* const*, uint32_t, int)’:
/home/brandon/src/TinyGarble-master/crypto/OT.cpp:49:27: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
CHECK(SendBN(connfd, rsa->n));
^
/home/brandon/src/TinyGarble-master/util/log.h:70:22: note: in definition of macro ‘CHECK’
#define CHECK(X) if((X)==FAILURE) { LOG(ERROR) << #X << " failed"
^
In file included from /usr/include/openssl/crypto.h:31:0,
from /usr/include/openssl/bio.h:20,
from /usr/include/openssl/asn1.h:16,
from /usr/include/openssl/rsa.h:16,
from /home/brandon/src/TinyGarble-master/crypto/OT.h:23,
from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:19:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
In file included from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:25:0:
/home/brandon/src/TinyGarble-master/crypto/OT.cpp:50:27: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
CHECK(SendBN(connfd, rsa->e));
^
/home/brandon/src/TinyGarble-master/util/log.h:70:22: note: in definition of macro ‘CHECK’
#define CHECK(X) if((X)==FAILURE) { LOG(ERROR) << #X << " failed"
^
In file included from /usr/include/openssl/crypto.h:31:0,
from /usr/include/openssl/bio.h:20,
from /usr/include/openssl/asn1.h:16,
from /usr/include/openssl/rsa.h:16,
from /home/brandon/src/TinyGarble-master/crypto/OT.h:23,
from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:19:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
In file included from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:25:0:
/home/brandon/src/TinyGarble-master/crypto/OT.cpp:74:38: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
BN_CHECK(BN_mod_exp(k0, temp, rsa->d, rsa->n, ctx)); // k0 = (v - x0)^d mod N
^
/home/brandon/src/TinyGarble-master/util/log.h:72:25: note: in definition of macro ‘BN_CHECK’
#define BN_CHECK(X) if((X)==0) { LOG(ERROR) << #X << " failed"
^
In file included from /usr/include/openssl/crypto.h:31:0,
from /usr/include/openssl/bio.h:20,
from /usr/include/openssl/asn1.h:16,
from /usr/include/openssl/rsa.h:16,
from /home/brandon/src/TinyGarble-master/crypto/OT.h:23,
from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:19:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
In file included from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:25:0:
/home/brandon/src/TinyGarble-master/crypto/OT.cpp:74:46: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
BN_CHECK(BN_mod_exp(k0, temp, rsa->d, rsa->n, ctx)); // k0 = (v - x0)^d mod N
^
/home/brandon/src/TinyGarble-master/util/log.h:72:25: note: in definition of macro ‘BN_CHECK’
#define BN_CHECK(X) if((X)==0) { LOG(ERROR) << #X << " failed"
^
In file included from /usr/include/openssl/crypto.h:31:0,
from /usr/include/openssl/bio.h:20,
from /usr/include/openssl/asn1.h:16,
from /usr/include/openssl/rsa.h:16,
from /home/brandon/src/TinyGarble-master/crypto/OT.h:23,
from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:19:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
In file included from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:25:0:
/home/brandon/src/TinyGarble-master/crypto/OT.cpp:77:38: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
BN_CHECK(BN_mod_exp(k1, temp, rsa->d, rsa->n, ctx)); // k1 = (v - x0)^d mod N
^
/home/brandon/src/TinyGarble-master/util/log.h:72:25: note: in definition of macro ‘BN_CHECK’
#define BN_CHECK(X) if((X)==0) { LOG(ERROR) << #X << " failed"
^
In file included from /usr/include/openssl/crypto.h:31:0,
from /usr/include/openssl/bio.h:20,
from /usr/include/openssl/asn1.h:16,
from /usr/include/openssl/rsa.h:16,
from /home/brandon/src/TinyGarble-master/crypto/OT.h:23,
from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:19:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
In file included from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:25:0:
/home/brandon/src/TinyGarble-master/crypto/OT.cpp:77:46: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
BN_CHECK(BN_mod_exp(k1, temp, rsa->d, rsa->n, ctx)); // k1 = (v - x0)^d mod N
^
/home/brandon/src/TinyGarble-master/util/log.h:72:25: note: in definition of macro ‘BN_CHECK’
#define BN_CHECK(X) if((X)==0) { LOG(ERROR) << #X << " failed"
^
In file included from /usr/include/openssl/crypto.h:31:0,
from /usr/include/openssl/bio.h:20,
from /usr/include/openssl/asn1.h:16,
from /usr/include/openssl/rsa.h:16,
from /home/brandon/src/TinyGarble-master/crypto/OT.h:23,
from /home/brandon/src/TinyGarble-master/crypto/OT.cpp:19:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
crypto/CMakeFiles/Crypto_OT.dir/build.make:62: recipe for target 'crypto/CMakeFiles/Crypto_OT.dir/OT.cpp.o' failed
make[3]: *** [crypto/CMakeFiles/Crypto_OT.dir/OT.cpp.o] Error 1
CMakeFiles/Makefile2:932: recipe for target 'crypto/CMakeFiles/Crypto_OT.dir/all' failed
make[2]: *** [crypto/CMakeFiles/Crypto_OT.dir/all] Error 2
CMakeFiles/Makefile2:907: recipe for target 'crypto/CMakeFiles/OT_Main.dir/rule' failed
make[1]: *** [crypto/CMakeFiles/OT_Main.dir/rule] Error 2
Makefile:298: recipe for target 'OT_Main' failed
make: *** [OT_Main] Error 2

@esonghori
Copy link
Owner

This seems to be a OpenSSL 1.1.x compatibility issue. Please try it with OpenSSL 1.0.x while I am working on the compatibility issue.

@quinamatics
Copy link

quinamatics commented Oct 3, 2018

This seems to be a OpenSSL 1.1.x compatibility issue. Please try it with OpenSSL 1.0.x while I am working on the compatibility issue.

Hi, now there is new error, there are many undefined references when I run make. Urgent, please help.

brandon@brandon-OMEN-by-HP-Laptop:/TinyGarble-master$ ./configure
-- The CXX compiler identification is GNU 7.3.0
-- 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
Release build.
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- program_options
-- Found OpenSSL: /usr/local/lib/libcrypto.a (found version "1.0.1f")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/brandon/TinyGarble-master/bin
Config is done. Now call '$ cd bin' and then '$ make' to compile TinyGarble.
brandon@brandon-OMEN-by-HP-Laptop:
/TinyGarble-master$ cd bin
brandon@brandon-OMEN-by-HP-Laptop:~/TinyGarble-master/bin$ make
Scanning dependencies of target Util_Util
[ 1%] Building CXX object util/CMakeFiles/Util_Util.dir/util.cpp.o
[ 1%] Built target Util_Util
Scanning dependencies of target A23_Lib_Main
[ 2%] Building CXX object a23/lib/CMakeFiles/A23_Lib_Main.dir/a23_main_testing.cpp.o
[ 2%] Built target A23_Lib_Main
Scanning dependencies of target Util_Log
[ 4%] Building CXX object util/CMakeFiles/Util_Log.dir/log.cpp.o
[ 4%] Built target Util_Log
Scanning dependencies of target AES
[ 5%] Building CXX object a23/aes/CMakeFiles/AES.dir/aes.c.o
[ 7%] Linking CXX executable AES
[ 7%] Built target AES
Scanning dependencies of target Bubble_Sort
[ 8%] Building CXX object a23/bubble-sort/CMakeFiles/Bubble_Sort.dir/bubble-sort.c.o
[ 10%] Linking CXX executable Bubble_Sort
[ 10%] Built target Bubble_Sort
Scanning dependencies of target Compare
[ 11%] Building CXX object a23/compare/CMakeFiles/Compare.dir/compare.c.o
[ 13%] Linking CXX executable Compare
[ 13%] Built target Compare
Scanning dependencies of target Merge_Sort
[ 14%] Building CXX object a23/merge-sort/CMakeFiles/Merge_Sort.dir/merge-sort.c.o
[ 16%] Linking CXX executable Merge_Sort
[ 16%] Built target Merge_Sort
Scanning dependencies of target Dijkstra
[ 17%] Building CXX object a23/dijkstra/CMakeFiles/Dijkstra.dir/dijkstra.c.o
[ 19%] Linking CXX executable Dijkstra
[ 19%] Built target Dijkstra
Scanning dependencies of target Hamming
[ 20%] Building CXX object a23/hamming/CMakeFiles/Hamming.dir/hamming.c.o
[ 22%] Linking CXX executable Hamming
[ 22%] Built target Hamming
Scanning dependencies of target Mem_Test
[ 23%] Building CXX object a23/mem-test/CMakeFiles/Mem_Test.dir/mem-test.c.o
[ 25%] Linking CXX executable Mem_Test
[ 25%] Built target Mem_Test
Scanning dependencies of target Mul
[ 26%] Building CXX object a23/mul/CMakeFiles/Mul.dir/mul.c.o
[ 27%] Linking CXX executable Mul
[ 27%] Built target Mul
Scanning dependencies of target Matrix_Mul
[ 29%] Building CXX object a23/matrix-mul/CMakeFiles/Matrix_Mul.dir/matrix-mul.c.o
[ 30%] Linking CXX executable Matrix_Mul
[ 30%] Built target Matrix_Mul
Scanning dependencies of target Sum
[ 32%] Building CXX object a23/sum/CMakeFiles/Sum.dir/sum.c.o
[ 33%] Linking CXX executable Sum
[ 33%] Built target Sum
Scanning dependencies of target Sha3
[ 35%] Building CXX object a23/sha3/CMakeFiles/Sha3.dir/sha3.c.o
[ 36%] Linking CXX executable Sha3
[ 36%] Built target Sha3
Scanning dependencies of target Cordic
[ 38%] Building CXX object a23/cordic/CMakeFiles/Cordic.dir/cordic.c.o
[ 39%] Linking CXX executable Cordic
[ 39%] Built target Cordic
Scanning dependencies of target Crypto_OT
[ 41%] Building CXX object crypto/CMakeFiles/Crypto_OT.dir/OT.cpp.o
[ 41%] Built target Crypto_OT
Scanning dependencies of target Crypto_BN
[ 42%] Building CXX object crypto/CMakeFiles/Crypto_BN.dir/BN.cpp.o
[ 42%] Built target Crypto_BN
Scanning dependencies of target Crypto_OT_Extension
[ 44%] Building CXX object crypto/CMakeFiles/Crypto_OT_Extension.dir/OT_extension.cpp.o
[ 44%] Built target Crypto_OT_Extension
Scanning dependencies of target TCPIP_TCPIP
[ 45%] Building CXX object tcpip/CMakeFiles/TCPIP_TCPIP.dir/tcpip.cpp.o
[ 45%] Built target TCPIP_TCPIP
Scanning dependencies of target OT_Main
[ 47%] Building CXX object crypto/CMakeFiles/OT_Main.dir/OT_main.cpp.o
[ 48%] Linking CXX executable OT_Main
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_globallookup': dso_dlfcn.c:(.text+0x11): undefined reference to dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to dlsym' dso_dlfcn.c:(.text+0x2f): undefined reference to dlclose'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_bind_func': dso_dlfcn.c:(.text+0x354): undefined reference to dlsym'
dso_dlfcn.c:(.text+0x412): undefined reference to dlerror' /usr/local/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_bind_var':
dso_dlfcn.c:(.text+0x487): undefined reference to dlsym' dso_dlfcn.c:(.text+0x542): undefined reference to dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_load': dso_dlfcn.c:(.text+0x5a8): undefined reference to dlopen'
dso_dlfcn.c:(.text+0x60d): undefined reference to dlclose' dso_dlfcn.c:(.text+0x645): undefined reference to dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_pathbyaddr': dso_dlfcn.c:(.text+0x6f1): undefined reference to dladdr'
dso_dlfcn.c:(.text+0x756): undefined reference to dlerror' /usr/local/lib/libcrypto.a(dso_dlfcn.o): In function dlfcn_unload':
dso_dlfcn.c:(.text+0x7b2): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
crypto/CMakeFiles/OT_Main.dir/build.make:109: recipe for target 'crypto/OT_Main' failed
make[2]: *** [crypto/OT_Main] Error 1
CMakeFiles/Makefile2:895: recipe for target 'crypto/CMakeFiles/OT_Main.dir/all' failed
make[1]: *** [crypto/CMakeFiles/OT_Main.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

@spartucus
Copy link

spartucus commented Jun 25, 2019

Hi @quinamatics , have you try to remove all bin directory after install new openssl, and configure again? I met same error with you, and I solve the problem with above tricks.

@siamumar
Copy link
Collaborator

Please try with the current version. It should work with opnessl 1.1.1 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants