Skip to content

Ninja can't find libsecp256k1.a for Android #2

@PeteClubSeven

Description

@PeteClubSeven

Hi, I followed the setup instructions provided and I seem to encounter a problem with the generated Ninja files. I'm trying to use the tap protocol for a Flutter plugin and consistently run into the same issue. The error I receive for the arm64-v8a and x86_64 abi's is as follows:

> Task :cktap_protocol:buildCMakeDebug[arm64-v8a] FAILED
C/C++: ninja: error: '/home/poops/Programming/Breez/cktap-protocol-flutter/contrib/tap-protocol/contrib/bitcoin-core/src/secp256k1/build/android/arm64-v8a/lib/libsecp256k1.a', needed by '/home/poops/Programming/Breez/cktap-protocol-flutter/example/build/cktap_protocol/intermediates/cxx/Debug/686p6u6f/obj/arm64-v8a/libcktap_protocol_plugin.so', missing and no known rule to make it
> Task :cktap_protocol:buildCMakeDebug[x86_64] FAILED
C/C++: ninja: error: '/home/poops/Programming/Breez/cktap-protocol-flutter/contrib/tap-protocol/contrib/bitcoin-core/src/secp256k1/build/android/x86_64/lib/libsecp256k1.a', needed by '/home/poops/Programming/Breez/cktap-protocol-flutter/example/build/cktap_protocol/intermediates/cxx/Debug/686p6u6f/obj/x86_64/libcktap_protocol_plugin.so', missing and no known rule to make it

Here's the configure step for arm64-v8a where you can see the libsecp256k1 build script does run:

> Task :cktap_protocol:configureCMakeDebug[arm64-v8a]
C/C++: debug|arm64-v8a :CMake Warning at /home/poops/.dev/android-studio/ndk/22.1.7171670/build/cmake/android.toolchain.cmake:449 (message):
C/C++: debug|arm64-v8a :  An old version of CMake is being used that cannot automatically detect
C/C++: debug|arm64-v8a :  compiler attributes.  Compiler identification is being bypassed.  Some
C/C++: debug|arm64-v8a :  values may be wrong or missing.  Update to CMake 3.19 or newer to use
C/C++: debug|arm64-v8a :  CMake's built-in compiler identification.
C/C++: debug|arm64-v8a :Call Stack (most recent call first):
C/C++: debug|arm64-v8a :  .cxx/Debug/686p6u6f/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
C/C++: debug|arm64-v8a :  CMakeLists.txt:3 (project)
C/C++: debug|arm64-v8a :configure.ac:36: warning: The macro `AC_PROG_CC_C89' is obsolete.
C/C++: debug|arm64-v8a :configure.ac:36: You should run autoupdate.
C/C++: debug|arm64-v8a :./lib/autoconf/c.m4:1652: AC_PROG_CC_C89 is expanded from...
C/C++: debug|arm64-v8a :configure.ac:36: the top level
C/C++: debug|arm64-v8a :configure.ac:15: installing 'build-aux/compile'
C/C++: debug|arm64-v8a :configure.ac:9: installing 'build-aux/missing'
C/C++: debug|arm64-v8a :Makefile.am: installing 'build-aux/depcomp'
C/C++: debug|arm64-v8a :configure: WARNING: using cross tools not prefixed with host triplet
C/C++: debug|arm64-v8a :configure: WARNING: using cross tools not prefixed with host triplet
C/C++: debug|arm64-v8a :configure: WARNING: using cross tools not prefixed with host triplet
C/C++: debug|arm64-v8a :configure: WARNING: using cross tools not prefixed with host triplet

Here's the CMakeLists.txt for my project:

cmake_minimum_required(VERSION 3.16)

project(cktap_protocol_plugin)

add_library(cktap_protocol_plugin

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        src/main/cpp/test.cpp)

execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmake_requirements.sh" "${CMAKE_ANDROID_NDK}")

add_subdirectory("${CMAKE_SOURCE_DIR}/../contrib/tap-protocol" "${CMAKE_SOURCE_DIR}/../contrib/tap-protocol/build")
target_link_libraries("${PROJECT_NAME}" PUBLIC  tap-protocol)

And the script being called by my CMakeLists.txt:

#!/bin/bash

scriptDir=`dirname '$0'`
echo $0
echo $1

pushd "$scriptDir/../contrib/tap-protocol"
ANDROID_NDK="$1" tools/build_android.sh
popd

Proof that the files exists:

poops@ramuh ~/P/B/c/android (develop)> find ../ -type f -name libsecp256k1.a -exec readlink -f {} \;
/home/poops/Programming/Breez/cktap-protocol-flutter/contrib/tap-protocol/contrib/bitcoin-core/src/secp256k1/build/android/arm64-v8a/lib64/libsecp256k1.a
/home/poops/Programming/Breez/cktap-protocol-flutter/contrib/tap-protocol/contrib/bitcoin-core/src/secp256k1/build/android/armeabi-v7a/lib/libsecp256k1.a
/home/poops/Programming/Breez/cktap-protocol-flutter/contrib/tap-protocol/contrib/bitcoin-core/src/secp256k1/build/android/x86-64/lib64/libsecp256k1.a
/home/poops/Programming/Breez/cktap-protocol-flutter/contrib/tap-protocol/contrib/bitcoin-core/src/secp256k1/build/android/x86/lib/libsecp256k1.a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions