c - 为什么我们需要解决 `make` 和 `make install` 之后的依赖关系?

标签 c installation makefile compilation pgmodeler

https://pgmodeler.io/support/installation说:

Resolving dependencies

After successfully compile the source code and install the binaries we need to copy some dependencies into the pgModeler's installation folder as well run some commands in order to make the binaries locate them properly.

GNU/Linux

1: cd $QT_ROOT/lib
2: cp libQt5DBus.so.5 libQt5PrintSupport.so.5 libQt5Widgets.so.5 libQt5Network.so.5 libQt5Gui.so.5 libQt5Core.so.5 libQt5XcbQpa.so.5 libQt5Svg.so.5 libicui18n.so.5* libicuuc.so.5* libicudata.so.5* $PGMODELER_ROOT/lib
3: cd $QT_ROOT/plugins
4: mkdir $PGMODELER_ROOT/lib/qtplugins
5: mkdir $PGMODELER_ROOT/lib/qtplugins/imageformats
6: mkdir $PGMODELER_ROOT/lib/qtplugins/printsupport
6: mkdir $PGMODELER_ROOT/lib/qtplugins/platforms
7: cp -r imageformats/libqgif.so imageformats/libqico.so imageformats/libqjpeg.so imageformats/libqsvg.so              imageformats/libqtga.so imageformats/libqtiff.so imageformats/libqwbmp.so $PGMODELER_ROOT/lib/qtplugins/imageformats
8: cp -r printsupport/libcupsprintersupport.so $PGMODELER_ROOT/lib/qtplugins/printsupport
9: cp -r platforms/libqxcb.so $PGMODELER_ROOT/lib/qtplugins/platforms
10: echo -e "[Paths]\nPrefix=.\nPlugins=lib/qtplugins\nLibraries=lib" > $PGMODELER_ROOT/qt.conf
11: cp $PGMODELER_SOURCE/start-pgmodeler.sh $PGMODELER_SOURCE/pgmodeler.vars $PGMODELER_ROOT
12: chmod +x $PGMODELER_ROOT/start-pgmodeler.sh

经过makemake install后,程序运行时是否可以动态解析依赖关系(动态链接)?这样做的目的是什么?

如果我运行 sudo checkinstall 来创建 deb 文件,我是否仍然需要像上面那样解决依赖关系?

谢谢!

最佳答案

看起来它是为了(可能)在另一台机器上部署/安装而创建一个安装包。

我记得当我编写 Qt 代码时(即打包所有依赖的库/插件),它已经自动化(在我自己的 makefile 中)。当 Qt 程序运行时,它通常会在同一目录中查找具有精确结构 lib/...lib/plugins/... 的目录,这样当您运行已编译的程序时可执行文件(比如在另一台机器上)带有 lib 子文件夹,它知道库在哪里。我现在不记得您是否仍然需要执行诸如将 LD_LIBRARY_PATH 设置为 ./lib 之类的操作 - 我想我记得添加了一个 lib 路径作为我的链接器命令的一部分。

您可以在一个旧的相关问题中看到我的回答:how-to-deploy-qt-application - 在这个答案中,我尝试使用 ldd 等工具自动化您在上面看到的这个过程。

关于c - 为什么我们需要解决 `make` 和 `make install` 之后的依赖关系?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54388792/

相关文章:

macos - 在 OS X 上为 Python 3 安装 PyAudio

c - 出现 C 错误,提示我对函数有 undefined reference ,但该函数已定义

c - 链接时间 "undefined reference to "错误

c - GTK+ 覆盖 gtk_radio_button 或 gtk_toggle_button 的默认处理程序

android - 如何让平板电脑上的系统安装程序接受未签名的应用程序

c - 为什么不在我的代码中添加#include<linux/sched.h>,代码无法识别 task_struct 结构

ruby - 安装 gem 时添加文件

Java Makefile 替代方案

c - Make 仅运行 'gcc',不带任何参数

c - 传递参数包括从命令行到 C 程序的换行符 (\n)