为什么mingw32和tdm-gcc64使用外部gcc的行为不同 [英] why mingw32 and tdm-gcc64 behave differently using external gcc

查看:223
本文介绍了为什么mingw32和tdm-gcc64使用外部gcc的行为不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图 cabal install wxHaskell的一个组件(Haskell平台2013.2针对wxWidgets 3.0)。
我能够用mingw.org的32位mingw编译git版本。但最终,安装的wx无法正确运行,并且运行最小的示例会在wxc.dll中给出运行时异常。因此,我尝试在TDM-GCC 4.8.1 64位下编译相同的东西,因为wxWidgets人们以TDM-GCC编译的二进制文件的形式提供了它们的二进制文件。

但是,bb是b

但是我立即遇到了TDM-GCC的编译错误,告诉我:

错误:'strnlen'未在此范围内声明



令我惊讶的是,即使mingw32和TDM-gcc使用来自Haskell Platform的相同外部gcc c:\ HaskellPlatform \2013.2.0.0\mingw\bin\gcc .exe ,其他人编译时会出错。



导致问题的第一个文件是 src \\ \\cpp\eljaccelerator.cpp 。它在mingw32下编译OK:

  ... 
c:\HaskellPlatform\2013.2.0.0\mingw\\ \\ bin\gcc.exe -Wl, - hash-size = 31 -Wl, - reduce-
内存开销-Isrc / include -IC:/MinGW/msys/1.0/local/include/wx -3.0 -IC:/ Min
GEFILE_SOURCE =未知-DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src / msys / 1.0 / local / lib / wx / include / \cpp\eljaccelerato
r.cpp -o dist\build\src / cpp / eljaccelerator.o

,但在TDM-gcc下给出错误:

 构建wxc 
c:\ HaskellPlatform \2013.2.0.0\mingw\bin\gcc.exe -Wl, - hash-size = 31 -Wl, - reduce-
内存开销-Isrc / include -IC:/ mingw / msys / 1.0 / local / include / wx-3.0 -IC:/ min
gw / msys / 1.0 / local / lib / wx / include / msw-unicode-3.0 -D__WXMSW__ -DWXUSINGDLL -D_FIL
E_OFFSET_BITS = 64 -DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src\cpp\eljaccelerator.cpp
-o dist \build \src / cpp / eljaccelerator.o
在C:/mingw/msys/1.0/local/include/wx-3.0/wx/crt.h:19:0包含的文件中,
来自C:/mingw/msys/1.0/local/include/wx-3.0/wx/string.h:4305,来自C的
:/mingw/msys/1.0/local/include/wx-3.0/wx /memory.h:15,C:/mingw/msys/1.0/local/include/wx-3.0/wx/object.h中的
:19,C:/mingw/msys/1.0中的
/local/include/wx-3.0/wx/wx.h:15,来自src / include / wrapper.h的
:20,来自src\cpp\eljaccelerator.cpp的
:1:
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h:函数'size_t wxStrnlen
(const char *,size_t)':
C: /mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h:173:92:错误:'strnlen'是在此范围内声明的

C:/ mingw / msys / 1.0 / local / include / wx-3.0 / wx / wxcrt.h:函数'size_t wxStrnlen
(const wchar_t *,size_t)':
C:/mingw/msys/1.0/local /include/wx-3.0/wx/wxcrt.h:187:95:error: 'wcsnlen'在此范围内声明为

未能安装wxc-0.90.1.1

我想知道是否有人有类似的经历。任何想法出了什么问题,以及如何修复TDM-GCC的编译?我尝试添加 #include wxcrt.h ,但它不会改变任何内容。



仅供参考,我已经分别从mingw和tdm-gcc版本的源代码编译了wxWidgets 3.0.0,使用

  ./ configure --enable-stl&&制作&& make install 

如果需要,我可以提供更多详细信息。

所有的工作,他们肯定是不同的编译器,所以你是什么意思,他们都使用相同的gcc二进制文件?它必须是一个MinGW或一个TDM,但它不能同时存在。

配置检测到不同的标志用于大文件的支持。看看 config.log ,一定有什么问题,并且在初始阶段肯定会有一些错误。


