Get the error "Unknown CMake command perlasm" in boringssl

34 Views Asked by At

I'm trying to use boringssl in Android environment.

I added the code I needed,

  • include/openssl
  • ssl
  • crypto
  • third_party/fiat
    to my project.

Now, CMakeLists.txt of the added project has been added and applied to build.gradle.

    externalNativeBuild {
        cmake {
            // Provides a relative path to your CMake build script.
            path "src/main/openssl/ssl/CMakeLists.txt"
        }
        cmake {
            // Provides a relative path to your CMake build script.
            path "src/main/openssl/crypto/CMakeLists.txt"
        }
        cmake {
            // Provides a relative path to your CMake build script.
            path "src/main/openssl/crypto/fipsmodule/CMakeLists.txt"
        }
    }

I also added it to MainActivity.java.

    static {
        System.loadLibrary("ssl");
        System.loadLibrary("crypto");
    }

When I run the code for testing I get an error:

/app/src/main/openssl/crypto/fipsmodule/CMakeLists.txt:1 (perlasm):
Unknown CMake command "perlasm".

Please tell me how to fix this error. thank you

1

There are 1 best solutions below

1
waseem akram On

Basically the CMake cant recognized the "perlasm"

To fix this error, you will need to modify the CMakeLists.txt file in the src/main/openssl/crypto/fipsmodule directory to remove or replace any occurrences of the "perlasm" command. Since BoringSSL does not use assembly language for its cryptographic routines like OpenSSL does, you should not need to use the "perlasm" command in your CMake build script.

src/main/openssl/crypto/fipsmodule/CMakeLists.txt

Remove or comment out any lines that use the "perlasm" command Example: perlasm(${ARCH_DIR}/sha512-x86_64.pl sha512-x86_64_asm.S ${ARCH})

Add the source files to the library add_library(fipsmodule sha512-x86_64_asm.S other_source_files.cpp )

Set include directories, etc. target_include_directories(fipsmodule PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../..)