Skip to content

[vcpkg] Enhancement android triplet#21847

Closed
holmesconan wants to merge 38 commits intomicrosoft:masterfrom
holmesconan:enhancement-android-triplet
Closed

[vcpkg] Enhancement android triplet#21847
holmesconan wants to merge 38 commits intomicrosoft:masterfrom
holmesconan:enhancement-android-triplet

Conversation

@holmesconan
Copy link

@holmesconan holmesconan commented Dec 4, 2021

  1. fix vcpkg_configure_make for Android newest NDK.
  2. fix $ANDROID_PLATFORM set in $VCPKG_ROOT/scripts/toolchains/android.cmake by parse the Android NDK revision file.

Yes

@holmesconan
Copy link
Author

cc @dg0yt @m-kuhn

@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 4, 2021

See also #21831

@dg0yt
Copy link
Contributor

dg0yt commented Dec 4, 2021

Too many PRs on vcpkg_configure_make at the same time...

@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 4, 2021

If #21831 is acceptable / has the potential to be merged, I'd propose to focus on that one because it's smaller and other things from in here can follow up. If #21831 is oversimplified, I'm also very open to let it go.

@dg0yt
Copy link
Contributor

dg0yt commented Dec 4, 2021

In any case, I don't want to repeat PR comments.
ATM it is not even clear to me if the CMake-based ports (e.g. zlib (C), geos (C++)) build with the right build flags for the desired spectrum of host platforms and of Android NDKs and platforms. Anything broken there can't be fixed in vcpkg_configure_make.

@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 4, 2021

ATM it is not even clear to me if the CMake-based ports (e.g. zlib (C), geos (C++)) build with the right build flags for the desired spectrum of host platforms and of Android NDKs and platforms. Anything broken there can't be fixed in vcpkg_configure_make.

I'm building those successfully with an older version branched off #15605

Actually the complete gdal stack + some qt based libs with precompiled qt libraries.

@dg0yt
Copy link
Contributor

dg0yt commented Dec 4, 2021

I'm building those successfully with an older version branched off #15605

Actually the complete gdal stack + some qt based libs with precompiled qt libraries.

I understand this ("branched") as:
CMake-based ports (e.g. zlib (C), geos (C++)) don't build with the right build flags ATM, at least for some hosts or Android targets. This must be fixed first.

@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 4, 2021

I didn't specifically patch anything for cmake base ports. The cumbersome ones were always the others. If I had to guess I'd say they are fine already but never put this on test.

@dg0yt
Copy link
Contributor

dg0yt commented Dec 4, 2021

The build or install log files should reflect the android API level and the chosen C++ library.

@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 4, 2021

Here's a geos build log produced with #21831 , default community triplet arm64-android and qbsbuild/qbsdev:focal-android-ndk-r21e-0 .
--target=aarch64-none-linux-android21 corresponds to the default api level (21).

@JackBoosY JackBoosY added the category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. label Dec 6, 2021
@holmesconan
Copy link
Author

Too many PRs on vcpkg_configure_make at the same time...

Sorry for that. Since @m-kuhn did not mention my issue, I don't know he/she has already made a PR. But after testint that PR, I thought this one should be the primary solution to work with...

@holmesconan
Copy link
Author

I'm building those successfully with an older version branched off #15605
Actually the complete gdal stack + some qt based libs with precompiled qt libraries.

I understand this ("branched") as: CMake-based ports (e.g. zlib (C), geos (C++)) don't build with the right build flags ATM, at least for some hosts or Android targets. This must be fixed first.

I have read the $VCPKG_ROOT/scripts/toolchains/android.cmake and checked it with the Android NDK documentation. It should say that except the weird $ANDROID_PLATFORM and $ANDROID_NATIVE_API_LEVEL which is chaged from reversion to reversion, anything else matched the guidance of Android NDK usage. And this PR contains a small patch that parses the Android NDK reversion file to determine the actual NDK version instead of the CMAKE_SYSTEM_VERSION. That could refine the $ANDROID_PLATFORM setting more precisely.

@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 6, 2021

I'm building those successfully with an older version branched off #15605
Actually the complete gdal stack + some qt based libs with precompiled qt libraries.

I understand this ("branched") as: CMake-based ports (e.g. zlib (C), geos (C++)) don't build with the right build flags ATM, at least for some hosts or Android targets. This must be fixed first.

I have read the $VCPKG_ROOT/scripts/toolchains/android.cmake and checked it with the Android NDK documentation. It should say that except the weird $ANDROID_PLATFORM and $ANDROID_NATIVE_API_LEVEL which is chaged from reversion to reversion, anything else matched the guidance of Android NDK usage. And this PR contains a small patch that parses the Android NDK reversion file to determine the actual NDK version instead of the CMAKE_SYSTEM_VERSION. That could refine the $ANDROID_PLATFORM setting more precisely.

IIUC this is independent from the rest of the work in here.
Would it make sense to create a separate PR and discuss it in the scope of #21465 ?

