-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Build failure for android on Windows #927
Comments
What executables does the Windows NDK provide instead? Is it just |
Sorry for the typo. The NDK(r19) does have the arm7-linux-android21-clang.cmd but it doesn't have clang++.cmd. Moreover, in their clang.cmd, they are using clang++, that's why the cmake complains.
for the -ar and ranlib, only .exe exists. |
Thank you, we'll fix the toolchain file. |
Hi @CgGraphic , hi @romainguy I went through similar issues and just a minute ago successfully compiled the filament libraries for Android. 1.) Broken ndk19b From my understanding, the error "The CMAKE_C_COMPILER is set to a C++ compiler" is known and has been fixed in the NDK 19 and 20 branches: I downloaded the appropriate NDK build here: , specifically android-ndk-5345600-windows-x86_64.zip I've replaced the contents \android-sdk\ndk-bundle with zip. This fixed the compiler test. 2.) Adaptions to toolchain files a) toolchain-aarch64-linux-android.cmake I've commented out these three lines:
b) toolchain-arm7-linux-android.cmake I've adadapted these three lines:
I hope this helps! |
@maikschulze Thanks, It seems that to successfully run the android sample, the CMakeLists.txt needs to be changed too. I change line 321 from
to
Now, the android samples run successfully. |
@maikschulze Thank you, I'm about to upload a change with the proper fixes. |
You can try PR #968 to see if it fixes your issues with the new NDK. |
* Fix Android builds on Windows This PR fixes #927 * Add missing endline * Fix armv7a Android builds
@romainguy , |
Describe the bug
cannot build android aar on Windows
To Reproduce
The first error happened in the second steps of Build stages (describled at android/Windows.md)
clang++.exe: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] testCCompiler.c:2:3: error: "The CMAKE_C_COMPILER is set to a C++ compiler" # error "The CMAKE_C_COMPILER is set to a C++ compiler"
I check the toolchain cmake in the filament/build/toolchain-arm7-linux-android.cmake
But the NDK(r19) doesn't have the arm7-linux-android21-clang.cmd, so as the -ar.cmd or ranlib.
So i change the .cmake into follows
it successfully write makefiles.
But the ninja install complained
So i change the .cmake
set(CMAKE_POSITION_INDEPENDENT_CODE OFF) ON ->OFF
But the ninja still complains with -fPIC on materials.S.o, after some digging.
in the filament/CMakeLists.txt , i commented
Now all the libs is build. [Maybe not all?]
So i went to generate filament-android.
but i got
D:/Projects/Filament_Windows/out/android-release/filament/lib/armeabi-v7a/libfilament.a(Engine.cpp.o):Engine.cpp:function filament::details::FEngine::init(): error: undefined reference to 'MATERIALS_PACKAGE' D:/Projects/Filament_Windows/out/android-release/filament/lib/armeabi-v7a/libfilament.a(Engine.cpp.o):Engine.cpp:function filament::details::FEngine::init(): error: undefined reference to 'MATERIALS_PACKAGE' D:/Projects/Filament_Windows/out/android-release/filament/lib/armeabi-v7a/libfilament.a(Skybox.cpp.o):Skybox.cpp:function filament::details::FSkybox::createMaterial(filament::details::FEngine&, bool): error: undefined reference to 'MATERIALS_PACKAGE' D:/Projects/Filament_Windows/out/android-release/filament/lib/armeabi-v7a/libfilament.a(Skybox.cpp.o):Skybox.cpp:function filament::details::FSkybox::createMaterial(filament::details::FEngine&, bool): error: undefined reference to 'MATERIALS_PACKAGE' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) inja: build stopped: subcommand failed.
Now i am really stucked.
Several unsuccessful attemtion.
So any suggestion?
The text was updated successfully, but these errors were encountered: