AppVeyor c++cmake PNG包编译错误
AppVeyor c++ cmake PNG package compilation error
我正试图通过带有cmake的AppVeyor为windows编译一个跨平台的QT应用程序。
在Linux下,cmake编译得很好,所以CMakeLists.txt应该是有效的。
AppVeyor编译了一个必要的库,它也能工作。但当涉及到项目CMakeLists.txt时,它失败了,并出现以下错误:
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPNG.cmake:157 (find_package_handle_standard_args)
CMakeLists.txt:20 (find_package)
CMakeLists.txt中的相应部分是:
find_package(PNG REQUIRED)
[...some other cmake stuff...]
# link required other libraries
include_directories(${PNG_INCLUDE_DIR} ${GSL_INCLUDE_DIRS})
target_link_libraries(projectName ${PNG_LIBRARY} ${GSL_LIBRARIES})
这是当前生成失败:https://ci.appveyor.com/project/zebastian/mandelbulber2
使用过的CMakeLists.txt和appveyor.yml文件可以在项目根目录中找到:https://github.com/zebastian/mandelbulber2
由于FindPNG.cmake存在,似乎只缺少zlib,这似乎有点奇怪。我看到了一些appveyor.yml文件,它们通过下载和编译一些png/zlib源文件夹或使用外部依赖项来规避这个问题,但IMHO这对CI来说应该是一项简单的任务。
还是我错过了什么?
感谢任何帮助。。。
好的,我找到了这个特定问题的解决方案:
在windows中,有一个名为nuget的包管理器来解决这种依赖关系,它在appveyor中也能很好地工作。要安装libpng,我使用了以下命令:
#packages from nuget
- nuget install zlib-msvc14-x64-master -Version 1.2.8.4 -Source https://ci.appveyor.com/nuget/zlib-shallow-x0n34b3pfq1b
- ps: move zlib** deps -force
- move depszlibstatic.lib depszlib.lib
- nuget install libpng-msvc14-x64-master -Version 1.6.18.44 -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48
- ps: move libpng** deps -force
- move depslibpng16_static.lib depspng.lib
其中ps和move仅用于移动事物。对我来说,这似乎是一个合理的解决方案,可以让一些人免于繁琐的自我编译。
由于窗口占用并与4个字母的杂注以及其他msvc特定的行为发生冲突,编译仍然失败。但这是另一天的话题。。。
相关文章:
- std::is_base_of表示ctor编译错误
- Qt5:使用QCommandLineParser类时出现奇怪的编译错误
- 如何修复sfml c++代码编译错误
- 使用 MATLAB 编码器生成C++代码:编译错误"undefined reference to `rgb2gray_tbb_real64'"
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- vscode下的Arduino代码出现意外编译错误
- 第三方 API 中的编译错误 - Visual Studio
- std::cout输出int时出现编译错误
- 奇怪的代码抛出编译错误模板< J,int aSize=10> C2143:语法错误:在"<"之前缺少";"
- 提升图广度优先搜索前置编译错误
- C++ 中的编译错误:未定义对"主"的引用 collect2:错误:ld 返回 1 个退出状态
- 使用带有 ref 参数的成员函数创建线程时出现编译错误
- 我在C++中遇到了这个奇怪的编译错误
- 在C++中使用 Catch 测试框架编译错误"error: expected ';' at end of declaration list"
- 使用 std::enable_if 限制派生类的模板参数时出现编译错误
- 现代OpenGL和GLEW Libraray的编译错误
- C++ 编译错误:意外的类型名称"字符串":预期的表达式
- C ++程序编译错误,找不到/访问文件
- 使用直接大括号初始化时,C++ 编译错误"声明末尾的预期";"
- 为什么传递非静态成员函数会导致编译错误?