简体   繁体   English

无法使用 make 构建诺基亚 HEIF 库

[英]Can't build Nokia HEIF library with make

I'm trying to build the HEIF library in https://github.com/nokiatech/heif , but I'm having no luck.我正在尝试在https://github.com/nokiatech/heif中构建 HEIF 库,但我没有运气。

I have CMake and the latest version of MinGW installed.我安装了 CMake 和最新版本的 MinGW。 I'm following the steps to build the library but I'm getting an error.我正在按照构建库的步骤进行操作,但出现错误。

The first step, which is this:第一步,这是:

cd heif/build
cmake --help
cmake ../srcs -G"<Generator listed by above command for your target platform>"

works, but the second step, which is this:有效,但第二步是这样的:

cmake --build .

seems to be working but when it gets to 41% done I get this error:似乎在工作,但当它完成 41% 时,我收到此错误:

C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp: In constructor 'HEIF::FileStream::FileStream(const char*)':
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: error: 'fopen_s' was not declared in this scope
     fopen_s(&m_file, filename, "rb");
     ^~~~~~~
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: note: suggested alternative: 'fopen'
     fopen_s(&m_file, filename, "rb");
     ^~~~~~~
     fopen
reader\CMakeFiles\heif_static.dir\build.make:93: recipe for target 'reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj' failed
mingw32-make.exe[2]: *** [reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj] Error 1
mingw32-make.exe[2]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
CMakeFiles\Makefile2:233: recipe for target 'reader/CMakeFiles/heif_static.dir/all' failed
mingw32-make.exe[1]: *** [reader/CMakeFiles/heif_static.dir/all] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
Makefile:85: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2

I'm on Windows 10 in case that's relevant.如果相关的话,我在 Windows 10 上。 I have no idea why this is happening.我不知道为什么会这样。 Any help appreciated任何帮助表示赞赏

It seems that fopen_s is only present in the C library provided by Microsoft, ie in MSVC.似乎fopen_s只存在于 Microsoft 提供的 C 库中,即在 MSVC 中。 Source: Is there a way to use fopen_s() with GCC or at least create a #define about it?资料来源: 有没有办法在 GCC 中使用 fopen_s() 或至少创建一个关于它的#define?

Your best bet is then switching to MSVC, because the code you have was apparently never tested with MinGW, as it cannot be compiled by the latter.然后你最好的选择是切换到 MSVC,因为你拥有的代码显然从未用 MinGW 测试过,因为它不能被后者编译。

Alternatively, if you are feeling lucky, you can just use some #define tricks to convert fopen_s to the standard fopen (see the answers in the linked question) and hope that this is the only incompatibility in the code.或者,如果您感到幸运,您可以使用一些#define技巧将fopen_s转换为标准fopen (请参阅链接问题中的答案)并希望这是代码中唯一的不兼容之处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM