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

dlopen failed: cannot locate symbol "__cxa_pure_virtual" #28

Open
nikita-skobov opened this issue Mar 22, 2021 · 6 comments
Open

dlopen failed: cannot locate symbol "__cxa_pure_virtual" #28

nikita-skobov opened this issue Mar 22, 2021 · 6 comments

Comments

@nikita-skobov
Copy link

This is a continuation of #14

I originally filed this same issue in cpal because I tried using cpal android example, as well as the oboe demo in this repository.

I even tried using the prebuilt oboe-demo in the releases (the latest one, 0.4.1), and i am still getting that error where the __cxa_pure_virtual is not found. More details here:

RustAudio/cpal#563

@imxood
Copy link

imxood commented Dec 26, 2021

in my android11 project, it is ok after add c++_shared lib.

image

@katyo
Copy link
Owner

katyo commented Dec 26, 2021

Should we give up linking with c++ stdlib by default?

@imxood
Copy link

imxood commented Dec 26, 2021

Should we give up linking with c++ stdlib by default?

I think it is more appropriate to consider adding a c++ stdlib feature on the ndk side

@katyo
Copy link
Owner

katyo commented Dec 26, 2021

@imxood Note that oboe crate also may be used without ndk crate, for example shared libs in Rust to use with jvm/flutter apps. Such use case was primary when I created this bindings.

@enfipy
Copy link
Contributor

enfipy commented Jan 27, 2022

Should we give up linking with c++ stdlib by default?

I think we have to make this by default. Because we also managed to run an android app only after linking to c++ stdlib.

@sorz
Copy link

sorz commented Nov 22, 2023

It surprised me that the same build works on Android 10 but not on 11 & 12 (symbol __cxa_pure_virtual not found).

Turning on the feature shared-stdcxx works for me, while adding cargo:rustc-link-lib=c++_shared failed with compile-time linking error (missing symbol __muloti4).

oboe = { version = "0.5", features = ["shared-stdcxx"] }

I wrote the following Gradle script to copy libc++_shared.so:

tasks.register("copyCppSharedLibrary") {
    val src = android.ndkDirectory
        .resolve("toolchains/llvm/prebuilt")
        .listFiles()
        .first { it.isDirectory }
        .resolve("sysroot/usr/lib/aarch64-linux-android")
    val dst = layout.buildDirectory.dir("rustJniLibs/android/arm64-v8a")
    copy {
        from(src)
        into(dst)
        include("libc++_shared.so")
    }
}.configure {
    dependsOn("cargoBuild")
}

Note that it only copy the aarch64 version.

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

No branches or pull requests

5 participants