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

Static linking with Oboe 1.9.0 causes OpenSL to crash #2102

Open
dk-3cx opened this issue Sep 12, 2024 · 2 comments
Open

Static linking with Oboe 1.9.0 causes OpenSL to crash #2102

dk-3cx opened this issue Sep 12, 2024 · 2 comments
Labels

Comments

@dk-3cx
Copy link

dk-3cx commented Sep 12, 2024

Oboe version: 1.9.0
Doesn't reproduce in 1.8.1

The recent change in src/opensles/EngineOpenSLES.cpp included into Oboe 1.9.0 has introduced stubs for OpenSL ES global constants inside the Oboe library and initializes them all with nullptr:

// Satisfy extern in OpenSLES.h
// These are required because of b/337360630, which was causing
// Oboe to have link failures if libOpenSLES.so was not available.
SL_API const SLInterfaceID SL_IID_ENGINE = nullptr;
SL_API const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE = nullptr;
SL_API const SLInterfaceID SL_IID_ANDROIDCONFIGURATION = nullptr;
SL_API const SLInterfaceID SL_IID_RECORD = nullptr;
SL_API const SLInterfaceID SL_IID_BUFFERQUEUE = nullptr;
SL_API const SLInterfaceID SL_IID_VOLUME = nullptr;
SL_API const SLInterfaceID SL_IID_PLAY = nullptr;

We develop an Android app (in Kotlin) with a native library for it that uses both Oboe and OpenSL. OpenSL is used NOT as a backend for Oboe, but independently from Oboe. Oboe is statically linked with our native lib, while libOpenSLES.so is used as a shared library. This leads to crashes due to null pointer exceptions, because the stubs in Oboe hide the original constants from libOpenSLES.so.

Could you please fix it in some way, e.g. by introducing some #ifdef with a macro that can be passed to cmake when building Oboe? So that we can choose during the compilation if we need these stubs or not.

@dk-3cx dk-3cx added the bug label Sep 12, 2024
@philburk
Copy link
Collaborator

Hmm. We did not anticipate that.
I try to avoid conditional compilation tricks.
I think it might work if I change SL_IID_ENGINE to OBOE_SL_IID_ENGINE, etcetera.

@dk-3cx - Do you think that would be enough to avoid the naming collisions?

@dk-3cx
Copy link
Author

dk-3cx commented Sep 17, 2024

Our code works fine if I remove all the mentioned constants. Renaming them seems to have the same effect. But is such a solution acceptable from your side? I guess you named them this way for a reason, no? (to satisfy some extern declarations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants