-
Notifications
You must be signed in to change notification settings - Fork 263
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
[BUG] android-ndk-r26c use -pg ld.lld: error: undefined symbol: _mcount #2044
Comments
That symbol doesn't seem to come from bionic, so I'm guessing it's a compiler-rt thing? |
i'd ask @pirama-arumuga-nainar --- i don't know whether it's compiler-rt exactly, or there's an extra library you need for profiling? the latter rings a bell... |
There is (and it's part of the collection of libraries collectively called compiler-rt, I think), but Clang should be linking it automatically as long as those flags are correct. |
Oh, they might not be? https://github.com/DanAlbert/ndk-samples/blob/9cc55c332cfd9db9f8aaf9c7f0e042ada5b5d46f/pgo/app/src/main/cpp/CMakeLists.txt (sorry, I'd forgotten that I had to revert that sample and haven't put it back yet) |
@DanAlbert , Does that mean I need to use -fprofile-generate for profile data? |
That's how I was able to do it successfully. I don't know if that's the only way to do it, but the flags you used in the OP aren't familiar to me (they could be an alias for all I know). |
Yes, please use the clang-based techniques, which are the only ones we support. Alternatively, if you are looking for flame graphs and such to debug performance issues, use simpleperf. ( |
Description
Hi All,
I want to use the -pg option in LLVM for performance profiling, but I'm encountering an error during linking that indicates _mcount is undefined. Can anyone help me out? Thank you.
android-ndk-r26c-linux/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang -pg simd.c -o simdpg
ld.lld: error: undefined symbol: _mcount
Affected versions
r26
Canary version
No response
Host OS
Linux
Host OS version
Ubuntu20.04
Affected ABIs
arm64-v8a
Build system
ndk-build
Other build system
No response
minSdkVersion
android-ndk-r26c
Device API level
No response
The text was updated successfully, but these errors were encountered: