From cf91c6b13978a53b363e1180b6cfa9dea181136b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20J=C3=B6rgensen?= Date: Tue, 4 Nov 2025 16:39:28 +0100 Subject: [PATCH] Fix --- Linphone/CMakeLists.txt | 23 ++++------------------- Linphone/core/path/Paths.cpp | 8 ++++++++ Linphone/core/path/Paths.hpp | 1 + Linphone/main.cpp | 10 ++++++---- Linphone/tool/Constants.hpp | 3 +++ 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Linphone/CMakeLists.txt b/Linphone/CMakeLists.txt index 3f7900f21..280017c01 100644 --- a/Linphone/CMakeLists.txt +++ b/Linphone/CMakeLists.txt @@ -224,7 +224,8 @@ endforeach() # CRASHPAD ################################################################ -if (ENABLE_CRASH_HANDLER) +# In a first time, set-up only crashpad for Windows and Linux +if (ENABLE_CRASH_HANDLER AND NOT APPLE) # TODO : peut-ĂȘtre que windows find_package(Python3 REQUIRED) set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) @@ -264,24 +265,10 @@ if (ENABLE_CRASH_HANDLER) # Sync crashpad repo content with gclient ########################################## - # set(GCLIENT_SPEC "solutions = [{\\\"name\\\": \\\"crashpad\\\", \\\"url\\\": \\\"https://chromium.googlesource.com/crashpad/crashpad\\\", \\\"managed\\\": False}]") - - # execute_process( - # COMMAND "${CMAKE_BINARY_DIR}/depot_tools/gclient" config "--spec=${GCLIENT_SPEC}" - # ENVIRONMENT "PATH=${CMAKE_BINARY_DIR}/depot_tools:$ENV{PATH}" - # WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - # RESULT_VARIABLE gclient_config_result - # OUTPUT_VARIABLE gclient_config_output - # ERROR_VARIABLE gclient_config_error - # ) - # if(gclient_config_result) - # message(FATAL_ERROR "Failed configuring crashpad with gclient: ${gclient_config_result} ${gclient_config_output} ${gclient_config_error}") - # endif() # --- Write a .gclient file directly (avoid gclient config quoting issues) --- set(GCLIENT_CONTENT "solutions = [{\"name\": \"crashpad\", \"url\": \"https://chromium.googlesource.com/crashpad/crashpad\", \"managed\": False}]") - file(WRITE "${CMAKE_BINARY_DIR}/.gclient" "${GCLIENT_CONTENT}\n") - message(STATUS "Wrote ${CMAKE_BINARY_DIR}/.gclient with content:\n${GCLIENT_CONTENT}") + message(STATUS "Wrote ${CMAKE_BINARY_DIR}/.gclient file") execute_process( COMMAND "${DEPOT_TOOLS_DIR}/gclient" sync --nohooks --shallow @@ -331,7 +318,6 @@ if (ENABLE_CRASH_HANDLER) execute_process( # COMMAND ${CMAKE_BINARY_DIR}/gn/out/gn gen -C out COMMAND ${CMAKE_BINARY_DIR}/gn/out/gn gen out - # ENVIRONMENT "PATH=${CMAKE_BINARY_DIR}/depot_tools:$ENV{PATH}" RESULT_VARIABLE crashpad_gen_result OUTPUT_VARIABLE crashpad_gen_output ERROR_VARIABLE crashpad_gen_error @@ -345,8 +331,7 @@ if (ENABLE_CRASH_HANDLER) # Build crashpad client ########################################## execute_process( - COMMAND ninja -C out - # ENVIRONMENT "PATH=${CMAKE_BINARY_DIR}/depot_tools:$ENV{PATH}" + COMMAND ninja -C out # Target install ? RESULT_VARIABLE crashpad_build_result OUTPUT_VARIABLE crashpad_build_output ERROR_VARIABLE crashpad_build_error diff --git a/Linphone/core/path/Paths.cpp b/Linphone/core/path/Paths.cpp index 09b6ac7d3..f48279bfb 100644 --- a/Linphone/core/path/Paths.cpp +++ b/Linphone/core/path/Paths.cpp @@ -139,6 +139,10 @@ static inline QString getAppPackagePluginsDirPath() { return getAppPackageDir().absolutePath() + Constants::PathPlugins; } +static inline QString getAppBinDirPath() { + return getAppPackageDir().absolutePath() + Constants::PathBin; +} + static inline QString getAppAssistantConfigDirPath() { return getAppPackageDataDirPath() + Constants::PathAssistantConfig; } @@ -342,6 +346,10 @@ QString Paths::getZrtpSecretsFilePath() { Constants::PathZrtpSecrets); } +QString Paths::getCrashpadHandlerBinFilePath() { + return getAppBinDirPath() + Constants::PathCrashpadHandler; +} + // ----------------------------------------------------------------------------- void Paths::migrate() { diff --git a/Linphone/core/path/Paths.hpp b/Linphone/core/path/Paths.hpp index ba5e10c90..5640b7bd0 100644 --- a/Linphone/core/path/Paths.hpp +++ b/Linphone/core/path/Paths.hpp @@ -57,6 +57,7 @@ QString getToolsDirPath(); QString getUserCertificatesDirPath(); QString getZrtpDataFilePath(); QString getZrtpSecretsFilePath(); +QString getCrashpadHandlerBinFilePath(); void migrate(); } // namespace Paths diff --git a/Linphone/main.cpp b/Linphone/main.cpp index 84194d471..d4e12fa09 100644 --- a/Linphone/main.cpp +++ b/Linphone/main.cpp @@ -69,11 +69,12 @@ int main(int argc, char *argv[]) { lDebug() << "[Main] Creating application"; auto app = QSharedPointer::create(argc, argv); +#ifndef APPLE // In a first time, set-up only crashpad for Windows and Linux // Set up Crashpad std::vector arguments; - base::FilePath handler_path("/home/parallels/Projects/linphone-desktop/build/" // TODO change this - "crashpad/out/crashpad_handler"); + base::FilePath handler_path( + Utils::appStringToCoreString(Paths::getCrashpadHandlerBinFilePath())); // Aller le chercher dans bin base::FilePath database_path(Utils::appStringToCoreString(Paths::getLogsDirPath())); base::FilePath metrics_path(Utils::appStringToCoreString(Paths::getMetricsDirPath())); @@ -82,14 +83,15 @@ int main(int argc, char *argv[]) { annotations["version"] = (Utils::appStringToCoreString(app->getShortApplicationVersion())); crashpad::CrashpadClient crashpad_client; - if (!crashpad_client.StartHandler(handler_path, database_path, metrics_path, - "https://files.linphone.org:443/http-file-transfer-server/hft.php", annotations, + if (!crashpad_client.StartHandler(handler_path, database_path, metrics_path, Constants::DefaultUploadLogsServer, + annotations, // TODO use core->getLogCollectionUploadServerUrl arguments, true, true, {})) { lWarning() << "Failed to start Crashpad handler. Crashes will not be logged."; } else { lDebug() << "Started Crashpad handler"; } // End set up crashpad +#endif #ifdef ACCESSBILITY_WORKAROUND QAccessible::installUpdateHandler(DummyUpdateHandler); diff --git a/Linphone/tool/Constants.hpp b/Linphone/tool/Constants.hpp index f4bba198a..c7f4c4cee 100644 --- a/Linphone/tool/Constants.hpp +++ b/Linphone/tool/Constants.hpp @@ -153,9 +153,12 @@ public: static constexpr char PathPlugins[] = "/plugins/"; #endif static constexpr char PathPluginsApp[] = "app/"; + static constexpr char PathBin[] = "/bin/"; static constexpr char PathSounds[] = "/sounds/linphone"; static constexpr char PathUserCertificates[] = "/usr-crt/"; + static constexpr char PathCrashpadHandler[] = "crashpad_handler"; + static constexpr char PathCallHistoryList[] = "/call-history.db"; static constexpr char PathConfig[] = "/linphonerc"; static constexpr char PathDatabase[] = "/linphone.db";