Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[liblzma] Build error on arm64-android when trying to build GDAL for arm64-android #41178

Closed
JoshMorganAtAuterion opened this issue Sep 26, 2024 · 6 comments
Assignees
Labels
category:question This issue is a question Stale

Comments

@JoshMorganAtAuterion
Copy link

Hi, when attempting to install GDAL (and exactly liblzma), I received the following error. I installed this using the NDK 21.3.6528147 toolchain, but also faced difficulty installing GDAL with another NDK's toolchain (25.1.8937393 in that case).

The command(s) I used to try and install gdal for arm64-android. Please let me know if there is a workaround.

git pull
./vcpkg update
./vcpkg upgrade
export ANDROID_NDK_HOME=~/Android/Sdk/ndk/25.1.8937393/
./vcpkg install gdal:arm64-android

In file included from /home/auterion/repos/auterion-qgroundcontrol/libs/libgdal/vcpkg/buildtrees/liblzma/src/v5.6.2-7484848813.clean/src/liblzma/check/crc32_fast.c:21:
/home/auterion/repos/auterion-qgroundcontrol/libs/libgdal/vcpkg/buildtrees/liblzma/src/v5.6.2-7484848813.clean/src/liblzma/check/crc32_arm64.h:57:9: warning: implicit declaration of function '__crc32b' is invalid in C99 [-Wimplicit-function-declaration]
crc = __crc32b(crc, *buf);
^
/home/auterion/repos/auterion-qgroundcontrol/libs/libgdal/vcpkg/buildtrees/liblzma/src/v5.6.2-7484848813.clean/src/liblzma/check/crc32_arm64.h:67:9: warning: implicit declaration of function '__crc32d' is invalid in C99 [-Wimplicit-function-declaration]
crc = __crc32d(crc, aligned_read64le(buf));
^
/home/auterion/repos/auterion-qgroundcontrol/libs/libgdal/vcpkg/buildtrees/liblzma/src/v5.6.2-7484848813.clean/src/liblzma/check/crc32_arm64.h:82:32: error: use of undeclared identifier 'HWCAP_CRC32'
return (getauxval(AT_HWCAP) & HWCAP_CRC32) != 0;
^

@dg0yt
Copy link
Contributor

dg0yt commented Sep 26, 2024

vcpkg CI uses NDK r26.

@JoshMorganAtAuterion
Copy link
Author

JoshMorganAtAuterion commented Sep 26, 2024 via email

@LilyWangLL LilyWangLL self-assigned this Sep 26, 2024
@LilyWangLL LilyWangLL added the category:question This issue is a question label Sep 26, 2024
@JoshMorganAtAuterion
Copy link
Author

So, I was indeed able to build using the default static entry for the VCPKG_LIBRARY_LINKAGE, but my project needs to compile GDAL to be dynamically-linked, so I tried updating the triplets/arm64-android.cmake to reflect this and unfortunately that lead to more compilation error.

So, to summarize:

  1. I am now using NDK r26
  2. I must generate dynamically-linked libraries
  3. I switched to using Windows

Here is the general output:

-- Using msys root at C:/Users/josh/Downloads/vcpkg-master/vcpkg-master/downloads/tools/msys2/212eb2bc95cd8a82
-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.2.0-1-any.pkg.tar.zst.
-- Using cached msys2-msys2-runtime-3.5.3-3-x86_64.pkg.tar.zst.
-- Using msys root at C:/Users/josh/Downloads/vcpkg-master/vcpkg-master/downloads/tools/msys2/1e74ca60daa10104
-- Configuring arm64-android-dbg
-- Configuring arm64-android-rel
-- Building arm64-android-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: C:/Users/josh/Downloads/vcpkg-master/vcpkg-master/downloads/tools/msys2/212eb2bc95cd8a82/usr/bin/make.exe -j 29 --trace -f Makefile all
    Working Directory: C:/Users/josh/Downloads/vcpkg-master/vcpkg-master/buildtrees/libiconv/arm64-android-dbg/
    See logs for more information:
      C:\Users\josh\Downloads\vcpkg-master\vcpkg-master\buildtrees\libiconv\build-arm64-android-dbg-out.log
      C:\Users\josh\Downloads\vcpkg-master\vcpkg-master\buildtrees\libiconv\build-arm64-android-dbg-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_build_make.cmake:136 (vcpkg_execute_build_process)
  scripts/cmake/vcpkg_install_make.cmake:2 (vcpkg_build_make)
  ports/libiconv/portfile.cmake:39 (vcpkg_install_make)
  scripts/ports.cmake:192 (include)