I am trying to cabal install a component of wxHaskell (Haskell platform 2013.2 against wxWidgets 3.0). I was able to compile the git version with 32 bit mingw from mingw.org. But in the end, the installed wx cannot function correct, and running a minimal example gives runtime exceptions in wxc.dll. So I try to compile the same thing under TDM-GCC 4.8.1 64bit, since the wxWidgets people provide their binary in the form of TDM-GCC compiled binaries.

But I immediately run into compilation errors with TDM-GCC, telling me

error: 'strnlen' was not declared in this scope

What surprises me is that even though both mingw32 and TDM-gcc uses the same external gcc from Haskell Platform c:\HaskellPlatform\2013.2.0.0\mingw\bin\gcc.exe, one would give an error while the other compiles fine.

The first file causing problem is src\cpp\eljaccelerator.cpp. It compiles OK under mingw32:

...
c:\HaskellPlatform\2013.2.0.0\mingw\bin\gcc.exe -Wl,--hash-size=31 -Wl,--reduce-
memory-overheads -Isrc/include -IC:/MinGW/msys/1.0/local/include/wx-3.0 -IC:/Min
GW/msys/1.0/local/lib/wx/include/msw-unicode-3.0 -D__WXMSW__ -DWXUSINGDLL -D_LAR
GEFILE_SOURCE=unknown -DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src\cpp\eljaccelerato
r.cpp -o dist\build\src/cpp/eljaccelerator.o

but gives an error under TDM-gcc:

Building wxc
c:\HaskellPlatform\2013.2.0.0\mingw\bin\gcc.exe -Wl,--hash-size=31 -Wl,--reduce-
memory-overheads -Isrc/include -IC:/mingw/msys/1.0/local/include/wx-3.0 -IC:/min
gw/msys/1.0/local/lib/wx/include/msw-unicode-3.0 -D__WXMSW__ -DWXUSINGDLL -D_FIL
E_OFFSET_BITS=64 -DwxcREFUSE_MEDIACTRL -DBUILD_DLL -c src\cpp\eljaccelerator.cpp
 -o dist\build\src/cpp/eljaccelerator.o
In file included from C:/mingw/msys/1.0/local/include/wx-3.0/wx/crt.h:19:0,
                 from C:/mingw/msys/1.0/local/include/wx-3.0/wx/string.h:4305,
                 from C:/mingw/msys/1.0/local/include/wx-3.0/wx/memory.h:15,
                 from C:/mingw/msys/1.0/local/include/wx-3.0/wx/object.h:19,
                 from C:/mingw/msys/1.0/local/include/wx-3.0/wx/wx.h:15,
                 from src/include/wrapper.h:20,
                 from src\cpp\eljaccelerator.cpp:1:
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h: In function 'size_t wxStrnlen
(const char*, size_t)':
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h:173:92: error: 'strnlen' was n
ot declared in this scope
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h: In function 'size_t wxStrnlen
(const wchar_t*, size_t)':
C:/mingw/msys/1.0/local/include/wx-3.0/wx/wxcrt.h:187:95: error: 'wcsnlen' was n
ot declared in this scope
Failed to install wxc-0.90.1.1

I was wondering if anyone has any similar experience. Any idea what went wrong and how to fix compilation for TDM-GCC? I tried adding #include <cstring> to wxcrt.h but it doesn't change anything.

FYI, I have compiled wxWidgets 3.0.0 from source in mingw and tdm-gcc versions respectively, using

./configure --enable-stl && make && make install

I can provide more details if needed.

解决方案

First of all, wxWidgets certainly does work with MinGW, the fact that only TDM binaries are provided simply means that someone volunteered to provide the latter but not the former. But all three popular versions of MinGW (the two already mentioned and MinGW-w64) do work, so there must be something wrong with the build...

However while they all work, they are certainly different compilers, so what do you mean that they both use the same gcc binary? It must be either a MinGW one or a TDM one, but it can't be both at once.

It's also very suspicious that the configure detects different flags to use for the large file support. Look at config.log, something must have gone wrong and there must be some errors in the initial stage in it.

这篇关于为什么mingw32和tdm-gcc64使用外部gcc的行为不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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