nunchuk-io / tap-protocol

Coinkite Tap Protocol
MIT License
15 stars 4 forks source link

build_android.sh incompatible with NDK v23+ #4

Closed PeteClubSeven closed 7 months ago

PeteClubSeven commented 1 year ago

I tested against the following NDK versions: 22.1.7171670, 23.2.8568313, 24.0.8215888, and 25.2.9519653 (the current LTS).

The problem seems to stem from the removal of GNU binutils from the NDK starting with NDK v23. I'm not currently blocked by this so I won't try to fix it myself. Here is a build log for arm64-v8a which demonstrates the missing files:


libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
libtoolize: copying file 'build-aux/m4/libtool.m4'
libtoolize: copying file 'build-aux/m4/ltoptions.m4'
libtoolize: copying file 'build-aux/m4/ltsugar.m4'
libtoolize: copying file 'build-aux/m4/ltversion.m4'
libtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
configure.ac:36: warning: The macro `AC_PROG_CC_C89' is obsolete.
configure.ac:36: You should run autoupdate.
./lib/autoconf/c.m4:1652: AC_PROG_CC_C89 is expanded from...
configure.ac:36: the top level
configure.ac:15: installing 'build-aux/compile'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'

-------------------------------------------------------------------------------
 Compiling for arm64-v8a
-------------------------------------------------------------------------------
configure: loading site script /usr/share/site/x86_64-pc-linux-gnu
checking build system type... x86_64-suse-linux-gnu
checking host system type... aarch64-unknown-linux-android
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-linux-android-strip... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for aarch64-linux-android-gcc... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang accepts -g... yes
checking for /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang option to enable C11 features... none needed
checking whether /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang understands -c and -o together... yes
checking dependency style of /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld
checking if the linker (/home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... no
checking for aarch64-linux-android-dumpbin... no
checking for aarch64-linux-android-link... no
checking for dumpbin... no
checking for link... link -dump
configure: WARNING: using cross tools not prefixed with host triplet
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-suse-linux-gnu file names to aarch64-unknown-linux-android format... func_convert_file_noop
checking how to convert x86_64-suse-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld option to reload object files... -r
checking for aarch64-linux-android-file... no
checking for file... file
checking for aarch64-linux-android-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for aarch64-linux-android-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for aarch64-linux-android-ar... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar
checking for archiver @FILE support... no
checking for aarch64-linux-android-strip... (cached) /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip
checking for aarch64-linux-android-ranlib... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ranlib
checking command to parse nm output from /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for aarch64-linux-android-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang supports -fno-rtti -fno-exceptions... yes
checking for /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang option to produce PIC... -fPIC -DPIC
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang PIC flag -fPIC -DPIC works... yes
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang static flag -static works... yes
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang supports -c -o file.o... yes
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang supports -c -o file.o... (cached) yes
checking whether the /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang linker (/home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ld) supports shared libraries... yes
checking dynamic linker characteristics... Android linker
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether make supports nested variables... (cached) yes
checking for aarch64-linux-android-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for aarch64-linux-android-ar... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar
checking for aarch64-linux-android-ranlib... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ranlib
checking for aarch64-linux-android-strip... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip
checking dependency style of /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang... gcc3
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang supports -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-unused-function -Wno-long-long -Wno-overlength-strings... yes
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang supports -Wconditional-uninitialized... yes
checking if /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang supports -fvisibility=hidden... yes
checking for valgrind/memcheck.h... no
checking for x86_64 assembly availability... no
checking how to run the C preprocessor... /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang -E
checking for gcc... gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking if native gcc supports -Wall -Wextra -Wno-unused-function... yes
checking for working native compiler: gcc... yes
configure: ******
configure: WARNING: experimental build
configure: Experimental features do not have stable APIs or properties, and may not be safe for production use.
configure: Building extrakeys module: yes
configure: Building schnorrsig module: yes
configure: ******
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libsecp256k1.pc
config.status: creating src/libsecp256k1-config.h
config.status: executing depfiles commands
config.status: executing libtool commands

Build Options:
  with ecmult precomp     = yes
  with external callbacks = no
  with benchmarks         = no
  with tests              = no
  with openssl tests      = no
  with coverage           = no
  module ecdh             = yes
  module recovery         = yes
  module extrakeys        = yes
  module schnorrsig       = yes

  asm                     = no
  ecmult window size      = 15
  ecmult gen prec. bits   = 4

  valgrind                = no
  CC                      = /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang
  CFLAGS                  = -O2 -fvisibility=hidden -Wconditional-uninitialized -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-unused-function -Wno-long-long -Wno-overlength-strings -W -g
  CPPFLAGS                =  
  LDFLAGS                 = 

  CC_FOR_BUILD            = gcc
  CFLAGS_FOR_BUILD        = -Wall -Wextra -Wno-unused-function -g -O2
  CPPFLAGS_FOR_BUILD      = 
  LDFLAGS_FOR_BUILD       = 
test -z "gen_context src/ecmult_static_context.h" || rm -f gen_context src/ecmult_static_context.h
test -z "libsecp256k1.la" || rm -f libsecp256k1.la
rm -f ./so_locations
rm -rf .libs _libs
rm -rf src/.libs src/_libs
rm -rf src/asm/.libs src/asm/_libs
test -z "" || rm -f 
 rm -f exhaustive_tests
rm -f *.o
rm -f src/*.o
rm -f src/*.lo
rm -f src/asm/*.o
rm -f src/asm/*.lo
test -z "exhaustive_tests.log" || rm -f exhaustive_tests.log
test -z "exhaustive_tests.trs" || rm -f exhaustive_tests.trs
test -z "test-suite.log" || rm -f test-suite.log
rm -f *.lo
gcc -I. -I./src -Wall -Wextra -Wno-unused-function -g -O2 -c src/gen_context.c -o gen_context.o
  CC       src/exhaustive_tests-tests_exhaustive.o
In file included from src/tests_exhaustive.c:26:
In file included from ./src/secp256k1.c:18:
./src/ecdsa_impl.h:312:12: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
    return !secp256k1_scalar_is_zero(sigr) & !secp256k1_scalar_is_zero(sigs);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                           &&
./src/ecdsa_impl.h:312:12: note: cast one or both operands to int to silence this warning
gcc -Wall -Wextra -Wno-unused-function -g -O2  gen_context.o -o gen_context
./gen_context
  CC       src/libsecp256k1_la-secp256k1.lo
In file included from src/secp256k1.c:18:
./src/ecdsa_impl.h:312:12: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
    return !secp256k1_scalar_is_zero(sigr) & !secp256k1_scalar_is_zero(sigs);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                           &&
./src/ecdsa_impl.h:312:12: note: cast one or both operands to int to silence this warning
1 warning generated.
  CCLD     exhaustive_tests
1 warning generated.
  CCLD     libsecp256k1.la
./libtool: line 1883: /home/poops/.dev/android-studio/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar: No such file or directory
make: *** [Makefile:948: libsecp256k1.la] Error 127```
giahuy98 commented 1 year ago

When we use libsecp256k1 directly in our CMakeLists.txt file, this issue will also be resolved.

PeteClubSeven commented 1 year ago

When we use libsecp256k1 directly in our CMakeLists.txt file, this issue will also be resolved.

I'll avoid fixing this since it shouldn't be a blocker for me. Currently I'm trying to get your protocol implementation working in a Flutter plugin so I can use it with Breez, compatibility with the latest NDK shouldn't matter 👍

PeteClubSeven commented 7 months ago

Working now