-
Notifications
You must be signed in to change notification settings - Fork 22
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
Cannot locate symbol "_ZSt15get_new_handlerv" #14
Comments
Same here, but cannot locate another symbol. |
Hmm... Sounds quite strange. I cannot reproduce this issue. Which version you use? I released 0.2.0 lately. |
@chengchangwu I fixed publishing on 'crates.io'. |
@osoftware, @chengchangwu |
I've not tried 0.2.1, I'm using 0.2.0. It's strange that after I restructured my project trying to provide a sample to share, the issue disappeared. I can find liboboe-ext.a in target directory now. I did not use compile-library. |
I tried 0.2.1 and still got the same missing symbol. What's interesting, it produces .so file of different sizes: when building from crates, I get 4.9MB, when pointing the dependency to a local repo clone (up to date), I get 4.8MB. Meanwhile, enabling or disabling compile-library feature doesn't affect the result. Here's the entire lib.rs: use oboe::{
AudioInputStreamSync, AudioStream, AudioStreamBuilder, AudioStreamSync, Input, Mono,
PerformanceMode, Status,
};
use pitch::{Pitch, PitchDetector, SAMPLE_RATE, SAMPLE_SIZE};
pub struct VoiceListener {
// detector: PitchDetector,
// stream: AudioStreamSync<Input, (f32, Mono)>,
sample: [f32; SAMPLE_SIZE],
}
impl VoiceListener {
pub fn new() -> Self {
// let detector = PitchDetector::new();
let mut sream = AudioStreamBuilder::default()
// .set_exclusive()
// .set_performance_mode(PerformanceMode::LowLatency)
// .set_input()
// .set_f32()
// .set_mono()
// .set_frames_per_callback(SAMPLE_SIZE as i32)
// .set_sample_rate(SAMPLE_RATE as i32)
// .open_stream()
// .unwrap()
;
Self {
// detector,
// stream,
sample: [0.0; SAMPLE_SIZE],
}
}
pub fn measure_sample(&mut self) -> Option<Pitch> {
// match self.stream.read(&mut self.sample, 50_000) {
// Ok(_) => self.detector.measure(&self.sample),
// Err(_) => None,
// }
Some(Pitch {
frequency: 21.37,
clarity: 10.0,
})
}
pub fn dispose(mut self) -> Status {
// self.stream.close()
Ok(())
}
}
#[no_mangle]
pub extern "C" fn create_voice_listener() -> *mut VoiceListener {
Box::into_raw(Box::new(VoiceListener::new()))
}
#[no_mangle]
pub unsafe extern "C" fn measure_sample(listener: *mut VoiceListener) -> *mut Pitch {
if listener.is_null() {
return Box::into_raw(Box::new(Pitch {
frequency: f32::NAN,
clarity: f32::NAN,
}));
}
match (*listener).measure_sample() {
Some(pitch) => Box::into_raw(Box::new(pitch)),
None => Box::into_raw(Box::new(Pitch {
frequency: f32::NAN,
clarity: f32::NAN,
})),
}
}
#[no_mangle]
pub unsafe extern "C" fn dispose_voice_listener(listener: *mut VoiceListener) {
if !listener.is_null() {
let obj = Box::from_raw(listener);
match obj.dispose() {
_ => (),
}
}
} And Cargo.toml: [package]
name = "pitch-android"
version = "0.1.0"
authors = ["{o} Studio <*@*.*>"]
edition = "2018"
[lib]
crate-type = ["lib", "cdylib"]
[dependencies]
pitch = { path = "../pitch" }
[dependencies.oboe]
features = ["compile-library"]
version = "0.2.1"
# path = "../../../oboe-rs/oboe" The other dependency ( Other interesting, maybe helpful thing: when I uncomment |
@osoftware Looks quite strange. Which ndk version you use? |
21.3.6528147 |
I assume this related to linking with libc++. |
I closed it mistakenly. |
I'm also using 21.3.6528147。It works now without compile-library. I can find the liboboe-ext.a downloaded under target. I do not need to compile any C++. |
@osoftware Seems your development environment misconfigured. |
I get the same errors without |
@osoftware I still assume your build environment is not so clean. |
I replaces cargo ndk with this: CC_armv7_linux_androideabi="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi16-clang" \
CXX_armv7_linux_androideabi="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi16-clang++" \
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi16-clang" \
cargo build --target armv7-linux-androideabi |
Can you give me output of |
same problem with git clone https://github.com/katyo/oboe-rs cargo ndk --platform 21 --target x86_64-linux-android test --release
|
Can we know which ndk version is used by oboe_sys prebuilt? |
@open-trade Current NDK bundle is used for build. |
I get something similar with "_ZTVN10__cxxabiv117__class_type_infoE" on 64 bit. Edit: 32 bit has same issue Edit: Even the Pre-Built demo apk has the same error... |
I had a similar issue, but it was a quirk with my project. I was trying to link against another library which came with its own |
@SupernaviX that's probably not it, it fails even with the given demo project... The only reason I can find is that something changed with Android 11... |
@Wicpar Are you test apk from release page? |
@katyo Yes, i took the apk in the tag assets from the latest release. |
As an option we can try to link with |
Seems I found working solution when I added |
Same error for me in the last build of #19 |
@katyo can you send me the apk you built locally to see if it works ? |
@Wicpar of course Also I linked the |
@katyo the apk doesn't work on my phone: |
Suggest you give up using cpal +oboe, I had solved link problem, but cpal hanged with initializing. Eventually, I used liboboe.a directly with my simple FFI wrapper, everything worked fine. Using these 3rd bindings took much more time. Check out my app, http://rustdesk.com |
@open-trade i have no choice but to use cpal, i need ios support as well as desktop. I think i will just bind directly to opensl-es and make a PR |
@Wicpar my desktop and ios still use cpal |
I've solved this issue before. But I've forgotten the details. Seems I have re-exported that C function in rust file so that it can be located by the dynamic loader. |
@Wicpar, @SupernaviX, @open-trade, @osoftware, @chengchangwu |
Wow, I didn't know you could install crates from a branch! Pretty convenient. @katyo when I tried installing the PR I got build errors. In cargo.toml I added
And then when compiling oboe-sys I got the error
If it makes a difference, my project uses the rust-android-gradle plugin with prebuilt toolchains. |
@SupernaviX Have the master branch compiling with "compile-library" feature enabled? Looks like rust-android-gradle plugin is outdated. I already fixed missing |
@katyo the master branch doesn't compile when I enable that feature. The error is different (it's complaining that I don't have cmake, instead of complaining that I don't have clang++.exe), but it's still failing to build. It looks like you're right, I'm using a rust-android-gradle version without your fix. The latest published version of rust-android-gradle (0.8.3) is from October 2019, but your PR is from Feb 2020. I couldn't figure out how to use the master version of rust-android-gradle on my machine, so I wasn't able to test the fix against that version. Do you have advice on how to use the git version of rust-android-gradle in a project? I think I either need to figure out how to do that, or lock oboe to 0.2.1. |
@SupernaviX I added workaround back so you can test it now without upgrading gradle plugin. |
@katyo thanks, it works! No compilation issues, and I didn't have to muck with clang++ or cmake |
i'm also experiencing this issue. i was getting the missing symbol i've switched to the "packaged-sources" branch and now i'm getting a similar also, rust-android-gradle is able to compile, but my CLI
|
@covercash2 You should set env var CXX_{triple} with c++ compiler corresponding to your target and android platform or simply build using cargo-ndk or rust android gradle plugin. |
i'm still getting |
i added
and now the error is now: after some reading, it seems like i'm not linking the C++ stdlib, at least the error handling. i'm also getting |
@covercash2 Looks like attempt to link of code which compiled with both libstdc++ and libc++ |
sorry for the delay, i got busy all of a sudden. i updated to the master branch and also tried 0.4 and i'm still getting |
just on a hunch i tried it on my phone and i didn't get the error. just on the emulator. i did include x86_64 as a compiler target, though. i didn't realize it would be an issue. |
I close this issue for now. |
I was hitting the |
I am having the same issue right now. I always either get missing symbol See the issue I opened on flutter_rust_bridge. Maybe someone is able to see what the problem is in this repo I set up |
I'm building a Flutter application that is using a Rust library (called using dart:ffi) for performance-critical parts. This generally works, until I try using oboe-rs inside my lib. To nail down the issue I left just this line of code:
I compile the lib using cargo-ndk tool then put the output in jniLibs, like this:
cargo ndk --target armv7-linux-androideabi --platform 21 build && cp -f target/armv7-linux-androideabi/debug/libmylib.so android/app/src/main/jniLibs/armeabi-v7a/
Then, when I try to load this lib on the Dart side, I get this exception:
I tried using oboe-rs from creates.io and from source code, with and without compile-library feature, all result with the same error.
Please note that I have basically no experience in C++ - if this issue is somehow related to misconfiguration of my C++ stack, I don't even know what tools are involved exactly, except that I had to install cmake (I've got 3.16.3).
The text was updated successfully, but these errors were encountered: