mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +08:00
fix: fixed macOS clang build, fixed macOS StackTrace
This commit is contained in:
parent
d484508c68
commit
bd79b38e60
@ -107,6 +107,7 @@ set(QV2RAY_TRANSLATION_PATH "unset" CACHE STRING "Qv2ray translations path")
|
||||
set(QV2RAY_DISABLE_AUTO_UPDATE OFF CACHE BOOL "Disable update checker")
|
||||
set(BUILD_TESTING OFF CACHE BOOL "Build test")
|
||||
set(EMBED_TRANSLATIONS OFF CACHE BOOL "Embed translations")
|
||||
set(QV2RAY_AUTO_DEPLOY ON CACHE BOOL "Automatically run deploy command after build")
|
||||
|
||||
if(QV2RAY_DEFAULT_VASSETS_PATH AND NOT QV2RAY_DEFAULT_VASSETS_PATH STREQUAL "unset")
|
||||
add_definitions(-DQV2RAY_DEFAULT_VASSETS_PATH="${QV2RAY_DEFAULT_VASSETS_PATH}")
|
||||
@ -326,14 +327,16 @@ if(APPLE)
|
||||
)
|
||||
|
||||
# Destination paths below are relative to ${CMAKE_INSTALL_PREFIX}
|
||||
|
||||
install(TARGETS qv2ray
|
||||
BUNDLE DESTINATION . COMPONENT Runtime
|
||||
RUNTIME DESTINATION bin COMPONENT Runtime
|
||||
)
|
||||
|
||||
add_custom_command(TARGET qv2ray POST_BUILD
|
||||
COMMAND macdeployqt ${CMAKE_BINARY_DIR}/qv2ray.app
|
||||
)
|
||||
if(QV2RAY_AUTO_DEPLOY)
|
||||
add_custom_command(TARGET qv2ray POST_BUILD
|
||||
COMMAND ${Qt5_DIR}/../../../bin/macdeployqt ${CMAKE_BINARY_DIR}/qv2ray.app
|
||||
)
|
||||
endif()
|
||||
set(APPS "\${CMAKE_INSTALL_PREFIX}/qv2ray.app")
|
||||
include(cmake/deployment.cmake)
|
||||
endif()
|
||||
@ -355,10 +358,11 @@ if(WIN32)
|
||||
if(NOT EMBED_TRANSLATIONS)
|
||||
install(FILES ${QM_FILES} DESTINATION lang)
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET qv2ray POST_BUILD
|
||||
COMMAND ${Qt5_DIR}/../../../bin/windeployqt ${CMAKE_BINARY_DIR}/qv2ray.exe --compiler-runtime --verbose 2 --dir ${CMAKE_BINARY_DIR}/winqt/
|
||||
)
|
||||
if(QV2RAY_AUTO_DEPLOY)
|
||||
add_custom_command(TARGET qv2ray POST_BUILD
|
||||
COMMAND ${Qt5_DIR}/../../../bin/windeployqt ${CMAKE_BINARY_DIR}/qv2ray.exe --compiler-runtime --verbose 2 --dir ${CMAKE_BINARY_DIR}/winqt/
|
||||
)
|
||||
endif()
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/winqt/ DESTINATION .)
|
||||
set(APPS "\${CMAKE_INSTALL_PREFIX}/qv2ray.exe")
|
||||
include(cmake/deployment.cmake)
|
||||
|
@ -1 +1 @@
|
||||
5681
|
||||
5682
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#ifdef Q_OS_LINUX
|
||||
#ifdef Q_OS_UNIX
|
||||
#include "backward.hpp"
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
@ -17,18 +17,16 @@ namespace Qv2ray
|
||||
public:
|
||||
static QString GetStackTrace()
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
return GetStackTraceImpl_Linux();
|
||||
#ifdef Q_OS_UNIX
|
||||
return GetStackTraceImpl_Unix();
|
||||
#elif defined(Q_OS_WIN)
|
||||
return GetStackTraceImpl_Windows();
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef Q_OS_LINUX
|
||||
static QString GetStackTraceImpl_Linux()
|
||||
#ifdef Q_OS_UNIX
|
||||
static QString GetStackTraceImpl_Unix()
|
||||
{
|
||||
using namespace backward;
|
||||
StackTrace st;
|
||||
@ -69,21 +67,23 @@ namespace Qv2ray
|
||||
DWORD displacement;
|
||||
IMAGEHLP_LINE64 *line = (IMAGEHLP_LINE64 *) malloc(sizeof(IMAGEHLP_LINE64));
|
||||
line->SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
//
|
||||
QString msg;
|
||||
//
|
||||
for (int i = 0; i < numberOfFrames; i++)
|
||||
{
|
||||
DWORD64 address = (DWORD64)(stack[i]);
|
||||
const auto address = (DWORD64) stack[i];
|
||||
SymFromAddr(process, address, NULL, symbol);
|
||||
if (SymGetLineFromAddr64(process, address, &displacement, line))
|
||||
{
|
||||
printf("\tat %s in %s: line: %lu: address: 0x%0X\n", symbol->Name, line->FileName, line->LineNumber, symbol->Address);
|
||||
msg += QString("[%1]: %2 (%3:%4)\r\n").arg(symbol->Address).arg(symbol->Name).arg(line->FileName).arg(line->LineNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\tSymGetLineFromAddr64 returned error code %lu.\n", GetLastError());
|
||||
printf("\tat %s, address 0x%0X.\n", symbol->Name, symbol->Address);
|
||||
msg += QString("[*]: %1 SymGetLineFromAddr64[%2]\r\n").arg(symbol->Address).arg(symbol->Name).arg(GetLastError());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return msg;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
@ -27,6 +27,18 @@ using namespace Qv2ray::base::objects;
|
||||
using namespace Qv2ray::base::objects::protocol;
|
||||
using namespace Qv2ray::base::objects::transfer;
|
||||
|
||||
class _qv2ray_global_config_impl_details
|
||||
{
|
||||
public:
|
||||
static Qv2rayConfigObject _GlobalConfig;
|
||||
static bool _isExiting;
|
||||
static QString _Qv2rayConfigPath;
|
||||
};
|
||||
|
||||
#define GlobalConfig (_qv2ray_global_config_impl_details::_GlobalConfig)
|
||||
#define isExiting (_qv2ray_global_config_impl_details::_isExiting)
|
||||
#define Qv2rayConfigPath (_qv2ray_global_config_impl_details::_Qv2rayConfigPath)
|
||||
|
||||
#define QV2RAY_BUILD_INFO QString(_QV2RAY_BUILD_INFO_STR_)
|
||||
#define QV2RAY_BUILD_EXTRA_INFO QString(_QV2RAY_BUILD_EXTRA_INFO_STR_)
|
||||
|
||||
@ -38,7 +50,7 @@ using namespace Qv2ray::base::objects::transfer;
|
||||
#endif
|
||||
|
||||
// Get Configured Config Dir Path
|
||||
#define QV2RAY_CONFIG_DIR (Qv2ray::Qv2rayConfigPath)
|
||||
#define QV2RAY_CONFIG_DIR (Qv2rayConfigPath)
|
||||
#define QV2RAY_CONFIG_FILE (QV2RAY_CONFIG_DIR + "Qv2ray.conf")
|
||||
//
|
||||
#define QV2RAY_ROUTING_DIR (QV2RAY_CONFIG_DIR + "rounting/")
|
||||
@ -109,25 +121,9 @@ using namespace Qv2ray::base::objects::transfer;
|
||||
#define API_TAG_INBOUND "_QV2RAY_API_INBOUND_"
|
||||
|
||||
#define QV2RAY_USE_FPROXY_KEY "_QV2RAY_USE_GLOBAL_FORWARD_PROXY_"
|
||||
//#define GlobalConfig (Qv2ray::GetGlobalConfig())
|
||||
|
||||
namespace Qv2ray
|
||||
{
|
||||
//namespace
|
||||
//{
|
||||
inline Qv2rayConfigObject GlobalConfig;
|
||||
//}
|
||||
// Qv2ray runtime config
|
||||
inline bool isExiting = false;
|
||||
inline QString Qv2rayConfigPath = "";
|
||||
//inline Qv2rayConfigObject &GetGlobalConfig()
|
||||
// {
|
||||
// if (!realGlobalConfig)
|
||||
// {
|
||||
// realGlobalConfig = std::make_unique<Qv2rayConfigObject>();
|
||||
// }
|
||||
// return *realGlobalConfig;
|
||||
// };
|
||||
inline QStringList Qv2rayAssetsPaths(const QString &dirName)
|
||||
{
|
||||
// Configuration Path
|
||||
|
@ -7,6 +7,11 @@
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
Qv2rayConfigObject _qv2ray_global_config_impl_details::_GlobalConfig;
|
||||
bool _qv2ray_global_config_impl_details::_isExiting;
|
||||
QString _qv2ray_global_config_impl_details::_Qv2rayConfigPath;
|
||||
|
||||
namespace Qv2ray::base
|
||||
{
|
||||
// Forwarded from QvTinyLog
|
||||
|
@ -338,22 +338,22 @@ namespace Qv2ray::components::proxy
|
||||
}
|
||||
#else
|
||||
|
||||
for (auto service : macOSgetNetworkServices())
|
||||
for (const auto &service : macOSgetNetworkServices())
|
||||
{
|
||||
LOG(MODULE_PROXY, "Setting proxy for interface: " + service)
|
||||
|
||||
if (hasHTTP)
|
||||
{
|
||||
QProcess::execute("/usr/sbin/networksetup -setwebproxystate " + service + " on");
|
||||
QProcess::execute("/usr/sbin/networksetup -setsecurewebproxystate " + service + " on");
|
||||
QProcess::execute("/usr/sbin/networksetup -setwebproxy " + service + " " + address + " " + QSTRN(httpPort));
|
||||
QProcess::execute("/usr/sbin/networksetup -setsecurewebproxy " + service + " " + address + " " + QSTRN(httpPort));
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setwebproxystate", service, "on" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsecurewebproxystate", service, "on" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setwebproxy", service, address, QSTRN(httpPort) });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsecurewebproxy", service, address, QSTRN(httpPort) });
|
||||
}
|
||||
|
||||
if (hasSOCKS)
|
||||
{
|
||||
QProcess::execute("/usr/sbin/networksetup -setsocksfirewallproxystate " + service + " on");
|
||||
QProcess::execute("/usr/sbin/networksetup -setsocksfirewallproxy " + service + " " + address + " " + QSTRN(socksPort));
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsocksfirewallproxystate", service, "on" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsocksfirewallproxy", service, address, QSTRN(socksPort) });
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,10 +436,10 @@ namespace Qv2ray::components::proxy
|
||||
for (const auto &service : macOSgetNetworkServices())
|
||||
{
|
||||
LOG(MODULE_PROXY, "Clearing proxy for interface: " + service)
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setautoproxystate " + service + " off" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setwebproxystate " + service + " off" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsecurewebproxystate " + service + " off" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsocksfirewallproxystate " + service + " off" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setautoproxystate", service, "off" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setwebproxystate", service, "off" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsecurewebproxystate", service, "off" });
|
||||
QProcess::execute("/usr/sbin/networksetup", { "-setsocksfirewallproxystate", service, "off" });
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -16,7 +16,8 @@ void signalHandler(int signum)
|
||||
if (signum == SIGSEGV)
|
||||
{
|
||||
const auto msg = StackTraceHelper::GetStackTrace();
|
||||
auto filePath = QV2RAY_CONFIG_DIR + "QvBugReport_" + QSTRN(system_clock::to_time_t(system_clock::now())) + ".stacktrace";
|
||||
QDir().mkpath(QV2RAY_CONFIG_DIR + "/bugreport/");
|
||||
auto filePath = QV2RAY_CONFIG_DIR + "/bugreport/QvBugReport_" + QSTRN(system_clock::to_time_t(system_clock::now())) + ".stacktrace";
|
||||
StringToFile(msg, filePath);
|
||||
LOG(MODULE_INIT, "Backtrace saved in: " + filePath)
|
||||
LOG(MODULE_INIT, msg)
|
||||
|
Loading…
Reference in New Issue
Block a user