|
From: Shawn A. <Sha...@te...> - 2008-01-23 22:51:44
|
First, let me apologize if I'm so stupid I cannot see the answer in front of my face. Please feel free to publicly flog me if this is the case :) I noticed that "_get_errno" and "_set_errno" are not defined in the latest MinGW sources (w32api-3.11 and mingw-runtime-3.14). I would be more than happy to add these! Trouble is, I cannot quite figure out completely how to do that :). Here is what I did: First, I found MSDN documentation telling me these go into stdlib.h and/or errno.h (http://msdn2.microsoft.com/en-us/library/wwfcfxas(VS.80).aspx) and (http://msdn2.microsoft.com/en-us/library/hf1920a7(VS.80).aspx). Next, I inspected the mingw-runtime-3.1.4 and found that _errno is defined in both stdlib.h and errno.h, so I figure these two functions should go into both as well (very near to the _errno declaration I suppose). I then added these two declarations into those header files right underneath the _errno declarations: _CRTIMP int* __cdecl __MINGW_NOTHROW _set_errno(int); _CRTIMP int* __cdecl __MINGW_NOTHROW _get_errno(int*); Of course, re-compiling my app still gave me errors (expected, because they were originally linker errors, so just adding declarations doesn't help that). It is here now that I am stuck. I assume that the implementations for _get_errno and _set_errno are alive and present in the CRT (which I am assuming is the libmsvcrt.a archive in the mingw-runtime-3.1.4). But, Google tells me my app is already automagically linked with the libmsvcrt.a, so it must be that I need to "coax" it out somehow. I have concluded that perhaps I need to re-archive the libmsvcrt.a? I then tried downloading the mingw-runtime-3.1.4.src. First off, I typed "configure", then "make". Configure seemed to go fine. Make bombs out immediately not able to find Windows.h. I admittedly do not understand the mingw-runtime project. I would think somewhere I should find the "msvcrt.lib", "msvcrt70.lib", etc. in the project, but I cannot locate them. If I had to guess, perhaps I am not correctly utilizing "configure"? Or, perhaps there are certain prerequisite files and/or libraries and/or a certain unmentioned directory structure? I am doing this from a Linux Red Hat EL 4 machine. Again, I profusely apologize for probably missing the obvious. Any bit of help you can give me, even if it is just to steer me in the correct direction, is greatly appreciated! Thank you so much! For your convenience, here is a small C snippit showcasing the original build problem: -- BEGIN -- #include <errno.h> int main(int argc, char **argv) { _set_errno(EAGAIN); return 0; } -- END -- And, here is the build line: >/home/build/Linux/i686/mingw/bin/i386-mingw32msvc-gcc main.c /tmp/ccUxQxwY.o(.text+0x24):main.c: undefined reference to `_set_errno' My GCC version: >/home/build/Linux/i686/mingw/bin/i386-mingw32msvc-gcc --version i386-mingw32msvc-gcc (GCC) 3.2.3 (mingw special 20030504-1) Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. And, here is what happens when I type "configure", then "make" from the mingw-runtime-3.14src: quark:~/srcruntime/mingw-runtime-3.14>./configure checking package version... 3.14 checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for ar... ar checking for as... as checking for ranlib... ranlib checking for ld... ld checking for dlltool... dlltool checking for dlltool... dlltool checking for windres... windres checking for a BSD-compatible install... /usr/bin/install -c configure: creating ./config.status config.status: creating Makefile configure: configuring in profile configure: running /bin/sh './configure' --prefix=/usr/local --cache-file=/dev/null --srcdir=. checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c configure: creating ./config.status config.status: creating Makefile configure: configuring in mingwex configure: running /bin/sh './configure' --prefix=/usr/local --cache-file=/dev/null --srcdir=. checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c configure: creating ./config.status config.status: creating Makefile quark:~/srcruntime/mingw-runtime-3.14>make gcc -c -D__CRTDLL__ -U__MSVCRT__ -g -O2 -I./include -I./../include -nostdinc -iwithprefixbefore include -I ./../w32api/include crt1.c -o crt1.o crt1.c:21:21: windows.h: No such file or directory crt1.c:102: error: syntax error before "long" crt1.c:103: error: syntax error before '*' token crt1.c: In function `_gnu_exception_handler': crt1.c:106: error: `EXCEPTION_CONTINUE_SEARCH' undeclared (first use in this function) crt1.c:106: error: (Each undeclared identifier is reported only once crt1.c:106: error: for each function it appears in.) crt1.c:109: error: `exception_data' undeclared (first use in this function) crt1.c:111: error: `EXCEPTION_ACCESS_VIOLATION' undeclared (first use in this function) crt1.c:119: error: `EXCEPTION_CONTINUE_EXECUTION' undeclared (first use in this function) crt1.c:129: error: `EXCEPTION_ILLEGAL_INSTRUCTION' undeclared (first use in this function) crt1.c:130: error: `EXCEPTION_PRIV_INSTRUCTION' undeclared (first use in this function) crt1.c:148: error: `EXCEPTION_FLT_INVALID_OPERATION' undeclared (first use in this function) crt1.c:149: error: `EXCEPTION_FLT_DIVIDE_BY_ZERO' undeclared (first use in this function) crt1.c:150: error: `EXCEPTION_FLT_DENORMAL_OPERAND' undeclared (first use in this function) crt1.c:151: error: `EXCEPTION_FLT_OVERFLOW' undeclared (first use in this function) crt1.c:152: error: `EXCEPTION_FLT_UNDERFLOW' undeclared (first use in this function) crt1.c:153: error: `EXCEPTION_FLT_INEXACT_RESULT' undeclared (first use in this function) crt1.c:157: error: `EXCEPTION_INT_DIVIDE_BY_ZERO' undeclared (first use in this function) make: *** [crt1.o] Error 1 -- Shawn Authement |