在制作“xz-5.2.1”期间出错。与MinGW / MSYS [英] Error during making "xz-5.2.1" with MinGW/MSYS

查看:166
本文介绍了在制作“xz-5.2.1”期间出错。与MinGW / MSYS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在MinGW / MSYS环境下编译来编译Tesseract-OCR库。这只是其中一个步骤。

ADD 2



根据错误信息,我检查了 sysdefs.h 文件。它包含以下内容:

  #ifdef HAVE_CONFIG_H 
#include< config.h>
#endif

以上 make output包含 -DHAVE_CONFIG_H ,所以我认为应该包含系统头文件< config.h>





但奇怪的是,我搜索了 C:\ MinGW \include ,没有这样的文件。所以我 GUESS 这可能导致第57行的未定义的 UINT_MAX 警告。然后 UINT32_C未定义 code>第58行的错误。





但我不知道为什么系统头文件 config.h 缺失,

添加3



我对 GNU有点了解自动工具。而且幸运地我发现以下命令可以继续我的构建过程:(虽然我仍不确定它为什么可行,但我知道它可能与可移植性有关。

  autoheader(这会生成config.h.in文件)
./Configure(this从config.h.in文件生成config.h文件)

现在,我的构建过程被另一个问题阻止,如下所示:





看来这是一个已知的问题。另一个线程已经解决了这个问题。



< (我会继续更新我的进度。)

解决方案

如果您关心更简单的方法来处理这种依赖管理或工具链功能的一般性更新,我强烈建议使用MinGW-w64切换到MSYS2。



这两个项目都旨在(并成功)带来更好的原始版本。 MSYS2附带大量可轻松安装的第三方库。 MinGW-w64允许GCC提供完整的C ++ 11/14 / ...支持和扩展的Windows API可用性,以及一些有用的扩展和更新的标题。您会注意到,源自系统头文件的大多数问题都将通过MinGW-Packages脚本或上游(MinGW-w64或项目本身)解决。



具体来说,我建议采取以下步骤:



  1. 打开一个MSYS2命令提示符(或32位数据库)如果您打算构建32位或64位的东西),请从开始菜单条目中选择一个位或64位命令提示符。安装{32位,64位} MinGW-w64 GCC:

      pacman -S mingw-w64- {i686,x86_64 } -gcc 


  2. 安装tesseract-OCR:

      pacman -S mingw-w64- {i686,x86_64} -tesseract-ocr 

    以及可选的数据文件:

      pacman -S mingw-w64-tesseract-ocr- osd mingw-w64- {i686,x86_64} -tesseract-ocr-eng 


你完成了。当然,你仍然可以自己编译各种依赖关系,但为什么要麻烦?如果你真的想,你可以从MSYS2中安装的包的构建脚本开始,这些包位于这里:


< a href =https://github.com/Alexpux/MINGW-packages =nofollow> https://github.com/Alexpux/MINGW-packages


只需打开PKGBUILD文件,就可以看到所需的构建步骤。请注意,所有这些脚本都假定已经在MSYS2中安装了依赖关系。



另外请注意,安装的包和编译器完全独立于MSYS2,您可以预期:仅将它用作保持开发树最新的工具,并且可以从任何其他Windows环境构建。


I am trying to compile "xz-5.2.1" in MinGW/MSYS environment. I see the following errors:

#error UINT32_C is not defined and unsigned int is not 32-bit.

error: #error size_t is not 32-bit or 64-bit

I am not familiar with MinGW, could anyone shed some light on this? It looks like some macro definition are missing. Some header file missing?

ADD 1

The commands I used to compile the xz-5.2.1 are:

./configure
./make

The error screenshot:

Some background, I am following this link to compile the Tesseract-OCR library. And this is just one of the steps.

ADD 2

Based on the error message, I checked the sysdefs.h file. It contains the following content:

#ifdef HAVE_CONFIG_H
#   include <config.h>
#endif

The above make output contains the -DHAVE_CONFIG_H, so I think the system header file <config.h> should be included.

But strange enough, I searched the C:\MinGW\include, there's no such file. So I GUESS this may have caused the undefined UINT_MAX warning at line 57. And then the UINT32_C is not defined error at line 58.

But I don't know why the system header file config.h is missing and where to get it.

ADD 3

I dig a bit about the GNU autotools. And luckily enough I find that the following commands can carry on my build process: (Though I am still not very sure why it works. All I know is that it may be related to portability.)

autoheader  (this generates the config.h.in file)
./Configure  (this generates the config.h file from the config.h.in file)

And now, my build process is blocked by another issue as below:

It seems this is a known issue. And another thread has addressed it.

(I will continue update with my progress.)

解决方案

If you care for an easier way to handle this kind of dependency management or a general update on toolchain functionality, I strongly suggest switching to MSYS2 with MinGW-w64.

Both projects aim (and succeed) in bringing a better version of the original. MSYS2 comes with a large number of 3rd party libraries that you can easily install. MinGW-w64 allows for GCC with full C++11/14/... support and extended Windows API availability, along with some useful extensions and more up to date headers. You'll notice that most problems originating from system headers will have already been solved, either by the MinGW-Packages scripts below, or upstream (of either MinGW-w64 or the projects themselves).

For you specifically, I suggest the following steps:

  1. Install and update MSYS2.
  2. Open an MSYS2 command prompt (or the 32-bit or 64-bit command prompts if you plan on building 32-bit or 64-bit things) from the start menu entries. Install {32-bit,64-bit} MinGW-w64 GCC:

    pacman -S mingw-w64-{i686,x86_64}-gcc
    

  3. Install tesseract-OCR:

    pacman -S mingw-w64-{i686,x86_64}-tesseract-ocr
    

    and optionally the data files:

    pacman -S mingw-w64-tesseract-ocr-osd mingw-w64-{i686,x86_64}-tesseract-ocr-eng
    

And you're done. Of course, you can still compile the various dependencies yourself, but why bother? If you really want to, you can start from the build scripts for the packages you can install in MSYS2, which are located here:

https://github.com/Alexpux/MINGW-packages

Just open the PKGBUILD files and you can see the build steps required. Note that all these scripts assume the dependencies have been installed within MSYS2.

Also note that the installed packages and compilers are all independent of MSYS2 as you'd expect: you can use it only as a tool to keep your development tree up to date, and build from any other Windows environment.

这篇关于在制作“xz-5.2.1”期间出错。与MinGW / MSYS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