hardcore-sushi / DroidFS

Encrypted overlay filesystems implementation for Android. Also available on gitea: https://forge.chapril.org/hardcoresushi/DroidFS
GNU Affero General Public License v3.0
654 stars 44 forks source link

Build errors #283

Closed intergalacticmonkey closed 5 months ago

intergalacticmonkey commented 7 months ago

Trying to build as per the instructions in BUILD.md but there are build errors.

The first error I encountered was due to a simple typo in an XML file, which is fixed here: https://github.com/hardcore-sushi/DroidFS/pull/282

Then I started getting this error:

Execution failed for task ':app:buildCMakeRelWithDebInfo[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/ubuntu/DroidFS/app/.cxx/RelWithDebInfo/4q70726s/arm64-v8a'
  [1/184] Linking C shared library ../../../../build/intermediates/cxx/RelWithDebInfo/4q70726s/obj/arm64-v8a/libmemfile.so
  [2/184] Building C object CMakeFiles/mux.dir/src/main/native/libmux.c.o
  FAILED: CMakeFiles/mux.dir/src/main/native/libmux.c.o 
  /home/ubuntu/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-none-linux-android21 --sysroot=/home/ubuntu/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dmux_EXPORTS -I/home/ubuntu/DroidFS/app/ffmpeg/build/arm64-v8a -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -O2 -g -DNDEBUG -fPIC -MD -MT CMakeFiles/mux.dir/src/main/native/libmux.c.o -MF CMakeFiles/mux.dir/src/main/native/libmux.c.o.d -o CMakeFiles/mux.dir/src/main/native/libmux.c.o -c /home/ubuntu/DroidFS/app/src/main/native/libmux.c
  /home/ubuntu/DroidFS/app/src/main/native/libmux.c:71:101: error: incompatible function pointer types passing 'int (void *, uint8_t *, int)' (aka 'int (void *, unsigned char *, int)') to parameter of type 'int (*)(void *, const uint8_t *, int)' (aka 'int (*)(void *, const unsigned char *, int)') [-Wincompatible-function-pointer-types]
      AVIOContext* avio_context = avio_alloc_context(av_malloc(BUFF_SIZE), BUFF_SIZE, 1, muxer, NULL, write_packet, seek);
                                                                                                      ^~~~~~~~~~~~
  /home/ubuntu/DroidFS/app/ffmpeg/build/arm64-v8a/libavformat/avio.h:404:25: note: passing argument to parameter 'write_packet' here
                    int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
                          ^

Downgrading the ndk to 23.1.7779620 as suggested in BUILD.md (and updating ndkVersion in app/build.gradle to tell it to use the older version) turns that error into a warning, which allows the build to continue further, but after that I get a new error:

[...]
  [187/190] Linking CXX static library libcryfs/src/cryfs-cli/libcryfs-cli.a
  [188/190] Linking CXX static library libcryfs/src/fspp/fuse/libfspp-fuse.a
  [189/190] Linking CXX static library libcryfs/src/jni/liblibcryfs-jni.a
  [190/190] Linking CXX shared library ../../../../build/intermediates/cxx/RelWithDebInfo/2g2a2c4l/obj/armeabi-v7a/libcryfs_jni.so
  FAILED: ../../../../build/intermediates/cxx/RelWithDebInfo/2g2a2c4l/obj/armeabi-v7a/libcryfs_jni.so 
  : && /home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi21 --sysroot=/home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -O2 -g -DNDEBUG  -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Qunused-arguments -Wl,--no-undefined -shared -Wl,-soname,libcryfs_jni.so -o ../../../../build/intermediates/cxx/RelWithDebInfo/2g2a2c4l/obj/armeabi-v7a/libcryfs_jni.so CMakeFiles/cryfs_jni.dir/src/main/native/libcryfs.c.o  libcryfs/src/jni/liblibcryfs-jni.a  libcryfs/src/fspp/fuse/libfspp-fuse.a  libcryfs/src/cryfs-cli/libcryfs-cli.a  libcryfs/src/fspp/fuse/libfspp-fuse.a  libcryfs/src/cryfs-cli/libcryfs-cli.a  libcryfs/src/cryfs/libcryfs.a  libcryfs/src/fspp/fs_interface/libfspp-interface.a  libcryfs/src/blobstore/libblobstore.a  libcryfs/src/blockstore/libblockstore.a  libcryfs/src/cpp-utils/libcpp-utils.a  -ldl  ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a  libcryfs/vendor/spdlog/libspdlog.a  -pthread  -llog  libcryfs/src/gitversion/libgitversion.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_atomic-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_chrono-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_container-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_date_time-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_exception-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_filesystem-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_serialization-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_system-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_thread-clang-mt-a32-1_77.a  ../../../../libcryfs/vendor/boost/build/armeabi-v7a/lib/libboost_wserialization-clang-mt-a32-1_77.a   -static-libstdc++ -latomic -lm && :
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(integer.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(allocate.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(authenc.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(basecode.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(cast.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(chachapoly.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(crc_simd.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(dll.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(filters.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(fips140.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(gcm.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(gcm_simd.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(hex.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(iterhash.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(mars.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(modes.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(osrng.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(poly1305.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(hrtimer.o) is incompatible with armelf_linux_eabi
  ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(rijndael.o) is incompatible with armelf_linux_eabi
  ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /home/ubuntu/Android/Sdk/cmake/3.22.1/bin/ninja \
        -C \
        /home/ubuntu/DroidFS/app/.cxx/RelWithDebInfo/2g2a2c4l/armeabi-v7a \
        cryfs_jni \
        memfile \
        mux
    from /home/ubuntu/DroidFS/app

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 9m 18s

Build environment:

intergalacticmonkey commented 7 months ago

I got it building using NDK 25.2.9519653.

hardcore-sushi commented 7 months ago

Yes libmux needs to be updated.

The second error log your provided seems incomplete. Can you show it in full?

I got it building using NDK 25.2.9519653.

Great 👍

intergalacticmonkey commented 7 months ago

The second error log your provided seems incomplete. Can you show it in full?

Sure, but I'm not sure it's relevant, because I was trying to use an old NDK version and the newer versions seem to work fine (aside from that one error).

Anyway, here: 1_ld_error.txt

hardcore-sushi commented 7 months ago

Thank you very much.

This seems to be the cause of the failure:

ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(integer.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(allocate.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(authenc.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(basecode.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(cast.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(chachapoly.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(crc_simd.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(dll.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(filters.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(fips140.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(gcm.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(gcm_simd.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(hex.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(iterhash.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(mars.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(modes.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(osrng.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(poly1305.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(hrtimer.o) is incompatible with armelf_linux_eabi
ld: error: ../../../../libcryfs/vendor/cryptopp/vendor_cryptopp/build/armeabi-v7a/libcryptopp.a(rijndael.o) is incompatible with armelf_linux_eabi

That's pretty weird. I've never encountered this error before.

I should update the build instructions to recommend a newer NDK version.

hardcore-sushi commented 5 months ago

I'm closing this as discussed issues should be solved with 7c72c4e8294a8c25dc799a940f8142c12a759c8f.