apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Stonier <d.ston...@gmail.com>
Subject Re: Building with the mingw cross compiler
Date Thu, 25 Nov 2010 23:39:40 GMT
On 25 November 2010 19:34, Bojan Smojver <bojan@rexursive.com> wrote:
>> Ok, so this is confusing me a little - how would it even run a test
>> being a mingw cross compiled program (host is linux)?
>
> Honest answer is that I never even tried this (I only ever compile APR on
> Unix/Linux). I just see in my configure script that under certain
> circumstances these code snippets may get compiled and executed.
>
> --
> Bojan

Ok, I got it. Tested this at home on my gentoo machine and also on my
work ubuntu machine. On the gentoo it defaults all the variables to
the cross-compiled defaults. On my work machine, it doesn't recognise
the cross-compile (ultimately a problem that needs to be fixed?) since
it has a wine version that must have some emulation environment that
lets you run windows binaries natively on the command line.

>From the configure script, it must have cross_compiling set to false:

if test "${ac_cv_sizeof_pid_t+set}" = set; then
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then
  ac_cv_sizeof_pid_t=8
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <stdio.h>
#include <sys/types.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(pid_t));
  exit(0);
}
_ACEOF

In the config.log output:

configure:30959: checking size of pid_t
configure:30989: i686-pc-mingw32-gcc -o conftest.exe -W -Wall
-Wno-unused-parameter -fno-strict-aliasing  -D_WIN32_WINNT=0x0500
-DWIN32 -D_LARGEFILE64_SOURCE
-Wl,--enable-auto-import,--subsystem,console conftest.c -lrpcrt4
-lshell32 -lws2_32 -ladvapi32 -lkernel32 -lmsvcrt  >&5
conftest.c:85:1: warning: return type defaults to 'int'
conftest.c: In function 'main':
conftest.c:88:3: warning: implicit declaration of function 'exit'
conftest.c:88:11: warning: incompatible implicit declaration of
built-in function 'exit'
configure:30993: $? = 0
configure:30999: ./conftest.exe
configure:31003: $? = 0
configure:31020: result: 4^M

Thanks for the pointers bojan.

Daniel.


-- 
Phone : +82-10-5400-3296 (010-5400-3296)
Home: http://snorriheim.dnsdojo.com/
Yujin Robot: http://www.yujinrobot.com/
Embedded Ros : http://www.ros.org/wiki/eros
Embedded Control Libraries: http://snorriheim.dnsdojo.com/redmine/wiki/ecl

Mime
View raw message