source-engine icon indicating copy to clipboard operation
source-engine copied to clipboard

Android on Linux compiler configuration error

Open Moe-Baker opened this issue 2 years ago • 16 comments

Hello, I'm using Ubuntu 16.04.6 32bit in VirtualBox, I followed the how to build instructions and I managed to build for Linux successfully, but android builds are giving me a compiler configuration error.

I'm using: -gcc v5.4.0 -g++ v5.4.0 -clang v3.8.0-2

Here's the build log: https://pastebin.com/fqvRicQe.

The problem seems to be with the Android NDK, I downloaded android-ndk-r10e-linux-x86_64.zip as instructed, decompressed the files, ran chmod +x /ANDROID_NDK_DIRECTORY -R.

I'm noticing that the build script is looking for a folder that doesn't exist in my Android NDK, specifically: android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86 I have android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 Instead, did I download the wrong NDK, do I need to further setup the NDK?

Thank you for your time.

Moe-Baker avatar Jan 07 '23 23:01 Moe-Baker

It is better not to use Android emulation X86 architecture to compile, because it is very inefficient and error-prone, it is recommended to use CI to assist your compilation

stephen-cusi avatar Jan 08 '23 01:01 stephen-cusi

It is better not to use Android emulation X86 architecture to compile, because it is very inefficient and error-prone, it is recommended to use CI to assist your compilation

I'm running Ubuntu on a Windows host, not via Android termux. Thank you for the CI/CD tip, but I'm trying to build an APK not just verify build reports.

Moe-Baker avatar Jan 08 '23 09:01 Moe-Baker

Try the following command, recommended for Ubuntu 20.04 or 22.04

#Install dependent libraries
sudo apt update; sudo apt upgrade -y ;apt install g++ gcc
wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -o /dev/null
sudo apt update;sudo apt upgrade;sudo apt install ccache
unzip android-ndk-r10e-linux-x86_64.zip > /dev/null
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz -o /dev/null
tar xvf clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz > /dev/null
mv clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-16.04 clang/
export PATH=$(pwd)/clang/bin:$PATH
mv android-ndk-r10e ndk/
export ANDROID_NDK_HOME=$(pwd)/ndk
mkdir ./andriod
git submodule init;git submodule update

stephen-cusi avatar Jan 08 '23 09:01 stephen-cusi

Thanks, I'll give it a try

Moe-Baker avatar Jan 08 '23 10:01 Moe-Baker

Try the following command, recommended for Ubuntu 20.04 or 22.04

The same problem remains, here's a build log. I noticed you recommended using Ubuntu 20.04 or 22.04, but the build tutorial suggests using Ubuntu 16.04, is this no longer the case? Also issue #69 suggests using Ubuntu 32 bit, using 64 bit Ubuntu gave me the same freetype not found error mentioned on that issue.

Moe-Baker avatar Jan 08 '23 12:01 Moe-Baker

Do you have the project setup correctly to export to android? I have this small modification I want to try and I'd really appreciate it if you can build it for me

Moe-Baker avatar Jan 08 '23 12:01 Moe-Baker

Well, i should update wiki and workflow scripts. I don't using gcc from ndk to build anymore

nillerusr avatar Jan 08 '23 12:01 nillerusr

Following the instructions mentioned in this Fork I managed to get the install process to finish, but I end up with these .so files for the android architecture used as shown here, how can I get an APK? Built using ./waf configure -T release --togles --android=armeabi-v7a-hard,host,21 --prefix=/home/mob/Workspace/Output. Here's the Build Log.

Moe-Baker avatar Jan 09 '23 12:01 Moe-Baker

Following the instructions mentioned in this Fork I managed to get the install process to finish, but I end up with these .so files for the android architecture used as shown here, how can I get an APK? Built using ./waf configure -T release --togles --android=armeabi-v7a-hard,host,21 --prefix=/home/mob/Workspace/Output. Here's the Build Log.

https://github.com/nillerusr/srceng-android Its compilation method is a bit troublesome.

stephen-cusi avatar Jan 10 '23 00:01 stephen-cusi

https://github.com/nillerusr/srceng-android Its compilation method is a bit troublesome.

I couldn't find build instructions, so I tried following the GitHub build action by using these commands.

Which gave me this error: ./scripts/workflow.sh: line 8: cd: jni/src/tierhook: No such file or directory make: *** No targets specified and no makefile found. Stop. when trying to execute the ./scripts/workflow.sh shell script.

No jni/ directory exists in the srceng-android directory. Are there any build instructions out there? or a fix for this?

Moe-Baker avatar Jan 10 '23 11:01 Moe-Baker

I just noticed that the Github action specifies the con-wrappers branch for the build, I missed that at first, that branch has the jni directory. I'll try building that.

Moe-Baker avatar Jan 10 '23 11:01 Moe-Baker

I just managed to build the nillerusr/srceng-android project on the con-wrappers branch, but it's the old version that emulated the nvidia tegra, is the new version based on the source leak located on a different branch or something?

Moe-Baker avatar Jan 10 '23 14:01 Moe-Baker

我刚刚设法nillerusr/srceng-android在分支上构建项目con-wrappers,但它是模拟 nvidia tegra 的旧版本,基于源泄漏的新版本位于不同的分支上还是什么?

I just managed to build the "nillerusr/srceng-android" project on the "con-wrappers" branch, but it is the old version that emulates the nvidia tegra, is the new version based on the source code leak that is on a different branch or something?

andriod-fixes

I just managed to build the nillerusr/srceng-android project on the con-wrappers branch, but it's the old version that emulated the nvidia tegra, is the new version based on the source leak located on a different branch or something?

The default branch "Android-fixrs" is the new port starter.

stephen-cusi avatar Jan 11 '23 00:01 stephen-cusi

Alright, so I managed to build the android-fixes branch; the APK installs and opens fine, but whenever I try to launch the engine I get this SDL error.

SDL Error Error: dlopen failed: library "libSDL2.so" not found

I noticed that the official APK has that .so file and some more, but my compilation of nillerusr/source-engine didn't produce some of these .so files. I need to modify the SDL2 library directly, so I need a fresh libSDL2.so file, how can I compile that?

Moe-Baker avatar Jan 11 '23 08:01 Moe-Baker

./waf -h

stephen-cusi avatar Jan 13 '23 09:01 stephen-cusi

@Moe-Baker better build it with cmake and android-ndk-r20b. Well i need build scripts for building thirdpardy i think.

nillerusr avatar Jan 14 '23 11:01 nillerusr