gpt4 book ai didi

linux - 为 linux 构建不带 PNG_READ_eXIf_SUPPORTED 的 libpng

转载 作者:太空宇宙 更新时间:2023-11-04 11:49:37 24 4
gpt4 key购买 nike

我需要构建 libpng,但在 pnglibconf.h 中没有#define PNG_READ_eXIf_SUPPORTED我已经阅读了来自 pnglibconf.dfa 的评论,这里有一些禁用功能的方法,但是我没有设法使用它们来实现我想要的。问题在于,构建过程是在构建服务器上执行的,所以我无法更改 libpng 子模块内的任何文件。以下是服务器的工作原理:

  1. git 下载克隆源
  2. 通过运行 cmake .. 生成 makefile
  3. 运行make命令。

因此我有 libnpg,但包含 PNG_READ_eXIf_SUPPORTED 选项。Libpng 是我项目的一个子模块,所以它由构建服务器自动 check out ,所以我不能手动更改 pnglibconf。正如它在 pnglibconf.dfa 文件中所说:

There are three ways of disabling features, in no particular order:

1) Create 'pngusr.h', enter the required private build information detailed below and #define PNG_NO_<option> for each option you don't want in that file in that file. You can also turn on options using PNG_<option>_SUPPORTED. When you have finished rerun configure and rebuild pnglibconf.h file with -DPNG_USER_CONFIG:

make clean
CPPFLAGS='-DPNG_USER_CONFIG' ./configure
make pnglibconf.h

pngusr.h is only used during the creation of pnglibconf.h, but it is safer to ensure that -DPNG_USER_CONFIG is specified throughout the build by changing the CPPFLAGS passed to the initial ./configure

我试着按照这里写的去做。我运行 cmake .. -DCMAKE_C_FLAGS="-DPNG_USER_CONFIG -I/home/me/dev/include" 其中 /home/me/dev/include - 是一条路径pngusr.h 文件

然后我运行 make 命令。但是,PNG_READ_eXIf_SUPPORTED 仍然存在于生成的文件中(通过 make 命令 pnglibconf.h 文件)。所以我的主要问题是如何在没有 PNG_READ_eXIf_SUPPORTED 选项的情况下制作 libpng?

最佳答案

我仍然不清楚您尝试使用的特定自定义机制是否以及在多大程度上适用于您尝试使用的 libpng 版本。但看起来有更简单的方法。在您发布的摘录下方,在同一文件中,是第二个(三个)备选方案:

2) Add definitions of the settings you want to change to CPPFLAGS; for example:

-DPNG_DEFAULT_READ_MACROS=0

(轻度格式化)。我不适合在基于 CMake 的构建系统上测试它,但它在 Autotools 构建系统中似乎很有魅力。通过检查和比较两者,我认为它也适用于 CMake。特别是,你会想要运行

cmake .. -DCMAKE_CPP_FLAGS="-DPNG_NO_READ_eXIf"

针对您的特定情况。

请注意,顺便说一句,CPP(即预处理器)标志是您指定的选项的正确位置(对于您最初尝试的 -DPNG_USR_CONFIG 也是如此)。但在实践中,它们可能仍然可以在 C 编译器标志中工作。

关于linux - 为 linux 构建不带 PNG_READ_eXIf_SUPPORTED 的 libpng,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56445068/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com