-
Notifications
You must be signed in to change notification settings - Fork 524
-
Notifications
You must be signed in to change notification settings - Fork 524
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
Compiling OpenAL 1.23.0
for Android.
#824
Comments
You will need to install a compiler toolchain for building code for Android. The Android NDK provides compilers for compiling to Android from other systems. Unfortunately I don't know much about VS's Android support to know how to build a CMake project with it to generate Android binaries. What exactly did you try to run, and what was the output? Can you paste it here? |
...I guess it's not a good idea to use Visual Studio for this right now. CMake also seems to prefer to build for Visual Studio for some reason. Wondering if there's an environment variable (or CMake script variable) to fix that. I get the following output when using CMake (
|
You can try to remove the
not exist? The -G switch can be used to tell CMake to use other generators (availability depending on platform) if you don't want it to use VS. |
I used CMake-gui to delete CMake's cache and then specified a location for NDK's After adding the
Later, I realized I didn't 'turn on'
Since OpenSL is no longer well supported on Android anyway, could you please provide any guidance on how I should go about getting Oboe to work? Again, thank you very much for your time, in advance! |
The
If you don't already have it, you need to get the Oboe sources. Then set the |
Hello there! Compiling with the OpenSL backend has succeeded! (Resulting in a ~ Not only did I succeed, I learnt a lot about build systems as well. Thank you very-much for your immeasurably important guidance, sir @kcat! I'll leave instructions for anyone inexperienced with build systems like me:
Set the value for this entry to (For the fellow *nix users, this probably would be somewhere in Click "Configure" again, and now we play the 'waiting game' :)
...and with that, all you need to do for the CMake part of this process, is press "Generate", ...and wait!
This program, ...anyway, that's it! We're done! Enjoy using OpenAL Soft as |
That would be due to compiling with the default
You should select the toolchain for cross-compiling before clicking Configure. The toolchain contains persistent settings for the host and target environment, so if you configure normally, then try to set the toolchain and configure again, it may not work as expected.
Not all of these are needed. |
I built a binary in |
Not typically, unless they experience a problem in the library and try to get a backtrace or something. You can also use the |
Alright, I think my problem has mostly been solved. I should close this issue now. Thank you very much! |
Hello there! I'm sorry to open this issue again, but there's a problem that I did not mention at all - I did not get a static library ( In order to use shared objects on Android, I need one of those, too. As far as I can see, the CMake script has no options for this. How do I do this? Thank you very much in advance! |
Unlike Windows, separate Static libraries essentially contain compiled object files ( |
Thank you very much for explaining that to me! For the entirety of this issue, I've only been messing up basic terms related to C++ development environments. I will read up on, and experiment with setting up shared libraries on Android with more effort this time. Will try not to disturb you with this further. I deeply appreciate your patience. Thank you very much. |
Thank you very much for the guide how to build OpenAL-Soft for Android. As a Dephi developer, I didn't know anythig about CMake and building projects this way. I was able to build libopenal.so following this guide. That's great. However, the resulting library binary is 32bit. Is it possible to build 64bit library also? I have tried to add some CMake entries regarding Android architecture to no vain. I also tried to modify build.ninja file, replacing -march=arm7-a with 64bit equivalents, with no success. A dlopen() call returns an error about 32bit library (since my app is 64bit native). |
I have managed to solve the issue how to build OpenAL-Soft for Android amr64. One needs to add entry (via GUI "Add Entry", or via command line parameter) ANDRIOD_ABI = arm64-v8a, and specifying desired API version via ANDROID_PLATFORM entry. One also needs to modify OPENSL_LIBRARY to point to the aarch64-linux-android folder with desired API version. |
Thank you very much for looking around here, @Centurion96! ...And you even solved your own issue yourself. That's awesome. Thank you very much! PS Could you please tell me which |
By default, cmake sets OPENSL_LIBRARY to {ndk_version_path}/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/libOpenSLES.so, where 21 is the default platform version when you didn't specify one. In order to compile and link for a different architecture and different platform version, the path needs to point to the library file specific for that architecture and that platform version. For example, if you set ANDRIOD_ABI = arm64-v8a and ANDROID_PLATFORM = 25 then you need to modify OPENSL_LIBRARY path in the following way: |
@Centurion96 Nicely done. Would you mind sharing your compiled libopenal.so? Also I wonder if we could add android compilation to GitHub actions 🤔 I recently found that there's an android build of sView which should've been able to virtualize surround and spatialize ambisonics, but the library is too old so I'm hoping replacing it (rooted) fixes the issue like on Windows so that I can confirm this is what the dev needs to do to fix this. |
Android.arm64-v8a.zip |
Dang it, App Manager lied to me.. That's why I thought "armeabi-v7a" here was just outdated, but apparently the library's actually 32-bit? so would you or @Brahvim happen to have a somewhat recent armeabi-v7a libopenal.so handy? 👀 |
Android.armeabi-v7a.zip |
Thanks so much mate! Now the app started and loaded the DLL properly The dev is probably gonna have to look at the code to see why the settings aren't sticking, but in the meantime, the log tells me where it expects the config file and even MHRs, so hopefully it'll allow me to use my HRTF 🤞 |
...Wait, this binary is called " Thank you very much for answering :) |
@Centurion96 So I figured out the issue with HRTF in sView (and potentially other OpenAL apps on Android) and explained it here. So sorry to bother you again but do you think it would be possible to embed Default HRTF.mhr into libopenal.so like how it's loaded from OpenAL32.dll on Windows? If you do get a chance to take a stab at it, perhaps it might also be useful to compile with Release configuration to reduce the filesize 👀👌 |
Should we ask kcat? |
After a bit more digging I found he already mentioned a way to do it here #46 (comment) |
The default HRTF is embedded by default ( As for specifying extra folders for custom MHRs, you can either set the |
@kcat In that case I can look into setting up an Android build workflow so I don't have to keep botherin Centurion96 😅 So it fails to find the MHR copied to most folders set in ❌ ❌ ✅ On the bright side, I think that if the app creates a public folder in the internal storage, it might allow other apps to read and write to it. So do you think it might be possible to make OpenAL Soft create |
It doesn't sound like a good idea for OpenAL Soft to create publicly accessible directories on the app. That should be up to the app itself to do if it wants. |
@kcat Fair enough, so the only reasonable, non-root alternative I can think of is for the app to add a scoped storage folder picker dialog for the user to explicitly allow the app to access a specific, public folder containing HRTF/*.mhr and probably alsoft.conf and instructing OpenAL Soft to use it (by adding it to |
Pretty much. The app would set the Similarly, it can prepend a path to |
OpenAL Soft uses C++, so it needs the C++ runtime ( You'd still need to include |
I'll try that. Thank you! |
I tried using the android-ndk-r21e and that still failed to compile with the following error. ANDROID_ABI was set to arm64-v8a and the ANDROID_PLATFORM was set to 24 with OBOE enabled and pointing to source. |
I'm honestly a bit confused. You appear to be building on Windows targeting Android/ARM, using Clang, but ends up needing |
So after a lot of messing around. I was able to get somewhere without it completely breaking, the unfortunate thing is it's hitting the max error limit which I tried to disable by passing in the CXX and C flags with -ferror-limit=0 but that didn't work, here is the error limit I am getting. ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors) |
Ok. I was able to compile OpenAL 1.23.1 with android NDK r27b without any modifications except for setting ANDROID_ABI to arm64-v8a and ALSOFT_STATIC_LIBGCC set to true with OPENSL_LIBRARY set to the correct libOpenSLES.so. However, loading the library still throws libgcc_s.so.6 was not found even though it was statically linked (as said above). I don't know if its just a me problem missing some installed CXX compilers or the framework I am using which is a C# program using monodroid as the backend. Is there a way I can provide libgcc_s.so as it's own file because I cannot find it as part of the android NDK. |
I honestly have no idea why there would be a dependency on |
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required): Update the VERSION argument value or use a ... suffix to tell ANDROID_PLATFORM not set. Defaulting to minimum supported version Building OpenAL with support for the following backends: Building with support for CPU extensions: Embedding HRTF datasets Installing library and headers Building utility programs Building example programs Configuring done (18.3s) |
Hello,
I'd like to know how I can (separately) compile OpenAL for Android with an OpenSL-ES or Oboe 'background'.
I'm sorry, but my knowledge of build systems is bleak.
All of my personal attempts ended with me generating a Visual Studio solution, and building that, which would give me DLLs and not Shared Objects.
I have also tried using the CMake commands mentioned in the
XCompile-Android.txt
file, but they throw errors about my Visual Studio installation not supporting Clang (even after installing the 'toolchain' components for Mobile Development in Visual Studio).Could you please provide guidance on what I should be doing?
I thank you, in advance.
The text was updated successfully, but these errors were encountered: