Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:01:37+00:00 2026-06-11T23:01:37+00:00

My code crashes here: void setText(const string & s) { needsReload = true; _text

  • 0

My code crashes here:

void setText(const string & s) 
{ 
    needsReload = true; 
    _text = s; //<-- SIGSEGV here
}

_text is a std::string

This makes absolutely no sense. this, _text and s are in valid memory. I can’t try portstl because I need exceptions. There is simply nothing that can go wrong. I’m currently compiling for armeabi-v7a.
Any suggestions?

After some more fiddling I discovered that it crashes whenever I assign something to a string that was the empty string beforehand. I think it has something to do with my libstdc++. Here are my compilation and linking flags:

[ 50%] Building CXX object CMakeFiles/Mathrix.dir/main.cpp.o
/opt/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-g++   -DMathrix_EXPORTS -DANDROID -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ --sysroot=/opt/android-ndk/platforms/android-9/arch-arm -fsigned-char -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fdata-sections -ffunction-sections -fPIC -Wno-psabi -frtti -fexceptions -marm -Os -finline-limit=64 -fno-strict-aliasing -fno-omit-frame-pointer -DDEBUG -D_DEBUG -DDEBUG -fPIC -isystem /opt/android-ndk/platforms/android-9/arch-arm/usr/include -isystem /opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/include -isystem /opt/android-ndk/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I/home/da_petcu21/src/Porkholt/Examples/Mathrix/../../Engine/include -I/home/da_petcu21/src/Porkholt/Examples/Mathrix/../../Engine/../Externals/lua/src -I/home/da_petcu21/src/Porkholt/Examples/Mathrix/../../Engine/../Externals/libpng -I/home/da_petcu21/src/Porkholt/Examples/Mathrix/../../Engine/../Externals/zlib -I/home/da_petcu21/src/Porkholt/Examples/Mathrix/../../Engine/../Externals/uremote/include -I/home/da_petcu21/src/Porkholt/Examples/Mathrix/../../Engine/../Externals/openal-soft/include    -o CMakeFiles/Mathrix.dir/main.cpp.o -c /home/da_petcu21/src/Porkholt/Examples/Mathrix/main.cpp
Linking CXX shared library ../libs/armeabi-v7a/libMathrix.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/Mathrix.dir/link.txt --verbose=Yes
/opt/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-g++  -fPIC --sysroot=/opt/android-ndk/platforms/android-9/arch-arm -fsigned-char -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fdata-sections -ffunction-sections -fPIC -Wno-psabi -frtti -fexceptions -marm -Os -finline-limit=64 -fno-strict-aliasing -fno-omit-frame-pointer -DDEBUG -D_DEBUG -DDEBUG -Wl,--fix-cortex-a8 -Wl,--gc-sections -Wl,--no-undefined   -shared -Wl,-soname,libMathrix.so -o ../libs/armeabi-v7a/libMathrix.so CMakeFiles/Mathrix.dir/main.cpp.o -L/opt/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/user/libs/armeabi-v7a -L/home/da_petcu21/src/Porkholt/Examples/Mathrix/build-android/armeabi-v7a/CMakeFiles/ndklibs/armeabi-v7a -L/home/da_petcu21/src/Porkholt/Examples/Mathrix/build-android/libs/armeabi-v7a -lPorkholt -llua -Wl,-rpath,/opt/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/user/libs/armeabi-v7a:/home/da_petcu21/src/Porkholt/Examples/Mathrix/build-android/armeabi-v7a/CMakeFiles/ndklibs/armeabi-v7a:/home/da_petcu21/src/Porkholt/Examples/Mathrix/build-android/libs/armeabi-v7a 

The build script I’m using copies libgnustl_static to /home/da_petcu21/src/Porkholt/Examples/Mathrix/build-android/armeabi-v7a/CMakeFiles/ndklibs/armeabi-v7a/libstdc++.a

I suspect it uses the one in /opt/android-ndk/platforms/android-9/arm/lib instead

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:01:38+00:00Added an answer on June 11, 2026 at 11:01 pm

    The problem was that stl was linked statically with each of my libraries, thus creating copies of certain globals it required to be shared. (see Can't load native shared library with dependencies in a native activity app for a look over my apk’s library layout).

    For future reference, here is a pretty good explanation on why this happens: http://www.trilithium.com/johan/2005/06/static-libstdc/

    I managed to solve the problem by simply linking stl dynamically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListActivity which has an adapter that crashes. Here is the code
I've been struggling with this for a while now, and this code crashes with,
Here's my code: private void makeDialog2() { AlertDialog.Builder about = new AlertDialog.Builder(getContext()); about.setTitle(You Won!);
My app crashes when changing activity Here is my code, I was following a
My app crashed when i trying to change UITextView text. Here is the code:
The following code crashes and burns and I don't understand why: DateTime dt =
Every now and then (ahem...) my code crashes on some system; quite often, my
I wanted to know why the following code crashes. int main( ) { int
Beginner in Android development. My code crashes. I have made a simple Java method
When I run the following Code it crashes at the last line. I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.