-
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] Throwing Inside a Catch Block Triggers a Segmentation Fault ARM 32 bit with c++_shared #1240
Comments
I'm not seeing You might also want to read through #1192 |
Apologies I did not update the issue, I've followed the directions there as best I could by adding: --exclude-libs,libgcc.a --exclude-libs,libgcc_real.a --exclude-libs,libunwind.a I am able to get the exception to throw, but throwing from within the catch is failing. For some reason I'm able to in android studio so I'm not sure if it's due to different .so files being built. If anyone has a moment to download my min repro and see for yourself, please let me know! |
Reading through the story it was very similar to mine. I did read all the same docs, but nowhere did I see I needed to add unwind to my list of library dependencies! Adding that resolved my issue: And added the following to my Linker/Additional Options: And I am using c++_shared for my use of STL in the VS2019 project options and in my Application.mk file for good measure: I set this up in all of my .so files (I have SDL dependencies and so set it up on each of those as well as my main .so) It works! |
It's not necessary. For some reason Visual Studio appears to be requiring it, but that's almost certainly a bug in their system because this isn't required anywhere else. I'm confused though, are you using ndk-build or visual studio? |
I'm using Visual Studio, but I wasn't sure if Visual Studio drills down and calls ndk-build or not, apologies for my ignorance here, the ide wraps a bunch of clang calls and I'm not an android expert so I likely just mis-labeled it. I believe msbuild is the name of their system but I was confused due to the use of clang + android ndk toolchains it's really invoking under the hood. |
Are your edits to Android.mk/Application.mk having any effect? If so, sounds like it's using ndk-build? I really have no idea how this works either. We don't support Visual Studio (but I'm happy to try to help if I can). |
What do I actually do with your test case? It seems to just be your entire VSProjects directory. |
VSProjects/BindstoneClient/BindstoneClient_AndroidGradle/app/src/main/jniLibs/x86_64/libc++_shared.so is not r21's libc++. I don't know what it is, but it's missing the Android note section. It might be the library from r16, which iirc was the only NDK Visual Studio ever supported. I don't think your configuration is valid. |
As far as the x86_64 folder, do not worry about that one, I haven't built for it in some time and Visual Studio only copies libraries to that folder from your android ndk folder at the time of building so it is totally stale. With that said, I'll take a moment to share with you my setup and help you familiarize with Visual Studio's android support as best I can since you have downloaded my repro case and I'd love to empower the Android team to know a little more about this tool flow!
Then in individual components, make sure you also have:
But before when I was using microsoft's hosted NDK I had my NDK folder set to: At this point in time you should be able to build and run! Please let me know if you have any questions, I think it would be extremely beneficial to facilitate more familiarity with Visual Studio across the NDK teams (and on Microsoft's side I think they could really stand to be more in-touch with the NDK so they wrap this stuff properly!) Whatever small amount I can do to help I am happy to do. I am a novice with build systems and the primary reason I'm using Visual Studio for this is because I am not terribly familiar with CMake and ported an existing project to Android from PC and wanted to keep everything within the same IDE I was familiar with (and enjoy) and avoid maintaining multiple build systems. Visual Studio does have cmake support now too, but I hadn't spent time investigating that just yet. |
In addition to see all my build parameters for each project it's a mixture of values set by right clicking on each project and going to "Properties" and the gradle template files. This stuff all seems to be driving microsoft's build system which seems to wrap the ndk build system (I think). |
Thanks for the info!
Yeah, we're more than happy to give them guidance, but we unfortunately don't have the bandwidth to support more build systems than we already do. I'll try to find some time to play with this and/or the case in #1192 because I'm genuinely curious as to what's broken here, but getting the environment needed to test this will be a non-trivial amount of time that I can't spend right now. I suspect it is an msbuild issue, and you both have workarounds, so that shouldn't leave either of you blocked. |
Description
I get the following Segmentation Fault in vs2019 using NDK 21.1.6352462 when attempting to throw from within a catch block:
When excecuting the following (built as a .so file for SDL2).
When looking in vs2019 at my linker command line options I have the following:
My C++ build options are as follows:
This does not reproduce under any other ABI except for 32 bit armeabi-v7a. I'm running this on an Amazon Kindle HD 8.
Arm64, and x64 both work fine. I have not tested x86.
I struggle to throw an exception at all when utilizing c++_static and it crashes for a different reason.
Here is a minimum repro example, requires visual studio 2019: http://mutedvision.com/docs/NDKArmExceptionRepro.zip
Environment Details
Filed with Microsoft/Visual Studio Here: https://developercommunity.visualstudio.com/content/problem/999749/ndk-armeabi-v7a-gnu-unwind-resume-sigsegv-upon-thr.html
The text was updated successfully, but these errors were encountered: