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

Fix Android CI builds #233

Merged
merged 17 commits into from
Dec 5, 2020
Merged

Fix Android CI builds #233

merged 17 commits into from
Dec 5, 2020

Conversation

Bjoe
Copy link
Contributor

@Bjoe Bjoe commented Nov 23, 2020

This is a proposal to fix failing android CI builds. See issue #216

It uses a docker where the android NDK r22 beta 1 is installed to build PEGTL.

See also travis build: https://travis-ci.org/github/Bjoe/PEGTL/jobs/745332637

It needs maybe some "cleanup" regarding to the output.

Maybe some output of the current NDK/SDK version would be useful.

@coveralls
Copy link

coveralls commented Nov 24, 2020

Coverage Status

Coverage remained the same at 92.475% when pulling 6b69f3d on Bjoe:fix-issue-216 into d135e2b on taocpp:master.

@Bjoe
Copy link
Contributor Author

Bjoe commented Nov 24, 2020

Let me introduce some output like: NDK version etc and maybe some other improvement. Give me some days.I will notice you if I'm done.

@Bjoe Bjoe changed the title Fix Android CI builds WIP: Fix Android CI builds Nov 24, 2020
@Bjoe Bjoe changed the title WIP: Fix Android CI builds Fix Android CI builds Dec 3, 2020
@Bjoe
Copy link
Contributor Author

Bjoe commented Dec 3, 2020

It is more or less done.
See travis build: https://travis-ci.org/github/taocpp/PEGTL/jobs/747196414

There is "error"

ls: cannot access '/opt/androidSdk/platforms': Operation not permitted
-- ANDROID_PLATFORM not set. Defaulting to minimum supported version
16.

I didn't understand yet why this happens, because when I use the docker "localy" I didn't get this errors ....
But at least, PEGTL builds without any build errors so it does not harm the build. It would be nice to merge this and I will investigate deeper what are the problems on travis. But I think you know that is a time consumption task :-)

Btw. I use the docker approach because:

  • It is not always downloading and installing the NDK/SDK stuff so it should be faster as before?! Not 100% sure because unfortunately the docker image is also always downloading. I expected that they only downloaded once ...
  • It will not break your build because of some changes (for example, maybe there change the path for cmake etc) in the NDK/SDK or because of some now license agreements etc etc.
  • But the biggest reason is because of maintenance. If there are problems, I or you can take the docker and build PEGTL for android without installing some SDK/NDK locally on your machine etc.
    The command to build PEGTL localy for android is:
cd [TO_PEGTL_SOURCES]
docker run -it --rm -v `pwd`:/source bojoe/cpp-android-ndk-build-env-ubuntu:r22beta1 "cmake -H/source -B/home/developer/build -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/androidSdk/ndk/android-ndk-r22-beta1/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-26 -DCMAKE_BUILD_TYPE=Release -DPEGTL_BUILD_EXAMPLES=OFF && cmake --build /home/developer/build --target all"

See also in .travis.yml
You can also "manually" build and debug the build in the docker:

docker run -it --rm -v `pwd`:/source bojoe/cpp-android-ndk-build-env-ubuntu:r22beta1 "/bin/bash"

or

docker run -it --rm -v `pwd`:/source bojoe/cpp-android-ndk-build-env-ubuntu:r22beta1 "cmake -H/source -B/home/developer/build -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/androidSdk/ndk/android-ndk-r22-beta1/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-26 -DCMAKE_BUILD_TYPE=Release -DPEGTL_BUILD_EXAMPLES=OFF && /bin/bash"

You will find the sources in the docker in /source .... but you can change this with the docker parameter -v ....

When there is a new NDK out, I will create a new docker on the docker hub and "tag" it with the new version. See https://hub.docker.com/r/bojoe/cpp-android-ndk-build-env-ubuntu
The docker sources are here:
https://github.com/Bjoe/DockerImages
if you see I build some more docker environment also for other project because I always take an docker to develop and build .... :-). So I can use the latest ore newest compiler for everything without to mess up my host system ;-)

@d-frey d-frey merged commit 96f766e into taocpp:master Dec 5, 2020
@d-frey
Copy link
Member

d-frey commented Dec 5, 2020

Thanks @Bjoe !

Some points for the future (some of which you already mentioned):

  • Show the output from the compile just like with other jobs.
  • Run the tests.
  • Move those jobs to GitHub Actions.
  • Now that we have fallbacks for std::experimental::filesystem: Maybe older Android versions are now able to use the PEGTL again? Could you check, please?

For moving stuff to GitHub Actions: I've seen that conanio hat some images for Android. I have no idea if that helps, but in our main-ci.yml there is a link to https://github.com/conan-io/conan-docker-tools where they list Android images. If those images are not suitable, you could probably still use your image with a job in our GitHub Actions main-ci.yml.

@Bjoe
Copy link
Contributor Author

Bjoe commented Dec 10, 2020

@d-frey

  • Show the output from the compile just like with other jobs.

  • Run the tests.

  • Move those jobs to GitHub Actions.

  • Now that we have fallbacks for std::experimental::filesystem: Maybe older Android versions are now able to use the PEGTL again? Could you check, please?

Yep, it is possible and that's my idea.

I created some task on my story board ... I will start soon ....see https://github.com/Bjoe/PEGTL/projects/1

@Bjoe
Copy link
Contributor Author

Bjoe commented Dec 10, 2020

@d-frey

For moving stuff to GitHub Actions: I've seen that conanio hat some images for Android. I have no idea if that helps, but in our main-ci.yml there is a link to https://github.com/conan-io/conan-docker-tools where they list Android images. If those images are not suitable, you could probably still use your image with a job in our GitHub Actions main-ci.yml.

Ok. I also involved in the hunter project and there we use also "GitHub Actions" .... let me see what I can found out... but step by step.
First, I will also update PEGTL in hunter then I can see what are working on Github Actions build :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants