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

Add compilation scaffolding for plain Android executable #285

Merged
merged 9 commits into from
Feb 14, 2019

Conversation

hevrard
Copy link
Collaborator

@hevrard hevrard commented Feb 12, 2019

No description provided.

@hevrard
Copy link
Collaborator Author

hevrard commented Feb 12, 2019

This enables to obtain plain executables for Android. Two comments:

  1. Should Android.mk files have Copyright notices?
  2. When tried on an example, the executable fails with the following error: Unable to create engine config for Vulkan. I still open this PR as this run-time issue is separated from the ability to generate the executable. I did not have time to dig deeper on the run-time issue, I will have a look as soon as feasible.

@dj2
Copy link
Collaborator

dj2 commented Feb 12, 2019

Yes, Android.mk files should have copyrights. If I forgot to add them on the existing files that was a mistake.

The 'unable to create engine config' means that your build didn't find vulkan. The erorr comes from samples/config_helper.cc and it's because AMBER_ENGINE_VULKAN is false in the build.

@dneto0
Copy link
Collaborator

dneto0 commented Feb 12, 2019

The 'unable to create engine config' means that your build didn't find vulkan. The erorr comes from samples/config_helper.cc and it's because AMBER_ENGINE_VULKAN is false in the build.

Make sure you have the LunarG / Vulkan SDK. Then source the env script. Then build Amber.

When you run the executable, make sure you have sourced the env script first in that shell.

Copy link
Collaborator

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

OMG I love this change. Will be so useful to me.

dj2 has approval authority on this one.

@dj2
Copy link
Collaborator

dj2 commented Feb 12, 2019

Wait, there's an env script? I've been setting all the env variables manually....sigh.

@hevrard
Copy link
Collaborator Author

hevrard commented Feb 12, 2019

@dneto0 I am not sure about the Vulkan SDK env script, since we are building for Android, so the libvulkan is to be found in the Android NDK, and the shell to run the executable is the adb shell on device?

@hevrard
Copy link
Collaborator Author

hevrard commented Feb 12, 2019

Thanks for the help, I tried to address all comments.

The executable does not fail on the Unable to create engine config for Vulkan anymore, but it fails on Sample: extensions of validation layers are not supported, which may be related to the shader_test file I am using for testing?

@hevrard
Copy link
Collaborator Author

hevrard commented Feb 12, 2019

The ndk build is failing due to:

./../include/amber/vulkan_header.h:28:34: error: unknown warning group '-Wzero-as-null-pointer-constant', ignored [-Werror,-Wunknown-pragmas]
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
                                 ^

I think this is due to kokoro using the old NDK r15, because the latest NDK r19 compiles just fine. I guess the clang shipping in r15 is too old to know about -Wzero-as-null-pointer-constant.

@jaebaek it looks like you introduced those pragma in a previous commit today, what is your opinion on this?

@dj2
Copy link
Collaborator

dj2 commented Feb 12, 2019

Aaaahhh, compilers are a pain.

Sigh, can you export -Wno-unknown-pragmas in the environment for your ndk build?

@hevrard
Copy link
Collaborator Author

hevrard commented Feb 12, 2019

I did not manage to use the environment for exporting -Wno-unknown-pragmas, it looks like the ndk-build script overwrites CFLAGS and its siblings. So I hardcoded the workaround in samples/Android.mk.

A last question: the kokoro script for android_test builds only on armeabi-v7a, should we restrict the default ABI of amber_ndk to armeabi-v7a? Currently android_ndk is built for all Android ABIs, but that may be a waste of kokoro time/resources?

@dj2
Copy link
Collaborator

dj2 commented Feb 13, 2019

We limited kokoro to build a single target otherwise the build took too long. Building all the targets took on the order of an hour, this gets it down to minutes.

I figured the coverage from a single target was enough to verify the build was still working without the pain of waiting an hour to commit.

ppm.cc
LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. $(LOCAL_PATH)/../include
LOCAL_LDLIBS:=-landroid -lvulkan -llog
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror -DAMBER_ENGINE_VULKAN -Wno-unknown-pragmas
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you want -DAMBER_ENGINE_VULKAN=1 which would match what the other cmake files output.

@dj2 dj2 merged commit b053505 into google:master Feb 14, 2019
@hevrard hevrard deleted the android-plain-exec branch February 18, 2019 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants