From patchwork Tue Jun 11 15:20:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10987563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8027214C0 for ; Tue, 11 Jun 2019 15:21:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71182285B9 for ; Tue, 11 Jun 2019 15:21:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64FA52848B; Tue, 11 Jun 2019 15:21:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F26732848B for ; Tue, 11 Jun 2019 15:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387563AbfFKPVn (ORCPT ); Tue, 11 Jun 2019 11:21:43 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39465 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388810AbfFKPVn (ORCPT ); Tue, 11 Jun 2019 11:21:43 -0400 Received: by mail-wr1-f67.google.com with SMTP id x4so10862282wrt.6 for ; Tue, 11 Jun 2019 08:21:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DIPgdMCtTzFDIWlUdQ/kWuxZpe+pTbkrld+tpnDfqfA=; b=nRf4jQX+dgHrGCLZhHNH89cGspbu+riQRzVa0CjBkgwhACVUG97A92uTmgNbnhrMz4 ST3b9ngIloymfS+4x8SE/Us4QK5XB3HyJjaFY/IpC0YEvbk0NB66ChsdNxXuakOVwH0y JuAsd6HUc493uKSvXjJecBmcHLcSpDQJ4GThWytY4aweqb8HqQSv67ugVE/TF0DBnk7l 3UI9rAHZHX7aRL4df9BQ06EQDdUzCS2BDPQgseYkVXGUSgveFBa3dD+CS5SsIFboCc5O uczKwFpRGYVH2sOFARFU9G32UnmMHs0sUKbIu37QF1MbLNlDv0hyeorjsQ8jG0jm5fym vpwA== X-Gm-Message-State: APjAAAUOpMDx4uS3yWnGJ12bSPIIIAjDfdYb2G69V9+UNhf0N0dWMQfT tsotv83zxm8Jayebay3iUC0= X-Google-Smtp-Source: APXvYqynpXE5bwDQfYChMGKyV8Ps5FcYuw8mXXDSnpWlYtC3NIdOWy7aZAKrYdjv9jErK/lLNN6zsA== X-Received: by 2002:adf:f5c5:: with SMTP id k5mr10264938wrp.280.1560266501803; Tue, 11 Jun 2019 08:21:41 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id r2sm2793821wma.26.2019.06.11.08.21.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 11 Jun 2019 08:21:41 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, troyengel@gmail.com, Yordan Karadzhov Subject: [PATCH 1/2] kernel-shark: Avoid TRACECMD_BIN_DIR being set to the build path Date: Tue, 11 Jun 2019 18:20:42 +0300 Message-Id: <20190611152043.22572-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611152043.22572-1-ykaradzhov@vmware.com> References: <20190611152043.22572-1-ykaradzhov@vmware.com> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The full path to the build directory (which is random for every user) is embedded in the final binary. This is a no-no for some Linux distros which are requiring that the finished binaries should not have such paths embedded in them. Reported-by: Troy Engel Signed-off-by: Yordan Karadzhov --- kernel-shark/build/FindTraceCmd.cmake | 14 +++++++++----- kernel-shark/build/deff.h.cmake | 2 +- kernel-shark/src/KsCaptureDialog.cpp | 13 ++++++++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/kernel-shark/build/FindTraceCmd.cmake b/kernel-shark/build/FindTraceCmd.cmake index 8c51f11..3d11347 100644 --- a/kernel-shark/build/FindTraceCmd.cmake +++ b/kernel-shark/build/FindTraceCmd.cmake @@ -12,10 +12,14 @@ # MESSAGE(" Looking for trace-cmd ...") # First search in the user provided paths. -find_path(TRACECMD_BIN_DIR NAMES trace-cmd - PATHS $ENV{TRACE_CMD}/tracecmd/ - ${CMAKE_SOURCE_DIR}/../tracecmd/ - NO_DEFAULT_PATH) +if (NOT CMAKE_BUILD_TYPE MATCHES Release) + + find_program(TRACECMD_EXECUTABLE NAMES trace-cmd + PATHS $ENV{TRACE_CMD}/tracecmd/ + ${CMAKE_SOURCE_DIR}/../tracecmd/ + NO_DEFAULT_PATH) + +endif (NOT CMAKE_BUILD_TYPE MATCHES Release) find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h PATHS $ENV{TRACE_CMD}/include/ @@ -34,7 +38,7 @@ find_library(TRACEEVENT_LIBRARY NAMES traceevent/libtraceevent.a # If not found, search in the default system paths. Note that if the previous # search was successful "find_path" will do nothing this time. -find_path(TRACECMD_BIN_DIR NAMES trace-cmd) +find_program(TRACECMD_EXECUTABLE NAMES trace-cmd) find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h) find_library(TRACECMD_LIBRARY NAMES trace-cmd/libtracecmd.so) find_library(TRACEEVENT_LIBRARY NAMES traceevent/libtraceevent.so) diff --git a/kernel-shark/build/deff.h.cmake b/kernel-shark/build/deff.h.cmake index efee2a1..79726ff 100644 --- a/kernel-shark/build/deff.h.cmake +++ b/kernel-shark/build/deff.h.cmake @@ -18,7 +18,7 @@ #cmakedefine KS_PLUGIN_INSTALL_PREFIX "@KS_PLUGIN_INSTALL_PREFIX@" /** Location of the trace-cmd executable. */ -#cmakedefine TRACECMD_BIN_DIR "@TRACECMD_BIN_DIR@" +#cmakedefine TRACECMD_EXECUTABLE "@TRACECMD_EXECUTABLE@" /** "pkexec" executable. */ #cmakedefine DO_AS_ROOT "@DO_AS_ROOT@" diff --git a/kernel-shark/src/KsCaptureDialog.cpp b/kernel-shark/src/KsCaptureDialog.cpp index b107595..96ab3e2 100644 --- a/kernel-shark/src/KsCaptureDialog.cpp +++ b/kernel-shark/src/KsCaptureDialog.cpp @@ -489,12 +489,15 @@ KsCaptureDialog::KsCaptureDialog(QWidget *parent) connect(&_captureCtrl._closeButton, &QPushButton::pressed, this, &KsCaptureDialog::close); - if (KsUtils::isInstalled()) - captureExe = QString(_INSTALL_PREFIX) + QString("/bin"); - else - captureExe = TRACECMD_BIN_DIR; + captureExe = QString(_INSTALL_PREFIX) + QString("/bin/trace-cmd"); + +#ifdef TRACECMD_EXECUTABLE + + if (!KsUtils::isInstalled()) + captureExe = TRACECMD_EXECUTABLE; + +#endif - captureExe += "/trace-cmd"; _captureProc.setProgram(captureExe); _captureMon.connectMe(&_captureProc, &_captureCtrl); From patchwork Tue Jun 11 15:20:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10987565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5E451708 for ; Tue, 11 Jun 2019 15:21:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9746528600 for ; Tue, 11 Jun 2019 15:21:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A85328607; Tue, 11 Jun 2019 15:21:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2561C28628 for ; Tue, 11 Jun 2019 15:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404185AbfFKPVq (ORCPT ); Tue, 11 Jun 2019 11:21:46 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:52717 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388810AbfFKPVp (ORCPT ); Tue, 11 Jun 2019 11:21:45 -0400 Received: by mail-wm1-f65.google.com with SMTP id s3so3420586wms.2 for ; Tue, 11 Jun 2019 08:21:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8cYpwkxDhXV+UrEIBkKOBklOceWNxHM5PgZ0wLRmIfQ=; b=HbD3P8H/jnrr4Z0w9SLo52sh/VBxvzYBFi2YzeyPHXWMVJPVMroXMF5kKURpjPkJjE xi5Q79ZAdgHhS9RGOo9s142llFGyfYIt7rPbJhQvKGi7UzxUjcZNlCkOdnnrKaiJqh21 PEO8zsrmVan26xjsgnZsvniJ0CRS1EzNzQTwIaNvP/9HMbqFnI5jgSBxW1+ZV64xB5Iu Ywh4GB0uszCpARj/STJ5Y2xvi3EmOUOmknAHw5pPuEiVbnEUoHNUfjLfWyy5rcKJ35UE wKcMp93WUa+ffxqNTHJD4ihbkM8igjXnFEhC+eVpIORotP3a2bugZNgczhc+eJzRwZ7X E07A== X-Gm-Message-State: APjAAAU/ZNN3iRlD4Mz+INEifXlmQzZCXTOhwGSF01Qkk2+uNp6Lck3w IZV8PsquTmAE+O1v6qIUoJE= X-Google-Smtp-Source: APXvYqw/x/buiox4E/3LeTvI0b7J0IA7JEs3uBhyD3KamH0B+ZH5vr3oscSRh71BicyhRy0ZIAJIzQ== X-Received: by 2002:a1c:1b81:: with SMTP id b123mr17679206wmb.144.1560266503472; Tue, 11 Jun 2019 08:21:43 -0700 (PDT) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id r2sm2793821wma.26.2019.06.11.08.21.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 11 Jun 2019 08:21:43 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, troyengel@gmail.com, Yordan Karadzhov Subject: [PATCH 2/2] kernel-shark: Avoid debug build when CMAKE_BUILD_TYPE=Release Date: Tue, 11 Jun 2019 18:20:43 +0300 Message-Id: <20190611152043.22572-3-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611152043.22572-1-ykaradzhov@vmware.com> References: <20190611152043.22572-1-ykaradzhov@vmware.com> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The debug flags by design embed the build paths, but the distro package binaries should not have such paths embedded in them. Reported-by: Troy Engel Signed-off-by: Yordan Karadzhov --- kernel-shark/CMakeLists.txt | 25 ++++++++++++++++--------- kernel-shark/README | 4 ++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt index d45be20..fe398bb 100644 --- a/kernel-shark/CMakeLists.txt +++ b/kernel-shark/CMakeLists.txt @@ -33,8 +33,22 @@ endif (Qt5Widgets_FOUND) set(LIBRARY_OUTPUT_PATH "${KS_DIR}/lib") set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -pthread -fPIC") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -std=c++11 -pthread -fPIC") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pthread -fPIC") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC") + +if (NOT CMAKE_BUILD_TYPE MATCHES Release) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + +endif (NOT CMAKE_BUILD_TYPE MATCHES Release) + +if (NOT CMAKE_BUILD_TYPE MATCHES Debug) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") + +endif (NOT CMAKE_BUILD_TYPE MATCHES Debug) if(NOT _INSTALL_PREFIX) set(_INSTALL_PREFIX "/usr/local") @@ -47,13 +61,6 @@ set(KS_ICON_FIN KS_icon_fin.svg) set(KS_LOGO KS_logo_symbol.svg) set(KS_LOGO_LABEL KS_logo_horizontal.svg) -if (NOT _DEBUG) - - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") - -endif (NOT _DEBUG) - SET(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/") SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) diff --git a/kernel-shark/README b/kernel-shark/README index 379c390..2027044 100644 --- a/kernel-shark/README +++ b/kernel-shark/README @@ -39,13 +39,13 @@ the original trace-cmd end traceevent libraries. as a CMake Command-Line option. 2.1.2 In order to generates complete debug information to be used by GDB add --D_DEBUG=1 as a CMake Command-Line option. +-DCMAKE_BUILD_TYPE=Debug as a CMake Command-Line option. 2.1.3 By default, installation prefix is "/usr/local". It can be changed using -D_INSTALL_PREFIX= as a CMake Command-Line option. Example: - cmake -D_DOXYGEN_DOC=1 -D_DEBUG=1 -D_INSTALL_PREFIX=/usr ../ + cmake -D_DOXYGEN_DOC=1 -DCMAKE_BUILD_TYPE=Debug -D_INSTALL_PREFIX=/usr ../ 2.2.1 Use "make clean" if you want to delete all already compiled objects.