apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "carlo\.bramix" <carlo.bra...@libero.it>
Subject Configuration failed with mingw+msys
Date Fri, 27 Jun 2008 13:46:13 GMT
Hello.
There is an error when configuring APR 1.3.2 on my PC.
Here you are what it happens:

checking size of void*... 0 -> Messagebox with SIGSEGV
checking size of char... 0 -> Messagebox with SIGSEGV
checking size of int... 0 -> Messagebox with SIGSEGV
checking size of long... 0 -> Messagebox with SIGSEGV
checking size of short... 0 -> Messagebox with SIGSEGV
checking size of long long... 0 -> Messagebox with SIGSEGV
configure: error: could not detect a 64-bit integer type

I think that the problem happens because the configure script adds both -lmsvcrt and -lkernel32.
It happens into these lines:

AC_CHECK_LIB(msvcrt, getpid)
APR_CHECK_DLL_FUNC(kernel32, SetErrorMode@4)
APR_CHECK_DLL_FUNC(advapi32, GetSecurityInfo@32)
APR_CHECK_DLL_FUNC(ws2_32, gethostbyname@4)
APR_CHECK_DLL_FUNC(shell32, CommandLineToArgvW@8)
APR_CHECK_DLL_FUNC(kernel32,[CreateFileMappingA@24],
[ac_cv_func_CreateFileMapping=$ac_cv_lib_kernel32_CreateFileMappingA])
APR_CHECK_DLL_FUNC(rpcrt4,[UuidCreate@4])

You should never add kernel32 and msvcrt libraries on the command line, you must leave the
task to the compiler.

If you want to verify this bug, just write the simplest C source of the world:

int main() { return 0; }

And compile it.
If you write:

gcc test.c -o test.exe -mconsole
--> test.exe works.

gcc test.c -o test.exe -mconsole -lkernel32
--> test.exe works.

gcc test.c -o test.exe -mconsole -lmsvcrt
--> test.exe works.

gcc test.c -o test.exe -mconsole -lkernel32 -lmsvcrt
--> test.exe CRASHES, because the linker fails and it produces a corrupted executable.

Same results without -mconsole or with -mwindows (obviously, you must change main with WinMain).

SOLUTION:
I think you don't need to do that APR_CHECK_DLL_FUNC stuff.
It's mingw (read: winapi) so just add the libraries you need: -lshell32 -ladvapi32 -lws2_32
-lrpcrt4.
These libs are SURELY available into that enviroment.
Just remember to remove references to kernel32 and msvcrt, you don't need them.

I am using the latest version of binutils from mingw:
binutils-2.18.50-20080109-2.tar.gz

Sincerely,

Carlo Bramini.




Mime
View raw message