Richard_liu
Richard_liu

Reputation: 13

How to import OpenSSL moudle in /art/runtime/oat_file_assistant.cc?

I want to modify the “/art/runtime/oat_file_assistant.cc” in the source code of Android system to use the SHA1 function of OpenSSL. However, during compilation, it is prompted that the "openssl/sha.h" file cannot be found. I don't know much about C++, how to use OpenSSL correctly in “/art/runtime/oat_file_assistant.cc”?Thanks very much。

Here are the include statements

#include <openssl/sha.h>
#incldue <openssl/pem.h>

fatal error: "openssl/sha.h" file not found

Upvotes: 1

Views: 214

Answers (1)

Simpl
Simpl

Reputation: 2046

You need to add the SSL library to the static_libs or shared_libs of libart_defaults in art/runtime/Android.bp.

Example:

cc_defaults {
    name: "libart_defaults",
    [...]
    shared: {
        shared_libs: [
            [ ... ]
            "libcrypto",
        ],
    }
}

Androids build tooling (Soong) will take care of adding the -I flags to gcc.

Upvotes: 0

Related Questions