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

Compilation issue #1

Closed
Sculas opened this issue Apr 22, 2022 · 15 comments
Closed

Compilation issue #1

Sculas opened this issue Apr 22, 2022 · 15 comments
Labels
bug Something isn't working good first issue Good for newcomers question Further information is requested

Comments

@Sculas
Copy link

Sculas commented Apr 22, 2022

Hi there. I'm trying to compile this on Ubuntu, but I'm having some issues with compiling.

I installed the x86_64 Android NDK,
set ARCH in CMakeLists.txt to x86-64,

set(ARCH "x86-64")

set NDK_TOOLCHAIN in build.sh

NDK_TOOLCHAIN=$HOME/AndroidSDK/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64

and ran the build script.
Everything goes well, but then I get these errors:

In file included from $HOME/build-tools-android/src/aidl/aidl_language_l.ll:24:
$HOME/build-tools-android/src/aidl/aidl_language_y.yy:36:13: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
    .line = begin.begin.line,
            ^~~~~~~~~~~~~~~~
$HOME/build-tools-android/src/aidl/aidl_language_y.yy:36:13: note: insert an explicit cast to silence this issue
    .line = begin.begin.line,
            ^~~~~~~~~~~~~~~~
            static_cast<int>( )
$HOME/build-tools-android/src/aidl/aidl_language_y.yy:37:15: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
    .column = begin.begin.column,
              ^~~~~~~~~~~~~~~~~~
$HOME/build-tools-android/src/aidl/aidl_language_y.yy:37:15: note: insert an explicit cast to silence this issue
    .column = begin.begin.column,
              ^~~~~~~~~~~~~~~~~~
              static_cast<int>( )
3 warnings and 2 errors generated.

If I do what the note: says, I get the same error in aidl_language_l.ll instead.
This doesn't seem right, so hence I'm reporting this here.

Do you have a fix for this, or did you not have this issue?

@Sculas
Copy link
Author

Sculas commented Apr 22, 2022

As for the src/ directory, I unzipped the src.zip inside of this repository. It seems that either a broken or outdated version of the src directory was pushed.

@Sculas
Copy link
Author

Sculas commented Apr 22, 2022

It also seems that the patches from sdk-tools aren't applied (not sure if they are needed, though). So I think my assumption above is right (broken or outdated src.zip). If that is true, could you please push/update the latest src.zip?

@RohitVerma882
Copy link
Owner

RohitVerma882 commented Apr 22, 2022

First set

NDK_TOOLCHAIN=$HOME/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64

@RohitVerma882
Copy link
Owner

RohitVerma882 commented Apr 22, 2022

Make dir

mkdir build && cd build

Configure cmake

cmake -G 'Ninja' \
    -DCMAKE_C_COMPILER=$NDK_TOOLCHAIN/bin/x86_64-linux-android30-clang \
    -DCMAKE_CXX_COMPILER=$NDK_TOOLCHAIN/bin/x86_64-linux-android30-clang++ \
    -DCMAKE_BUILD_WITH_INSTALL_RPATH=True \
    -DCMAKE_SYSROOT=$NDK_TOOLCHAIN/sysroot \
    -DCMAKE_BUILD_TYPE=Release \
    ..

build source

ninja -j16

@Sculas
Copy link
Author

Sculas commented Apr 22, 2022

Sadly, this does not solve the issue as I'm getting the same error as described above.

@RohitVerma882
Copy link
Owner

Which version of ndk you using?

@Sculas
Copy link
Author

Sculas commented Apr 22, 2022

Ah now that you say that, I think I have the wrong NDK installed. I'll install the proper one and let you know if it worked!

@Sculas
Copy link
Author

Sculas commented Apr 22, 2022

Alright. I was on NDK r22 by accident, just installed r23b (23.1.7779620 to be exact, latest LTS) but sadly enough, still the same problem.

@RohitVerma882
Copy link
Owner

I'm using this ndk https://github.com/Lzhiyong/termux-ndk
and compiled build-tools on android for android

@RohitVerma882
Copy link
Owner

And it's successfully compiled

@RohitVerma882
Copy link
Owner

Currently i haven't pc or laptop
You need to fix it yourself or exclude aidl source to build

@Sculas
Copy link
Author

Sculas commented Apr 22, 2022

I can confirm that doing it with Termux does work, but I did notice that compiling for other architectures didn't work with Termux. That's because you set the right compiler, but didn't set the ARCH in CMakeLists.txt in build.sh. I was able to compile it by only compiling for the architecture I was using (aarch64). So the issue is solved.

@Sculas Sculas closed this as completed Apr 22, 2022
@RohitVerma882
Copy link
Owner

RohitVerma882 commented Apr 22, 2022

Check binarys it's compiled for arm64-v8a, armeabi-v7a, x86, x86_64
And I'm compiled it one by one with setting ARCH arm64-v8a, armeabi-v7a, x86, x86-64

@RohitVerma882
Copy link
Owner

RohitVerma882 commented Apr 22, 2022

aapt2 bin for x86_64 works or not?

@RohitVerma882 RohitVerma882 reopened this Apr 22, 2022
@Sculas
Copy link
Author

Sculas commented Apr 22, 2022

And I'm compiled it one by one with setting ARCH arm64-v8a, armeabi-v7a, x86, x86-64

That would work, yes! But your build.sh script in this repo tries to compile all of them in a single row, which won't work.
Also, by removing aidl from CMakeLists.txt I was able to compile it for x86 on my PC and that worked when testing on my x86 emulator. (I haven't tested the other architectures yet.)

@RohitVerma882 RohitVerma882 added bug Something isn't working good first issue Good for newcomers question Further information is requested labels Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants