Skip to content

Conversation

@deepin-mozart
Copy link
Contributor

@deepin-mozart deepin-mozart commented Nov 6, 2025

Log:
Change-Id: I715be11bc12142168fb36e03bb73cc1785321377

Summary by Sourcery

Fix runtime path configuration and streamline plugin load logging

Enhancements:

  • Remove manual addition of library paths and simplify log messages in main.cpp

Build:

  • Set CMAKE_INSTALL_RPATH to include library and plugin install prefixes in CMakeLists.txt
  • Add CMake status message to display the configured CMAKE_INSTALL_RPATH

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepin-mozart

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 6, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR refactors runtime library path handling by removing explicit path additions in the application code and reinstates RPATH configuration in the build system, including logging of the install RPATH.

Class diagram for changes in main.cpp plugin and library path handling

classDiagram
    class LifeCycle {
        +setPluginPaths(paths)
        +pluginPaths()
    }
    class CustomPaths {
        +global(type)
    }
    class QApplication {
        +libraryPaths()
    }
    class QCoreApplication {
        +addLibraryPath(path)
    }
    class App {
    }
    App --> LifeCycle : uses
    App --> CustomPaths : uses
    App --> QApplication : uses
    App --> QCoreApplication : uses
Loading

File-Level Changes

Change Details Files
Consolidate library path handling and logging in main.cpp
  • Removed depend libs lookup and QCoreApplication::addLibraryPath calls
  • Eliminated explicit plugin path addition
  • Updated log message to display current library paths under “Depend library paths:”
src/app/main.cpp
Restore and expose install RPATH configuration in CMake
  • Set CMAKE_INSTALL_RPATH to include library and plugin install prefixes
  • Added STATUS message to print CMAKE_INSTALL_RPATH at configure time
  • Inserted comment to mark install runtime path section
CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `src/app/main.cpp:39` </location>
<code_context>
-    QCoreApplication::addLibraryPath(pluginsPath);
-
-    qInfo() << "Current library paths:" << QApplication::libraryPaths();
+    qInfo() << "Depend library paths:" << QApplication::libraryPaths();
     qInfo() << "Load plugin paths: " << dpf::LifeCycle::pluginPaths();

</code_context>

<issue_to_address>
**suggestion:** The log message label may be misleading after removing library path additions.

Update the log label to match the actual library paths being shown, as the code no longer adds dependlibs or pluginsPath.

```suggestion
    qInfo() << "Current Qt library paths:" << QApplication::libraryPaths();
```
</issue_to_address>

### Comment 2
<location> `CMakeLists.txt:50` </location>
<code_context>
+set(CMAKE_INSTALL_RPATH ${LIBRARY_INSTALL_PREFIX} ${PLUGIN_PATH})

 message(STATUS "LIBRARY_INSTALL_PREFIX ${LIBRARY_INSTALL_PREFIX}")
 message(STATUS "RUNTIME_INSTALL_RPEFIX ${RUNTIME_INSTALL_RPEFIX}")
</code_context>

<issue_to_address>
**issue (typo):** Repeated typo: 'RPEFIX' should likely be 'PREFIX' in variable names.

Please update 'RUNTIME_INSTALL_RPEFIX', 'SOURCES_INSTALL_RPEFIX', and 'INCLUDE_INSTALL_RPEFIX' to use 'PREFIX' instead of 'RPEFIX'.

Suggested implementation:

```
message(STATUS "RUNTIME_INSTALL_PREFIX ${RUNTIME_INSTALL_PREFIX}")
message(STATUS "INCLUDE_INSTALL_PREFIX ${INCLUDE_INSTALL_PREFIX}")

```

If the variables `RUNTIME_INSTALL_RPEFIX` and `INCLUDE_INSTALL_RPEFIX` are defined elsewhere in the file or project, you should also rename those definitions to use `PREFIX` instead of `RPEFIX`. Similarly, check for `SOURCES_INSTALL_RPEFIX` and update it to `SOURCES_INSTALL_PREFIX` wherever it appears.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

QCoreApplication::addLibraryPath(pluginsPath);

qInfo() << "Current library paths:" << QApplication::libraryPaths();
qInfo() << "Depend library paths:" << QApplication::libraryPaths();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The log message label may be misleading after removing library path additions.

Update the log label to match the actual library paths being shown, as the code no longer adds dependlibs or pluginsPath.

Suggested change
qInfo() << "Depend library paths:" << QApplication::libraryPaths();
qInfo() << "Current Qt library paths:" << QApplication::libraryPaths();

message(STATUS "LIBRARY_INSTALL_PREFIX ${LIBRARY_INSTALL_PREFIX}")
message(STATUS "RUNTIME_INSTALL_RPEFIX ${RUNTIME_INSTALL_RPEFIX}")
message(STATUS "SOURCES_INSTALL_RPEFIX ${SOURCES_INSTALL_RPEFIX}")
message(STATUS "INCLUDE_INSTALL_RPEFIX ${INCLUDE_INSTALL_RPEFIX}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Repeated typo: 'RPEFIX' should likely be 'PREFIX' in variable names.

Please update 'RUNTIME_INSTALL_RPEFIX', 'SOURCES_INSTALL_RPEFIX', and 'INCLUDE_INSTALL_RPEFIX' to use 'PREFIX' instead of 'RPEFIX'.

Suggested implementation:

message(STATUS "RUNTIME_INSTALL_PREFIX ${RUNTIME_INSTALL_PREFIX}")
message(STATUS "INCLUDE_INSTALL_PREFIX ${INCLUDE_INSTALL_PREFIX}")

If the variables RUNTIME_INSTALL_RPEFIX and INCLUDE_INSTALL_RPEFIX are defined elsewhere in the file or project, you should also rename those definitions to use PREFIX instead of RPEFIX. Similarly, check for SOURCES_INSTALL_RPEFIX and update it to SOURCES_INSTALL_PREFIX wherever it appears.

Log:
Change-Id: I715be11bc12142168fb36e03bb73cc1785321377
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这段代码变更进行审查:

  1. CMakeLists.txt 变更分析:
+ set(CMAKE_INSTALL_RPATH ${LIBRARY_INSTALL_PREFIX} ${PLUGIN_PATH})

优点:

  • 添加了运行时搜索路径设置,有助于解决动态库依赖问题

问题:

  • 使用了未定义的变量 ${PLUGIN_PATH},这会导致构建错误
  • 建议改为使用已定义的 ${PLUGIN_INSTALL_PATH}

建议修改为:

set(CMAKE_INSTALL_RPATH ${LIBRARY_INSTALL_PREFIX} ${PLUGIN_INSTALL_PATH})
  1. main.cpp 变更分析:
- QString dependlibs = CustomPaths::global(CustomPaths::DependLibs);
- QCoreApplication::addLibraryPath(dependlibs);
- QCoreApplication::addLibraryPath(pluginsPath);
- qInfo() << "Current library paths:" << QApplication::libraryPaths();
+ qInfo() << "Depend library paths:" << QApplication::libraryPaths();

问题:

  • 移除了添加库路径的代码,这可能导致运行时找不到依赖库
  • 日志信息不够详细,不利于问题排查

建议:

  1. 保留添加库路径的代码,因为这对运行时加载依赖很重要

  2. 如果确实要修改,应该确保在 CMakeLists.txt 中正确设置了 RPATH

  3. maindialog.h 变更分析:

- private slots:
-    void closeMainWindow();  // 声明用于关闭主窗口的槽函数

问题:

  • 删除了槽函数声明,但没有看到对应的实现删除
  • 如果这个槽函数仍在使用,会导致编译错误
  • 如果确实不再需要,应该确保删除对应的实现代码

总体建议:

  1. CMakeLists.txt 中的变量引用错误需要修正
  2. main.cpp 中的库路径设置不应该完全移除,或者确保 RPATH 设置正确
  3. maindialog.h 的变更需要确保没有遗留未使用的代码

安全性和性能:

  • CMakeLists.txt 的 RPATH 设置有助于提高动态库加载性能
  • main.cpp 的变更可能会影响程序启动时的库加载性能
  • 整体来看,这些变更不会引入明显的安全问题

建议在提交前:

  1. 修复 CMakeLists.txt 中的变量引用
  2. 重新评估 main.cpp 中库路径设置的必要性
  3. 确保 maindialog.h 的变更是完整的

@deepin-mozart
Copy link
Contributor Author

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Nov 6, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 550b816 into linuxdeepin:master Nov 6, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants