sidewalklabs / s2sphere

Python implementation of the S2 geometry library.
http://s2sphere.sidewalklabs.com/
MIT License
213 stars 44 forks source link

compilation error because of deprecated BIGNUM functions in openssl #44

Open WeiWang1205 opened 4 years ago

WeiWang1205 commented 4 years ago

compilation is failing on Ubuntu 20.04, the error messages are: file included from /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:3: /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h: In constructor ‘ExactFloat::ExactFloat()’: /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h:563:3: error: ‘BN_init’ was not declared in this scope 563 | BNinit(&bn); | ^~~ /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc: In function ‘int BN_ext_count_low_zero_bits(const BIGNUM*)’: /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:75:25: error: invalid use of incomplete type ‘const BIGNUM’ {aka ‘const struct bignum_st’} 75 | for (int i = 0; i < bn->top; ++i) { | ^~ In file included from /usr/include/openssl/bn.h:19, from /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h:109, from /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:3: /usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of ‘BIGNUM’ {aka ‘struct bignum_st’} 80 | typedef struct bignum_st BIGNUM; | ^~~~~ /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:76:20: error: invalid use of incomplete type ‘const BIGNUM’ {aka ‘const struct bignum_st’} 76 | BN_ULONG w = bn->d[i]; | ^~ In file included from /usr/include/openssl/bn.h:19, from /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h:109, from /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:3: /usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of ‘BIGNUM’ {aka ‘struct bignum_st’} 80 | typedef struct bignum_st BIGNUM; | ^~~~~ /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc: In constructor ‘ExactFloat::ExactFloat(double)’: /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:90:3: error: ‘BN_init’ was not declared in this scope 90 | BNinit(&bn); | ^~~ /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc: In constructor ‘ExactFloat::ExactFloat(int)’: /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:113:3: error: ‘BN_init’ was not declared in this scope 113 | BNinit(&bn); | ^~~ /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc: In copy constructor ‘ExactFloat::ExactFloat(const ExactFloat&)’: /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:125:3: error: ‘BN_init’ was not declared in this scope 125 | BNinit(&bn); make[2]: [CMakeFiles/s2util.dir/build.make:206: CMakeFiles/s2util.dir/util/math/exactfloat/exactfloat.cc.o] Error 1 make[1]: [CMakeFiles/Makefile2:135: CMakeFiles/s2util.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

WeiWang1205 commented 4 years ago

Although I try to replace BN_init using BN_new as said in https://github.com/google/s2geometry/issues/5 , it still has error saying:

In file included from /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:3: /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h:503:10: error: field ‘bn_’ has incomplete type ‘BIGNUM’ {aka ‘bignumst’} 503 | BIGNUM bn; | ^~~ In file included from /usr/include/openssl/bn.h:19, from /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h:109, from /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:3: /usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of ‘BIGNUM’ {aka ‘struct bignum_st’} 80 | typedef struct bignum_st BIGNUM; | ^~~~~ /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc: In function ‘int BN_ext_count_low_zero_bits(const BIGNUM*)’: /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:75:25: error: invalid use of incomplete type ‘const BIGNUM’ {aka ‘const struct bignum_st’} 75 | for (int i = 0; i < bn->top; ++i) { | ^~ In file included from /usr/include/openssl/bn.h:19, from /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h:109, from /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:3: /usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of ‘BIGNUM’ {aka ‘struct bignum_st’} 80 | typedef struct bignum_st BIGNUM; | ^~~~~ /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:76:20: error: invalid use of incomplete type ‘const BIGNUM’ {aka ‘const struct bignum_st’} 76 | BN_ULONG w = bn->d[i]; | ^~ In file included from /usr/include/openssl/bn.h:19, from /home/w/s2sphere/tests/s2-geometry/geometry/./util/math/exactfloat/exactfloat.h:109, from /home/w/s2sphere/tests/s2-geometry/geometry/util/math/exactfloat/exactfloat.cc:3: /usr/include/openssl/ossl_typ.h:80:16: note: forward declaration of ‘BIGNUM’ {aka ‘struct bignum_st’} 80 | typedef struct bignum_st BIGNUM; | ^~~~~ make[2]: [CMakeFiles/s2util.dir/build.make:206: CMakeFiles/s2util.dir/util/math/exactfloat/exactfloat.cc.o] Error 1 make[1]: [CMakeFiles/Makefile2:135: CMakeFiles/s2util.dir/all] Error 2 make: *** [Makefile:130: all] Error 2