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

libtensorflowlite target compilation failed #52018

Closed
AnastGerus opened this issue Sep 15, 2021 · 5 comments
Closed

libtensorflowlite target compilation failed #52018

AnastGerus opened this issue Sep 15, 2021 · 5 comments
Assignees
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:bazel Bazel related Build_Installation issues TF 2.4 for issues related to TF 2.4 type:build/install Build and install issues

Comments

@AnastGerus
Copy link

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 20.04
  • TensorFlow installed from (source or binary): from source
  • TensorFlow version: 2.4.0, 2.4.1., latest (tried few)
  • Python version: Python 3.8.10
  • Installed using virtualenv? pip? conda?: pip
  • Bazel version (if compiling from source): bazel 3.7.2
  • GCC/Compiler version (if compiling from source): 9.3.0

Describe the problem

I'm trying to build from source Tensorflow Lite with Select Tensorflow Operation for ARM64 architecture using Bazel build system and I get the compilation error.

/home/anastasiia/.cache/bazel/_bazel_anastasiia/db1857d8efe24e737c8a02a07ecf55c7/external/boringssl/BUILD:147:11: C++ compilation of rule '@boringssl//:ssl' failed (Exit 1): aarch64-linux-gnu-gcc failed: error executing command /home/anastasiia/.cache/bazel/_bazel_anastasiia/db1857d8efe24e737c8a02a07ecf55c7/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc -fstack-protector -g0 -O2 -DNDEBUG -ffunction-sections ... (remaining 40 argument(s) skipped)
In file included from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/bio.h:687:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_1_1_0'
 DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr))

For ARM build I used tutorial: build_arm
For Select TF operations: ops_select

Looks like an issue is in the dependency library openssl.
Without Select TF ops everything is ok.

Provide the exact sequence of commands / steps that you executed before running into the problem

  1. git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
  2. Add the TensorFlow ops delegate library dependency to the build dependencies. In the file tensorflow/lite/BUILD for target libtensorflowlite add dependency : tensorflow/lite/delegates/flex:delegate.
  3. bazel build --config=elinux_aarch64 --config=monolithic -c opt //tensorflow/lite:libtensorflowlite.so

Any other info / logs

ERROR: /home/anastasiia/.cache/bazel/_bazel_anastasiia/db1857d8efe24e737c8a02a07ecf55c7/external/boringssl/BUILD:147:11: C++ compilation of rule '@boringssl//:ssl' failed (Exit 1): aarch64-linux-gnu-gcc failed: error executing command /home/anastasiia/.cache/bazel/_bazel_anastasiia/db1857d8efe24e737c8a02a07ecf55c7/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc -fstack-protector -g0 -O2 -DNDEBUG -ffunction-sections ... (remaining 40 argument(s) skipped)
In file included from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/bio.h:687:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_1_1_0'
 DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr))
 ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/asn1.h:23,
                 from /usr/include/openssl/objects.h:15,
                 from /usr/include/openssl/evp.h:28,
                 from /usr/include/openssl/x509.h:18,
                 from /usr/include/openssl/ssl.h:20,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/bn.h:183:43: error: 'BN_ULONG' does not name a type; did you mean 'SHA_LONG'?
 int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
                                           ^~~~~~~~
                                           SHA_LONG
/usr/include/openssl/bn.h:186:39: error: 'BN_ULONG' does not name a type; did you mean 'SHA_LONG'?
 int BN_is_word(const BIGNUM *a, const BN_ULONG w);
                                       ^~~~~~~~
                                       SHA_LONG
/usr/include/openssl/bn.h:214:22: error: 'BN_ULONG' was not declared in this scope
 int BN_num_bits_word(BN_ULONG l);
                      ^~~~~~~~
/usr/include/openssl/bn.h:214:22: note: suggested alternative: 'SHA_LONG'
 int BN_num_bits_word(BN_ULONG l);
                      ^~~~~~~~
                      SHA_LONG
/usr/include/openssl/bn.h:266:1: error: 'BN_ULONG' does not name a type; did you mean 'SHA_LONG'?
 BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
 ^~~~~~~~
 SHA_LONG
/usr/include/openssl/bn.h:267:1: error: 'BN_ULONG' does not name a type; did you mean 'SHA_LONG'?
 BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
 ^~~~~~~~
 SHA_LONG
/usr/include/openssl/bn.h:268:28: error: 'BN_ULONG' has not been declared
 int BN_mul_word(BIGNUM *a, BN_ULONG w);
                            ^~~~~~~~
/usr/include/openssl/bn.h:269:28: error: 'BN_ULONG' has not been declared
 int BN_add_word(BIGNUM *a, BN_ULONG w);
                            ^~~~~~~~
/usr/include/openssl/bn.h:270:28: error: 'BN_ULONG' has not been declared
 int BN_sub_word(BIGNUM *a, BN_ULONG w);
                            ^~~~~~~~
