How to build OpenAL-Soft and set up it in Qt Creator for Android
-
Yes, I added
#define RESTRICT
and I see fewer errors. Some files have this line#include "config.h"
, but this file is not in the OpenAL-Soft source code. I added the emptyconfig.h
file. I think this file must be generated by CMake if you are compiling OpenAL-Soft from source. I found theconfig.h.in
file that doesn't have the#define RESTRICT
:config..h.in
/* Define if deprecated EAX extensions are enabled */ #cmakedefine ALSOFT_EAX /* Define if HRTF data is embedded in the library */ #cmakedefine ALSOFT_EMBED_HRTF_DATA /* Define if we have the posix_memalign function */ #cmakedefine HAVE_POSIX_MEMALIGN /* Define if we have the _aligned_malloc function */ #cmakedefine HAVE__ALIGNED_MALLOC /* Define if we have the proc_pidpath function */ #cmakedefine HAVE_PROC_PIDPATH /* Define if we have the getopt function */ #cmakedefine HAVE_GETOPT /* Define if we have DBus/RTKit */ #cmakedefine HAVE_RTKIT /* Define if we have SSE CPU extensions */ #cmakedefine HAVE_SSE #cmakedefine HAVE_SSE2 #cmakedefine HAVE_SSE3 #cmakedefine HAVE_SSE4_1 /* Define if we have ARM Neon CPU extensions */ #cmakedefine HAVE_NEON /* Define if we have the ALSA backend */ #cmakedefine HAVE_ALSA /* Define if we have the OSS backend */ #cmakedefine HAVE_OSS /* Define if we have the PipeWire backend */ #cmakedefine HAVE_PIPEWIRE /* Define if we have the Solaris backend */ #cmakedefine HAVE_SOLARIS /* Define if we have the SndIO backend */ #cmakedefine HAVE_SNDIO /* Define if we have the WASAPI backend */ #cmakedefine HAVE_WASAPI /* Define if we have the DSound backend */ #cmakedefine HAVE_DSOUND /* Define if we have the Windows Multimedia backend */ #cmakedefine HAVE_WINMM /* Define if we have the PortAudio backend */ #cmakedefine HAVE_PORTAUDIO /* Define if we have the PulseAudio backend */ #cmakedefine HAVE_PULSEAUDIO /* Define if we have the JACK backend */ #cmakedefine HAVE_JACK /* Define if we have the CoreAudio backend */ #cmakedefine HAVE_COREAUDIO /* Define if we have the OpenSL backend */ #cmakedefine HAVE_OPENSL /* Define if we have the Oboe backend */ #cmakedefine HAVE_OBOE /* Define if we have the Wave Writer backend */ #cmakedefine HAVE_WAVE /* Define if we have the SDL2 backend */ #cmakedefine HAVE_SDL2 /* Define if we have dlfcn.h */ #cmakedefine HAVE_DLFCN_H /* Define if we have pthread_np.h */ #cmakedefine HAVE_PTHREAD_NP_H /* Define if we have malloc.h */ #cmakedefine HAVE_MALLOC_H /* Define if we have cpuid.h */ #cmakedefine HAVE_CPUID_H /* Define if we have intrin.h */ #cmakedefine HAVE_INTRIN_H /* Define if we have guiddef.h */ #cmakedefine HAVE_GUIDDEF_H /* Define if we have initguid.h */ #cmakedefine HAVE_INITGUID_H /* Define if we have GCC's __get_cpuid() */ #cmakedefine HAVE_GCC_GET_CPUID /* Define if we have the __cpuid() intrinsic */ #cmakedefine HAVE_CPUID_INTRINSIC /* Define if we have SSE intrinsics */ #cmakedefine HAVE_SSE_INTRINSICS /* Define if we have pthread_setschedparam() */ #cmakedefine HAVE_PTHREAD_SETSCHEDPARAM /* Define if we have pthread_setname_np() */ #cmakedefine HAVE_PTHREAD_SETNAME_NP /* Define if we have pthread_set_name_np() */ #cmakedefine HAVE_PTHREAD_SET_NAME_NP /* Define the installation data directory */ #cmakedefine ALSOFT_INSTALL_DATADIR "@ALSOFT_INSTALL_DATADIR@"
-
You can download my example here from DropBox.
-
I tried to build OpenAL-Soft for Android but I have these errors: https://github.com/DJLink/android-openal-soft/issues/1
E:\Libs\open-soft-android\android-openal-soft-master\jni>ndk-build
fcntl(): Bad file descriptor
Android NDK: The armeabi ABI is no longer supported. Use armeabi-v7a.
Android NDK: NDK Application 'local' targets unknown ABI(s): armeabi
Android NDK: Please fix the APP_ABI definition in E:/Libs/open-soft-android/android-openal-soft-master/jni/Application.mk E:/AppData/Android/SDK/ndk/22.1.7171670/build//../build/core/setup-app.mk:76: *** Android NDK: Aborting . Stop. -
@8Observer8 You need to show the picture of Tools->Options->Devices->Android
-
@8Observer8 what is your targeted android version(s)?
-
I added Bullet Physics to the project using sources. It works for emulator and for smartphone too:
-
@8Observer8
from here:
https://developer.android.com/build/jdks14 (API 34) 17 Core libraries
13 (API 33) 11 Core libraries
12 (API 32) 11 Java API
11 and lower Android versions=============================
your JDK version should be 11, not 17 for Android 7.
Still Android 7? I guess most Android phones have version 12 or 13 now. -
@JoeCFD said in How to install OpenAL-Soft for Android in Qt Creator by copying OpenAL-Soft sources into a project:
Still Android 7?
I have Redmi 4x with Android 7
-
@8Observer8 That is very old. Then your JDK version is wrong at the first place.
-
Android NDK: The armeabi ABI is no longer supported. Use armeabi-v7a.
I use
armeabi-v7a
when I build for smartphone (and x86_64 - for emulator) but how to usearmeabi-v7a
when I build from the console? It will be good to have at lease a library for smartphone. -
@8Observer8 show Projects->Build(Android)->Build Settings
click qmake "Details" button under Build Steps. You will see options for ABIs on QtCreator 11.0.1(comes with Qt-5.15.2)
I use arm64-v8a and my JDK version is 11. My target Android versions are 12/13. -
@8Observer8 I guess you have a different version of qt creator. I do not know yours.
-
@8Observer8 You build OpenAL-Soft for Android 7. I did not say it does not support Android 7.
Instead you need JDK 11 to build C++ apps for Android 7. But in your settings, JDK 17 is used. -
@JoeCFD said in How to install OpenAL-Soft for Android in Qt Creator by copying OpenAL-Soft sources into a project:
Instead you need JDK 11 to build C++ apps for Android 7. But in your settings, JDK 17 is used.
I tried to run apps with Box2D and Bullet Physics on real smartphone Redmi 4x with Android 7. I use JDK 17 and it works. I tried to run an example with QMediaPlayer on my smartphone and it plays music. I think I found a solution. I should try to use Bass Audio Library for 3D sounds on Android. It's is too difficult to add OpenAL-Soft directly with sources. Now I know this information:
Note that OpenAL is LGPL-licensed. Which means you need to release the source to your application if you make it part of your application.
-
@8Observer8 Great it works for you with JDK 17. You can still build OpenAL-Soft to dynamic lib and add it to your app for Android. It does not violate LGPL-license.
-
@JoeCFD what do you think about this? https://github.com/AerialX/openal-soft-android How to build it?