if(VCPKG_DETECTED_${cmake_var})
get_filename_component(cmd_PATH "${VCPKG_DETECTED_${cmake_var}}" DIRECTORY)
get_filename_component(cmd_PROGRAM "${VCPKG_DETECTED_${cmake_var}}" NAME)
set(ENV{${env_name}} "${cmd_PROGRAM}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not set ENV{${env_name}} to the full path?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just some kind of OCD problem, :-(. Just make the log looks good instead of run well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO changing PATH invites side effects. Program name lookup after updating the path will behave different. Apart from the PATH becoming longer and longer. And this isn't even visible in most logs.

@PhoebeHui PhoebeHui changed the title Enhancement android triplet [vcpkg] Enhancement android triplet Dec 6, 2021
@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 7, 2021

If #21831 is acceptable / has the potential to be merged, I'd propose to focus on that one because it's smaller and other things from in here can follow up. If #21831 is oversimplified, I'm also very open to let it go.

@dg0yt @holmescn @JackBoosY Given the recent increased communication in this PR I wonder if I should close mine. I am happy to help here too. Opinions?

@JackBoosY
Copy link
Contributor

Can you please merge to master and resolve the file conflict?

@holmesconan
Copy link
Author

holmesconan commented Mar 30, 2022

@jwtowner the new PR won't append the ANDROID_NATIVE_API_LEVEL when it is there, could you please test it?
@m-kuhn the controversial code is disabled but not removed. I remember it may trigger some errors, but you can test it. If no more errors, I could remove it later.
@JackBister files merged.

@jwtowner
Copy link
Contributor

jwtowner commented Mar 30, 2022

@jwtowner the new PR won't append the ANDROID_NATIVE_API_LEVEL when it is there, could you please test it?

I can confirm it works. Thanks.

@m-kuhn
Copy link
Contributor

m-kuhn commented Mar 31, 2022

Successfully built with r21e

@nirvn
Copy link
Contributor

nirvn commented Apr 7, 2022

@holmescn , FYI, when trying to build using this PR against Android NDK r23 (23.1.7779620), the following error is thrown while configuring libiconv:

configure:4212: checking whether the C compiler works
configure:4234: /usr/local/lib/android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -fPIC --target=aarch64-none-linux-android  -avoid-version -L/home/runner/builddir/vcpkg_installed/arm64-android/lib -L/home/runner/builddir/vcpkg_installed/arm64-android/lib/manual-link  conftest.c -latomic -lm >&5
clang-12: warning: argument unused during compilation: '-avoid-version' [-Wunused-command-line-argument]
ld: error: cannot open crtbegin_dynamic.o: No such file or directory
ld: error: cannot open crtend_android.o: No such file or directory
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

@JackBoosY
Copy link
Contributor

Ping @holmescn for reply.

@holmesconan
Copy link
Author

holmesconan commented Apr 13, 2022

@holmescn , FYI, when trying to build using this PR against Android NDK r23 (23.1.7779620), the following error is thrown while configuring libiconv:

configure:4212: checking whether the C compiler works
configure:4234: /usr/local/lib/android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -fPIC --target=aarch64-none-linux-android  -avoid-version -L/home/runner/builddir/vcpkg_installed/arm64-android/lib -L/home/runner/builddir/vcpkg_installed/arm64-android/lib/manual-link  conftest.c -latomic -lm >&5
clang-12: warning: argument unused during compilation: '-avoid-version' [-Wunused-command-line-argument]
ld: error: cannot open crtbegin_dynamic.o: No such file or directory
ld: error: cannot open crtend_android.o: No such file or directory
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

@nairaner libiconv seems hacked the autotools scripts, you need an overlay port to make it works. I have an overlay port here

Beside the overlay port, you need to comment $VCPKG_ROOT/scripts/cmake/vcpkg_configure_make.cmake line 767, where add the -avoid-version option caused configuration failed.

@JackBoosY JackBoosY added info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. and removed requires:author-response labels Apr 14, 2022
@strega-nil-ms
Copy link
Contributor

I need to see resolutions for the comments I made before this is marked info:reviewed; to be clear, that means:

  • the if(VCPKG_TARGET_IS_OSX) line needs to be explained
  • z_vcpkg_setup_detected_env needs to be a function
  • VCPKG_ANDROID_NATIVE_API_LEVEL needs to not be an environment variable set in the triplet

@strega-nil-ms strega-nil-ms added requires:author-response and removed info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. labels Apr 14, 2022
@JackBoosY
Copy link
Contributor

Ping for response.

@JackBoosY JackBoosY linked an issue May 10, 2022 that may be closed by this pull request
@JackBoosY JackBoosY added requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. requires:author-response and removed requires:author-response labels Jun 13, 2022
@JackBoosY
Copy link
Contributor

Ping @holmescn again.

@m-kuhn
Copy link
Contributor

m-kuhn commented Jun 24, 2022

#25009 implements a core part of this PR and answers the question about the OSX exception raised here https://github.com/microsoft/vcpkg/pull/21847/files?w=1#r776056939 while #25201 tackles the root problem of the OSX exception.

@JackBoosY
Copy link
Contributor

Convert this PR to draft since there is no progress.

@JackBoosY JackBoosY removed the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Jul 15, 2022
@JackBoosY JackBoosY marked this pull request as draft July 15, 2022 05:36
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Android NDK support request [icu:arm-android] build failure

9 participants