/usr/include/openssl/bn.h:271:28: error: 'BN_ULONG' has not been declared
 int BN_set_word(BIGNUM *a, BN_ULONG w);
                            ^~~~~~~~
/usr/include/openssl/bn.h:272:1: error: 'BN_ULONG' does not name a type; did you mean 'SHA_LONG'?
 BN_ULONG BN_get_word(const BIGNUM *a);
 ^~~~~~~~
 SHA_LONG
/usr/include/openssl/bn.h:288:37: error: 'BN_ULONG' has not been declared
 int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
                                     ^~~~~~~~
/usr/include/openssl/bn.h:323:24: error: variable or field 'BN_consttime_swap' declared void
 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
                        ^~~~~~~~
/usr/include/openssl/bn.h:323:24: error: 'BN_ULONG' was not declared in this scope
/usr/include/openssl/bn.h:323:24: note: suggested alternative: 'SHA_LONG'
 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
                        ^~~~~~~~
                        SHA_LONG
/usr/include/openssl/bn.h:323:46: error: expected primary-expression before '*' token
 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
                                              ^
/usr/include/openssl/bn.h:323:47: error: 'a' was not declared in this scope
 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
                                               ^
/usr/include/openssl/bn.h:323:57: error: expected primary-expression before '*' token
 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
                                                         ^
/usr/include/openssl/bn.h:323:58: error: 'b' was not declared in this scope
 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
                                                          ^
/usr/include/openssl/bn.h:323:61: error: expected primary-expression before 'int'
 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
                                                             ^~~
/usr/include/openssl/bn.h:332:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_0_9_8'
 DEPRECATEDIN_0_9_8(int
 ^~~~~~~~~~~~~~~~~~
/usr/include/openssl/bn.h:403:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_0_9_8'
 DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3
 ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/objects.h:15,
                 from /usr/include/openssl/evp.h:28,
                 from /usr/include/openssl/x509.h:18,
                 from /usr/include/openssl/ssl.h:20,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/asn1.h:555:7: error: expected constructor, destructor, or type conversion before 'unsigned'
 const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);
       ^~~~~~~~
In file included from /usr/include/openssl/x509.h:22,
                 from /usr/include/openssl/ssl.h:20,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ec.h:274:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_1_2_0'
 DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p,
 ^~~~~~~~~~~~~~~~~~
/usr/include/openssl/ec.h:543:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_1_2_0'
 DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
 ^~~~~~~~~~~~~~~~~~
/usr/include/openssl/ec.h:631:1: error: expected constructor, destructor, or type conversion before 'size_t'
 size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
 ^~~~~~
In file included from /usr/include/openssl/x509.h:25,
                 from /usr/include/openssl/ssl.h:20,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/rsa.h:240:1: error: expected constructor, destructor, or type conversion before 'int'
 int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
 ^~~
In file included from /usr/include/openssl/dsa.h:25,
                 from /usr/include/openssl/x509.h:26,
                 from /usr/include/openssl/ssl.h:20,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/dh.h:142:1: error: expected constructor, destructor, or type conversion before 'int'
 int DH_generate_parameters_ex(DH *dh, int prime_len, int generator,
 ^~~
In file included from /usr/include/openssl/x509.h:26,
                 from /usr/include/openssl/ssl.h:20,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/dsa.h:103:1: error: expected constructor, destructor, or type conversion before 'int'
 int DSA_sign(int type, const unsigned char *dgst, int dlen,
 ^~~
/usr/include/openssl/dsa.h:127:1: error: expected constructor, destructor, or type conversion before 'int'
 int DSA_generate_parameters_ex(DSA *dsa, int bits,
 ^~~
In file included from /usr/include/openssl/ssl.h:20,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/x509.h:728:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_1_1_0'
 DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl))
 ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/ssl.h:26,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/hmac.h:33:12: error: expected constructor, destructor, or type conversion before 'int'
 /*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
            ^~~
In file included from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ssl.h:991:1: error: expected constructor, destructor, or type conversion before 'typedef'
 typedef enum {
 ^~~~~~~
/usr/include/openssl/ssl.h:1042:3: error: 'OSSL_HANDSHAKE_STATE' does not name a type; did you mean 'SSL_CB_HANDSHAKE_START'?
 } OSSL_HANDSHAKE_STATE;
   ^~~~~~~~~~~~~~~~~~~~
   SSL_CB_HANDSHAKE_START
/usr/include/openssl/ssl.h:1878:1: error: expected constructor, destructor, or type conversion before 'DEPRECATEDIN_1_1_0'
 DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void))
 ^~~~~~~~~~~~~~~~~~
/usr/include/openssl/ssl.h:1997:8: error: 'OSSL_HANDSHAKE_STATE' does not name a type; did you mean 'SSL_CB_HANDSHAKE_START'?
 __owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl);
        ^~~~~~~~~~~~~~~~~~~~
        SSL_CB_HANDSHAKE_START
external/boringssl/src/ssl/bio_ssl.cc: In function 'SSL* get_ssl(BIO*)':
external/boringssl/src/ssl/bio_ssl.cc:16:37: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
   return reinterpret_cast<SSL *>(bio->ptr);
                                     ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc: In function 'int ssl_read(BIO*, char*, int)':
external/boringssl/src/ssl/bio_ssl.cc:40:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       bio->retry_reason = BIO_RR_ACCEPT;
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc:45:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       bio->retry_reason = BIO_RR_CONNECT;
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc: In function 'int ssl_write(BIO*, const char*, int)':
external/boringssl/src/ssl/bio_ssl.cc:80:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       bio->retry_reason = BIO_RR_CONNECT;
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc: In function 'long int ssl_ctrl(BIO*, int, long int, void*)':
external/boringssl/src/ssl/bio_ssl.cc:101:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       bio->shutdown = num;
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc:102:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       bio->ptr = ptr;
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc:103:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       bio->init = 1;
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc:107:17: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       return bio->shutdown;
                 ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc:110:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
       bio->shutdown = num;
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc: In function 'int ssl_free(BIO*)':
external/boringssl/src/ssl/bio_ssl.cc:148:10: error: invalid use of incomplete type 'BIO' {aka 'struct bio_st'}
   if (bio->shutdown) {
          ^~
In file included from /usr/include/openssl/crypto.h:25,
                 from /usr/include/openssl/bio.h:20,
                 from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
/usr/include/openssl/ossl_typ.h:79:16: note: forward declaration of 'BIO' {aka 'struct bio_st'}
 typedef struct bio_st BIO;
                ^~~~~~
external/boringssl/src/ssl/bio_ssl.cc: At global scope:
external/boringssl/src/ssl/bio_ssl.cc:170:25: error: variable 'const BIO_METHOD ssl_method' has initializer but incomplete type
 static const BIO_METHOD ssl_method = {
                         ^~~~~~~~~~
In file included from /usr/include/openssl/ssl.h:18,
                 from external/boringssl/src/ssl/bio_ssl.cc:10:
external/boringssl/src/ssl/bio_ssl.cc:177:6: error: expected identifier before numeric constant
 long BIO_set_ssl(BIO *bio, SSL *ssl, int take_owership) {
      ^~~~~~~~~~~
external/boringssl/src/ssl/bio_ssl.cc:177:6: error: expected ',' or '...' before numeric constant
external/boringssl/src/ssl/bio_ssl.cc: In function 'long int BIO_ctrl(BIO*, int)':
external/boringssl/src/ssl/bio_ssl.cc:178:39: error: 'take_owership' was not declared in this scope
   return BIO_ctrl(bio, BIO_C_SET_SSL, take_owership, ssl);
                                       ^~~~~~~~~~~~~
external/boringssl/src/ssl/bio_ssl.cc:178:54: error: 'ssl' was not declared in this scope
   return BIO_ctrl(bio, BIO_C_SET_SSL, take_owership, ssl);
                                                      ^~~
Target //tensorflow/lite:libtensorflowlite.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 368.325s, Critical Path: 108.73s
INFO: 1656 processes: 241 internal, 1415 local.
FAILED: Build did NOT complete successfully

Thanks

@AnastGerus AnastGerus added the type:build/install Build and install issues label Sep 15, 2021
@tilakrayal tilakrayal added TF 2.4 for issues related to TF 2.4 subtype:bazel Bazel related Build_Installation issues labels Sep 16, 2021
@tilakrayal tilakrayal assigned Saduf2019 and unassigned tilakrayal Sep 16, 2021
@Saduf2019
Copy link
Contributor

@AnastGerus
please refer to issue with same error and let us know.
Issues for reference:
link, link1

@Saduf2019 Saduf2019 added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Sep 16, 2021
@AnastGerus
Copy link
Author

Hi @Saduf2019 ,
yes, the proposed issue helped a lot.
Sorry, that I didn't manage to find it myself. Thanks a lot for your help!

Note for those who looking for an answer:
You need to hide the system's openssl library. For this go to usr/include folder and make sudo mv openssl openssl.original.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@AIWintermuteAI
Copy link

@AnastGerus Thank you for leaving a note!
The number of issues in this repo that are ended with no answer and

Are you satisfied with the resolution of your issue?
[Yes](https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/52018)
[No](https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/52018)

is maddening.

@mihaimaruseac
Copy link
Collaborator

Metrics became goals and automation enabled moving support away from the developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:bazel Bazel related Build_Installation issues TF 2.4 for issues related to TF 2.4 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

5 participants