gpt4 book ai didi

c++ - Cryptopp 致命信号 11

转载 作者:行者123 更新时间:2023-11-28 02:15:55 24 4
gpt4 key购买 nike

这是 log1 应用程序输出:

   :    ... 25 more
W/System.err( 1500): java.lang.ClassNotFoundException: android.graphics.drawable.VectorDrawable
W/System.err( 1500): at java.lang.Class.classForName(Native Method)
W/System.err( 1500): at java.lang.Class.forName(Class.java:217)
W/System.err( 1500): at java.lang.Class.forName(Class.java:172)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.getClass(ExtractStyle.java:388)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:94)
W/System.err( 1500): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:430)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
W/System.err( 1500): at android.app.Activity.performCreate(Activity.java:5275)
W/System.err( 1500): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
W/System.err( 1500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
W/System.err( 1500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2110)
W/System.err( 1500): at android.app.ActivityThread.access$600(ActivityThread.java:138)
W/System.err( 1500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err( 1500): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1500): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1500): at android.app.ActivityThread.main(ActivityThread.java:4950)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
W/System.err( 1500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
W/System.err( 1500): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 1500): Caused by: java.lang.NoClassDefFoundError: android/graphics/drawable/VectorDrawable
W/System.err( 1500): ... 25 more
W/System.err( 1500): Caused by: java.lang.ClassNotFoundException: android.graphics.drawable.VectorDrawable
W/System.err( 1500): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
W/System.err( 1500): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
W/System.err( 1500): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
W/System.err( 1500): ... 25 more
W/System.err( 1500): java.lang.NoSuchFieldException: View_paddingStart
W/System.err( 1500): at java.lang.Class.getDeclaredField(Class.java:631)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.getField(ExtractStyle.java:427)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:173)
W/System.err( 1500): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:430)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
W/System.err( 1500): at android.app.Activity.performCreate(Activity.java:5275)
W/System.err( 1500): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
W/System.err( 1500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
W/System.err( 1500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2110)
W/System.err( 1500): at android.app.ActivityThread.access$600(ActivityThread.java:138)
W/System.err( 1500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err( 1500): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1500): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1500): at android.app.ActivityThread.main(ActivityThread.java:4950)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
W/System.err( 1500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
W/System.err( 1500): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 1500): java.lang.NoSuchFieldException: View_paddingEnd
W/System.err( 1500): at java.lang.Class.getDeclaredField(Class.java:631)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.getField(ExtractStyle.java:427)
W/System.err( 1500): at org.qtproject.qt5.android.ExtractStyle.<init>(ExtractStyle.java:174)
W/System.err( 1500): at org.qtproject.qt5.android.QtActivityDelegate.loadApplication(QtActivityDelegate.java:430)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:245)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:655)
W/System.err( 1500): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
W/System.err( 1500): at android.app.Activity.performCreate(Activity.java:5275)
W/System.err( 1500): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
W/System.err( 1500): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2049)
W/System.err( 1500): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2110)
W/System.err( 1500): at android.app.ActivityThread.access$600(ActivityThread.java:138)
W/System.err( 1500): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err( 1500): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1500): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1500): at android.app.ActivityThread.main(ActivityThread.java:4950)
W/System.err( 1500): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1500): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1500): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
W/System.err( 1500): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
W/System.err( 1500): at dalvik.system.NativeStart.main(Native Method)
D/dalvikvm( 1500): GC_CONCURRENT freed 494K, 14% free 5744K/6663K, paused 81ms+191ms, total 320ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 18ms
W/ResourceType( 1500): Skipping entry 0x10804c7 in package table 0 because it is not complex!
D/dalvikvm( 1500): GC_CONCURRENT freed 462K, 14% free 5843K/6727K, paused 34ms+3ms, total 75ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 18ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 541K, 15% free 5829K/6791K, paused 18ms, total 18ms
D/dalvikvm( 1500): GC_CONCURRENT freed 409K, 13% free 5932K/6791K, paused 55ms+3ms, total 95ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 40ms
D/dalvikvm( 1500): GC_CONCURRENT freed 501K, 14% free 5990K/6919K, paused 67ms+2ms, total 100ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 36ms
D/dalvikvm( 1500): GC_CONCURRENT freed 544K, 15% free 5999K/6983K, paused 2ms+3ms, total 63ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 44ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 477K, 14% free 6032K/6983K, paused 17ms, total 18ms
D/dalvikvm( 1500): GC_CONCURRENT freed 479K, 14% free 6065K/6983K, paused 63ms+2ms, total 106ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 43ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 489K, 14% free 6072K/7047K, paused 19ms, total 20ms
D/dalvikvm( 1500): GC_CONCURRENT freed 438K, 13% free 6137K/7047K, paused 31ms+3ms, total 72ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 43ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 299K, 14% free 6143K/7111K, paused 19ms, total 19ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 30K, 14% free 6156K/7111K, paused 19ms, total 19ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 38K, 14% free 6149K/7111K, paused 19ms, total 19ms
D/dalvikvm( 1500): GC_FOR_ALLOC freed 499K, 14% free 6158K/7111K, paused 20ms, total 21ms
D/dalvikvm( 1500): GC_CONCURRENT freed 531K, 14% free 6138K/7111K, paused 17ms+3ms, total 80ms
D/dalvikvm( 1500): WAIT_FOR_CONCURRENT_GC blocked 63ms
I/Adreno200-EGL( 1500): <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_2.0.3_RB3.04.01.01.42.006_msm7627a_JB_REL_2.0.3_Merge_release_AU (Merge)
I/Adreno200-EGL( 1500): Build Date: 04/01/13 Mon
I/Adreno200-EGL( 1500): Local Branch:
I/Adreno200-EGL( 1500): Remote Branch: m/jb_rel_2.0.3
I/Adreno200-EGL( 1500): Local Patches: NONE
I/Adreno200-EGL( 1500): Reconstruct Branch: NOTHING
I/Choreographer( 1500): Skipped 31 frames! The application may be doing too much work on its main thread.
D/libtestAndroid4.so( 1500): (null):0 ((null)): -----------------------------P-8------------------------------------
D/libtestAndroid4.so( 1500): (null):0 ((null)): -----------------------------P-9------------------------------------
W/IInputConnectionWrapper( 1500): getCursorCapsMode on inactive InputConnection
D/libtestAndroid4.so( 1500): (null):0 ((null)): -----------------------------P-2------------------------------------
F/libc ( 1500): Fatal signal 11 (SIGSEGV) at 0x007a7a76 (code=1), thread 1567 (le.testAndroid4)
I/DEBUG ( 147): pid: 1500, tid: 1567, name: le.testAndroid4 >>> org.qtproject.example.testAndroid4 <<<


"org.qtproject.example.testAndroid4" died.

log1编译输出:

Android package built successfully in 29.282 ms.
-- It can now be run from the selected device/emulator.
-- File: C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/android-build//bin/QtApp-debug.apk
3064 KB/s (15889430 bytes in 5.064s)
11:15:26: The process "C:/Qt/5.5/android_armv7/bin/androiddeployqt.exe" exited normally.
11:15:26: Pulling files necessary for debugging.
11:15:26: Package deploy: Running command "C:/Users/niki/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s LGOTMS328ac0aa pull /system/bin/sh: readlink: not found C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/app_process".
11:15:26: Packaging error: Command "C:/Users/niki/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s LGOTMS328ac0aa pull /system/bin/sh: readlink: not found C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/app_process" failed.Exit code: 1
11:15:26: Package deploy: Running command "C:/Users/niki/AppData/Local/Android/android-sdk/platform-tools/adb.exe -s LGOTMS328ac0aa pull /system/lib/libc.so C:/Users/niki/Documents/build-testAndroid4-Android_for_armeabi_v7a_GCC_4_9_Qt_5_5_1-Release/libc.so".
11:15:26: Elapsed time: 00:53.

log2 应用程序输出:

 ...
I/Adreno200-EGL( 3188): Build Date: 04/01/13 Mon
I/Adreno200-EGL( 3188): Local Branch:
I/Adreno200-EGL( 3188): Remote Branch: m/jb_rel_2.0.3
I/Adreno200-EGL( 3188): Local Patches: NONE
I/Adreno200-EGL( 3188): Reconstruct Branch: NOTHING
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-8------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-9------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-2------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-3------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-4------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-5------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-10------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-1------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-11------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-12------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-2------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-3------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-4------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-5------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-13------------------------------------
D/libtestAndroid4.so( 3188): (null):0 ((null)): -----------------------------P-14------------------------------------
F/libc ( 3188): Fatal signal 11 (SIGSEGV) at 0xdeadcab1 (code=1), thread 3269 (le.testAndroid4)
I/DEBUG ( 147): pid: 3188, tid: 3269, name: le.testAndroid4 >>> org.qtproject.example.testAndroid4 <<<
I/ActivityManager( 457): Process org.qtproject.example.testAndroid4 (pid 3188) has died.


"org.qtproject.example.testAndroid4" died.

现在是源代码:

logindialog.h

#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H

#include <QDialog>
#include <QDebug>
namespace Ui {
class loginDialog;
}

class loginDialog : public QDialog
{
Q_OBJECT

public:
explicit loginDialog(QWidget *parent = 0);
~loginDialog();
bool isDecrypted();
std::string getPassword();

private slots:
void on_passwordButton_clicked();

private:
Ui::loginDialog *ui;
bool decrypted;
std::string password;
};

