You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Daniel Stonier <d....@gmail.com> on 2010/11/25 07:16:36 UTC

Building with the mingw cross compiler

I'm using a mingw cross compiler from
http://mingw-cross-env.nongnu.org/ to try and build the apache
runtimes.

Apr would fail in the configure stage though:

checking which type to use for apr_off_t... configure: error: could
not determine the size of off_t

My config.log showed the problem:

ac_cv_sizeof_long_long=8
ac_cv_sizeof_off_t=4^M
ac_cv_sizeof_pid_t=4^M
ac_cv_sizeof_short=2

Which meant checks for ac_cv_sizeof_off_t weren't working correctly.
It also meant the pid_t failed to define itself properly in
include/apr.h. I got around it by simply predefining these as
constants when configuring, however it'd be good if it got fixed
upstream. However, I am not sure where these are actually getting
defined.

Cheers,
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

Re: Building with the mingw cross compiler

Posted by Daniel Stonier <d....@gmail.com>.
On 25 November 2010 19:34, Bojan Smojver <bo...@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

Re: Building with the mingw cross compiler

Posted by Bojan Smojver <bo...@rexursive.com>.
> 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 

Re: Building with the mingw cross compiler

Posted by Daniel Stonier <d....@gmail.com>.
On 25 November 2010 15:41, Bojan Smojver <bo...@rexursive.com> wrote:
> On Thu, 2010-11-25 at 15:16 +0900, Daniel Stonier wrote:
>> ac_cv_sizeof_off_t=4^M
>> ac_cv_sizeof_pid_t=4^M
>
> Are you saying that these are \r (ASCII 13) characters? This could be
> related to fprintf() from the test printing out \r\n instead of just \n
> on your platform. Maybe the file should be opened with "wb" or
> something.
>
> This is what I'm referring to (you can find this in configure script):
> --------------------------------
> /* 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);
> }
> --------------------------------
> /* 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(off_t));
>  exit(0);
> }
> --------------------------------
>
> Hmm, not sure what's going on there. Don't usually run APR on mingw.
>
> --
> Bojan

Ok, so this is confusing me a little - how would it even run a test
being a mingw cross compiled program (host is linux)?


-- 
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

Re: Building with the mingw cross compiler

Posted by Bojan Smojver <bo...@rexursive.com>.
On Thu, 2010-11-25 at 15:16 +0900, Daniel Stonier wrote:
> ac_cv_sizeof_off_t=4^M
> ac_cv_sizeof_pid_t=4^M 

Are you saying that these are \r (ASCII 13) characters? This could be
related to fprintf() from the test printing out \r\n instead of just \n
on your platform. Maybe the file should be opened with "wb" or
something.

This is what I'm referring to (you can find this in configure script):
--------------------------------
/* 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);
}
--------------------------------
/* 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(off_t));
  exit(0);
}
--------------------------------

Hmm, not sure what's going on there. Don't usually run APR on mingw.

-- 
Bojan