我的代码在这里崩溃:
void setText(const string & s)
{
needsReload = true;
_text = s; //<-- SIGSEGV here
}
_text
是一个 std::string
这完全没有意义。this
,_text
并且s
在有效内存中。我不能尝试portstl,因为我需要例外。没有什么可以出错的。我目前正在为 armeabi-v7a 编译。有什么建议么?
经过一番摆弄后,我发现每当我将某些东西分配给事先是空字符串的字符串时,它就会崩溃。我认为这与我的 libstdc++ 有关。这是我的编译和链接标志:
[ 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
我正在使用的构建脚本复制libgnustl_static
到/home/da_petcu21/src/Porkholt/Examples/Mathrix/build-android/armeabi-v7a/CMakeFiles/ndklibs/armeabi-v7a/libstdc++.a
我怀疑它使用了/opt/android-ndk/platforms/android-9/arm/lib
那个