#endif // LOGINDIALOG_H

主窗口.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <fstream>
//#include <sha.h>
//#include <pwdbased.h>
//#include <osrng.h>
//#include <sstream>
//#include <iomanip>
//#include <cryptlib.h>
//using CryptoPP::Exception;

//#include <hex.h>
//using CryptoPP::HexEncoder;
//using CryptoPP::HexDecoder;

//#include <filters.h>
//using CryptoPP::StringSink;
#include "logindialog.h"
#include <QMessageBox>
#include <QDebug>
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private slots:
void on_pushButton_2_clicked();
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
bool getEnterPassword(std::string &);
};

#endif // MAINWINDOW_H

logindialog.cpp

#include "logindialog.h"
#include "ui_logindialog.h"

loginDialog::loginDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::loginDialog)
{
ui->setupUi(this);
}

loginDialog::~loginDialog()
{
delete ui;
}

void loginDialog::on_passwordButton_clicked()
{
qDebug() << "-----------------------------P-2------------------------------------";
this->password = ui->lineEdit->text().toStdString();
qDebug() << "-----------------------------P-3------------------------------------";
this->decrypted = true; //TODO decrypt the file and if there is exception set as false
qDebug() << "-----------------------------P-4------------------------------------";
this->accept();
qDebug() << "-----------------------------P-5------------------------------------";
}

bool loginDialog::isDecrypted()
{
return this->decrypted;
}

std::string loginDialog::getPassword()
{
return this->password;
}

主窗口.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_pushButton_clicked()
{
byte ivec[16];
byte salt[32];

CryptoPP::OS_GenerateRandomBlock(false, salt, sizeof(salt));
CryptoPP::OS_GenerateRandomBlock(false, ivec, sizeof(ivec));

std::string v;

CryptoPP::HexEncoder hex(new CryptoPP::StringSink(v));
hex.Put(salt, sizeof(salt));
hex.MessageEnd();

QMessageBox::about(this,tr("Test1"),tr(v.c_str()));
QMessageBox::about(this,tr("Test1"),tr("XXX"));
}

void MainWindow::on_pushButton_2_clicked()
{
std::string password;
if(getEnterPassword(password)==false)
{
QMessageBox::about(this,tr("Failed"),tr("Password does not match!"));
}
else
{
QMessageBox::about(this,tr("Failed"),tr("Password match!"));
}
}

bool MainWindow::getEnterPassword(std::string &password)
{
loginDialog passwordWindow;
qDebug() << "-----------------------------P-8------------------------------------";
passwordWindow.setModal(true);
qDebug() << "-----------------------------P-9------------------------------------";
passwordWindow.exec();
qDebug() << "-----------------------------P-10------------------------------------";

qDebug() << "-----------------------------P-1------------------------------------";
loginDialog passwordWindowRe;
qDebug() << "-----------------------------P-11------------------------------------";
passwordWindowRe.setModal(true);
qDebug() << "-----------------------------P-12------------------------------------";
passwordWindowRe.exec();
qDebug() << "-----------------------------P-13------------------------------------";

//qDebug() << passwordWindow.getPassword().c_str();
//qDebug() << passwordWindowRe.getPassword().c_str();

qDebug() << "-----------------------------P-14------------------------------------";
if(passwordWindow.getPassword() == passwordWindowRe.getPassword())
{
qDebug() << "-----------------------------P-15------------------------------------";
password = passwordWindow.getPassword();
qDebug() << "-----------------------------P-16------------------------------------";
return true;
qDebug() << "-----------------------------P-17------------------------------------";
}
else
{
qDebug() << "-----------------------------P-18------------------------------------";
return false;
}
}

最重要的是:testAndroid4.pro

#-------------------------------------------------
#
# Project created by QtCreator 2015-12-02T17:56:00
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = testAndroid4
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp \
logindialog.cpp

HEADERS += mainwindow.h \
logindialog.h

FORMS += mainwindow.ui \
logindialog.ui

CONFIG += mobility
MOBILITY =


INCLUDEPATH += C:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\include\

LIBS += -LC:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\armeabi-v7a\lib -lssl
LIBS += -LC:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\armeabi-v7a\lib -lcrypto


ANDROID_EXTRA_LIBS += C:\Users\niki\Downloads\android-ndk-r10e\sources\cxx-stl\stlport\libs\armeabi-v7a\libstlport_shared.so
ANDROID_EXTRA_LIBS += C:\Temp\cryptopp\cryptopp-5.6.2-android-14\cryptopp-android-14\lib1\libcryptopp.so