Here is my log file:

libtool: compile:  C:/Users/josh/Downloads/android-ndk-r26d-windows/android-ndk-r26d/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -I. -I../.././../src/v1.17-84a471678e.clean/libcharset/lib -I.. -I../.././../src/v1.17-84a471678e.clean/libcharset/lib/.. -I../include -g -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wformat -Werror=format-security -fPIC -fno-limit-debug-info -fvisibility=hidden --target=aarch64-none-linux-android21 -DANDROID -D_FORTIFY_SOURCE=2 --sysroot=C:/Users/josh/Downloads/android-ndk-r26d-windows/android-ndk-r26d/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DBUILDING_LIBCHARSET -DHAVE_CONFIG_H -c ../.././../src/v1.17-84a471678e.clean/libcharset/lib/relocatable-stub.c  -fPIC -DPIC -o .libs/relocatable-stub.o
Makefile:55: update target 'libcharset.la' due to: target does not exist
/bin/sh ../libtool --mode=link C:/Users/josh/Downloads/android-ndk-r26d-windows/android-ndk-r26d/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -LC:/Users/josh/Downloads/vcpkg-master/vcpkg-master/installed/arm64-android/debug/lib --target=aarch64-none-linux-android21 -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments --sysroot=C:/Users/josh/Downloads/android-ndk-r26d-windows/android-ndk-r26d/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wformat -Werror=format-security -fPIC -fno-limit-debug-info -fvisibility=hidden -o libcharset.la -rpath /C/Users/josh/Downloads/vcpkg-master/vcpkg-master/installed/arm64-android/debug/lib -version-info 1:0:0 -no-undefined localcharset.lo relocatable-stub.lo
libtool: link: C:/Users/josh/Downloads/android-ndk-r26d-windows/android-ndk-r26d/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -shared  -fPIC -DPIC  .libs/localcharset.o .libs/relocatable-stub.o   -LC:/Users/josh/Downloads/vcpkg-master/vcpkg-master/installed/arm64-android/debug/lib -lc  -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined --sysroot=C:/Users/josh/Downloads/android-ndk-r26d-windows/android-ndk-r26d/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g -fstack-protector-strong   -Wl,-soname -Wl,libcharset.so -o .libs/libcharset.so
make[2]: Leaving directory '/c/Users/josh/Downloads/vcpkg-master/vcpkg-master/buildtrees/libiconv/arm64-android-dbg/libcharset/lib'
make[1]: Leaving directory '/c/Users/josh/Downloads/vcpkg-master/vcpkg-master/buildtrees/libiconv/arm64-android-dbg/libcharset'

@dg0yt
Copy link
Contributor

dg0yt commented Sep 26, 2024

There is no error logged. The -lc looks unusual, but IDK.

vcpkg CI build Android on Linux. This is targeting POSIX on POSIX.

Windows hosts might work to some extent, but with GDAL at the end of a long pipeline, you are very likely to run into problems. This is targeting POSIX on WINDOWS partially using a POSIX runtime (MSYS2). Many ways to fail. For example host tools built by icu are known to get path separators wrong.

Copy link

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

@github-actions github-actions bot added the Stale label Oct 25, 2024
@LilyWangLL
Copy link
Contributor

Thanks for posting this issue. Please reopen this issue if this is still a problem for you.

@LilyWangLL LilyWangLL closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question Stale
Projects
None yet
Development

No branches or pull requests

3 participants