INCLUDEPATH += C:\Temp\cryptopp\cryptopp-5.6.2-android-14\cryptopp-android-14\include\cryptopp\

LIBS += -LC:\Users\niki\Downloads\android-ndk-r10e\sources\cxx-stl\stlport\libs\armeabi-v7a -lstlport_shared
LIBS += -LC:\Temp\cryptopp\cryptopp-5.6.2-android-14\cryptopp-android-14\lib1 -lcryptopp



DISTFILES += \
../../../../Temp/cryptopp/cryptopp-5.6.2-android-14/cryptopp-android-14/lib1/libcryptopp.so

当我启动程序并按下 pushButton2 时,会出现登录对话框。当我在其中输入内容并按下登录对话框的按钮时,程序就死了。如果我在 .pro 文件中评论 cryptopp 行,程序将正常运行。如果我将 lineEdit 留空并按下 logindialog 的 passwordButton,它会再次询问我有关密码的信息,我给出空白,但又死了 - 看到第二个日志出现(注意两个日志中的 P1、P2、P3...)。我从 this 中获取了 openssl链接和 criptopp 来自 this .我认为问题出在 cryptopp 的某个地方。如何增加 qt android 的堆栈和堆大小?我不认为这是问题所在,并且已经阅读了一些有关“堆栈跟踪调试”的内容,但不知道该怎么做。没关系,在这种情况下可能是什么问题?

修改后:

我已经在我的 android 4.1.2 设备 LG optimus L1 e410 上对其进行了测试。无论我是否使用 android 23/14/18/16 在 AVD 上测试它 -> 它都失败了。如果 cryptopp 被评论一切正常。 log2编译输出与第一个相同,只是时间不同。

第 2 版之后:

pushButton 使用 cryptopp 的应用程序日志:

I/Adreno200-EGL( 6066): Reconstruct Branch: NOTHING
W/IInputConnectionWrapper( 6066): showStatusIcon on inactive InputConnection
F/libc ( 6066): Fatal signal 11 (SIGSEGV) at 0x54ff002e (code=1), thread 6156 (le.testAndroid4)
I/DEBUG ( 147): pid: 6066, tid: 6156, name: le.testAndroid4 >>> org.qtproject.example.testAndroid4 <<<
I/ActivityManager( 457): Process org.qtproject.example.testAndroid4 (pid 6066) has died.


"org.qtproject.example.testAndroid4" died.

请参阅 mainwindow.cpp 中的 pushButton 和 mainwindow.h 中的注释内容(它们实际上没有注释)。

最佳答案

您正在手动加载 libSTLport_shared.so,我想这是因为 libcryptopp.so 需要它。

默认情况下,Qt 在编译和部署时使用 STL 库(在我的例子中为 libgnuSTL_shared.so,您可以在编译后在 android-build\libs\armeabi-v7a 文件夹中检查它)。如果您的加密库使用不同的库(显然是 libSTLport_shared.so),请像您一样从 .pro 文件手动加载它(ANDROID_EXTRA_LIBS += , LIB + =) 将使 libcryptopp.so 可加载,但是每当您传递 STL 对象 (std::string 例如)从您的代码到加密函数。

两个环境(您的代码和加密环境)没有使用相同的 STL 实现,因此它们无法安全地相互发送任何 STL 对象而不会出现严重的潜在段错误(因为当它实际上是用另一个创建的:对象很可能具有不同的属性....这就像在两种完全不同的类型之间强制转换)。

你可以这样验证:

void MainWindow::on_pushButton_clicked()
{
byte ivec[16];
byte salt[32];

qDebug() << "Calling OS_GenerateRandomBlock";
CryptoPP::OS_GenerateRandomBlock(false, salt, sizeof(salt));
qDebug() << "Calling OS_GenerateRandomBlock";
CryptoPP::OS_GenerateRandomBlock(false, ivec, sizeof(ivec));

std::string v;

qDebug() << "Passing std::string to CryptoPP::StringSink";
CryptoPP::StringSink* sink = new CryptoPP::StringSink(v);

qDebug() << "Creating HexEncoder";
CryptoPP::HexEncoder hex( sink );

hex.Put(salt, sizeof(salt));
hex.MessageEnd();

QMessageBox::about(this,tr("Test1"),tr(v.c_str()));
QMessageBox::about(this,tr("Test1"),tr("XXX"));
}

请确认,但我很确定您会看到“将 std::string 传递给 CryptoPP::StringSink”而不是“创建 HexEncoder”。

您应该重新编译 libcryptopp.so 以使其使用与您的主程序相同的 STL 实现(并且希望该库能够与该 STL 实现一起工作)。

关于c++ - Cryptopp 致命信号 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34048195/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com