You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Aizer Danny-BDA023 <Da...@motorola.com> on 2007/03/19 15:17:38 UTC

Default APR sizes of size_t and ssize_t when cross compiling

Hello,

 

I am cross-compiling Apache HTTPD 2.2.3 on a Red Hat Linux 9 (the build

machine) for a PowerPC 82xx embedded device. When I run the top-level 

configure script which runs among others the APR configure script, I 

notice that the sizeof size_t and ssize_t are being defaulted to "8"

because the $cross_compiling variable is set to "yes". The same 

behaviour can be seen for other configure tests also: if the 

$cross_compiling variable is set (it is being set in the beginning 

because the BUILD and HOST options have been specified on the 

configure command-line), then various ac_cv_* variables get some 

default values (which in my case are not appropriate for the target 

HOST architecture of ppc_82xx) instead of running the cross-compiler to

calculate the value.

 

Is this done on purpose? If so why? And how should I proceed if I want 

the configure script to correctly "conftest" all the needed values for 

my target HOST architecture? I've been searching in vain so far in 

FAQs, bug databases and the goonet, but I found no one with a similar 

problem (and a solution).

 

I understood from another posting on users@httpd that "Cross compilation

generally won't work because of autoconf AP_RUN_ macros which test

features dynamically." - so I'm not sure how should I address the
problems

of cross-compilation. I'm sure some people have cross-compiled HTTPD in

the past and overcame the same obstacles, so I would appreciate any

help on that.

 

Thanks in advance,

/Danny

 


Re: Default APR sizes of size_t and ssize_t when cross compiling

Posted by Joe Orton <jo...@redhat.com>.
On Mon, Mar 19, 2007 at 04:17:38PM +0200, Aizer Danny-BDA023 wrote:
> I am cross-compiling Apache HTTPD 2.2.3 on a Red Hat Linux 9 (the build
> machine) for a PowerPC 82xx embedded device. When I run the top-level
> configure script which runs among others the APR configure script, I
> notice that the sizeof size_t and ssize_t are being defaulted to "8"
> because the $cross_compiling variable is set to "yes". The same 
> behaviour can be seen for other configure tests also: if the 
> $cross_compiling variable is set (it is being set in the beginning 
> because the BUILD and HOST options have been specified on the 
> configure command-line), then various ac_cv_* variables get some 
> default values (which in my case are not appropriate for the target 
> HOST architecture of ppc_82xx) instead of running the cross-compiler to
> calculate the value.

In general when cross-compiling you should expect to have to provide a 
complete set of ac_cv_* and apr_* cache variables either in the 
environment or in a config.site file.

For this specific case the APR macros used to determine type size could 
probably now be replaced by the standard autoconf macros which can 
magically determine variable size as Bob notes.

joe

Re: Default APR sizes of size_t and ssize_t when cross compiling

Posted by Bob Rossi <bo...@cox.net>.
On Mon, Mar 19, 2007 at 09:54:21PM +0200, Aizer Danny-BDA023 wrote:
> > -----Original Message-----
> > From: Bob Rossi: 
> > 
> > On Mon, Mar 19, 2007 at 04:17:38PM +0200, Aizer Danny-BDA023 wrote:
> > > I am cross-compiling Apache HTTPD 2.2.3 on a Red Hat Linux 9 (the
> build
> > > machine) for a PowerPC 82xx embedded device. When I run the
> top-level 
> > > configure script which runs among others the APR configure script, I
> 
> > > notice that the sizeof size_t and ssize_t are being defaulted to "8"
> > > because the $cross_compiling variable is set to "yes". The same 
> > > behaviour can be seen for other configure tests also: if the 
> > > $cross_compiling variable is set (it is being set in the beginning 
> > > because the BUILD and HOST options have been specified on the 
> > > configure command-line), then various ac_cv_* variables get some 
> > > default values (which in my case are not appropriate for the target 
> > > HOST architecture of ppc_82xx) instead of running the cross-compiler
> to
> > > calculate the value.
> >
> > I think you will have to modify configure.in to fit your purposes. If
> > you submit a patch back, maybe you can make these features allowed 
> > to be passed in on the command line to configure?
> 
> Hi Bob,
> 
> I can probably do that, but I wanted to understand if this is the
> preferred way to deal with configuration for cross-compilation. My
> impression was that HTTPD (and APR) can be cross-compiled without any
> special intervention assuming that all needed environment variables are
> set and command-line parameters are given appropriately to ./configure .
> 
> If that is not the way most people cross-compile, then I will "patch"
> the configure.in as you suggested - although I still would like to
> understand (having read a lot about autoconf and related *.m4 and other
> files, so I'm being curious here) why aren't the ac_cv_* calculated by
> running the cross-compiler CC to test for the actual sizes (and other
> such values needed) of size_t and ssize_t.

Hi Danny,

When I was tackling this problem, I didn't come up with the appropriate
solution. I ended up not cross compiling APR for other reasons. I do
recall thinking that the sizeof code was broken.

The standard autoconf macro's claim to work when being cross compiled.
For instance, see this:
  http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_mono/autoconf.html#SEC63
It seems like perhaps the code that was used to replace that call is
broken when it comes to cross compiling support.


The other solution, is to allow the user to override the sizeof value
with a shell variable. That is, for example, the user could do,
  ./configure OPTIONS ac_cv_sizeof_size_t=4 OPTIONS
and then 4 would be used instead of the hard coded 8. I'm not sure which
approach would be better or if there is already a better way to do this.

Good luck,
Bob Rossi

RE: Default APR sizes of size_t and ssize_t when cross compiling

Posted by Aizer Danny-BDA023 <Da...@motorola.com>.
> -----Original Message-----
> From: Bob Rossi: 
> 
> On Mon, Mar 19, 2007 at 04:17:38PM +0200, Aizer Danny-BDA023 wrote:
> > I am cross-compiling Apache HTTPD 2.2.3 on a Red Hat Linux 9 (the
build
> > machine) for a PowerPC 82xx embedded device. When I run the
top-level 
> > configure script which runs among others the APR configure script, I

> > notice that the sizeof size_t and ssize_t are being defaulted to "8"
> > because the $cross_compiling variable is set to "yes". The same 
> > behaviour can be seen for other configure tests also: if the 
> > $cross_compiling variable is set (it is being set in the beginning 
> > because the BUILD and HOST options have been specified on the 
> > configure command-line), then various ac_cv_* variables get some 
> > default values (which in my case are not appropriate for the target 
> > HOST architecture of ppc_82xx) instead of running the cross-compiler
to
> > calculate the value.
>
> I think you will have to modify configure.in to fit your purposes. If
> you submit a patch back, maybe you can make these features allowed 
> to be passed in on the command line to configure?

Hi Bob,

I can probably do that, but I wanted to understand if this is the
preferred way to deal with configuration for cross-compilation. My
impression was that HTTPD (and APR) can be cross-compiled without any
special intervention assuming that all needed environment variables are
set and command-line parameters are given appropriately to ./configure .

If that is not the way most people cross-compile, then I will "patch"
the configure.in as you suggested - although I still would like to
understand (having read a lot about autoconf and related *.m4 and other
files, so I'm being curious here) why aren't the ac_cv_* calculated by
running the cross-compiler CC to test for the actual sizes (and other
such values needed) of size_t and ssize_t.

Thanks,
/Danny

Re: Default APR sizes of size_t and ssize_t when cross compiling

Posted by Bob Rossi <bo...@cox.net>.
On Mon, Mar 19, 2007 at 04:17:38PM +0200, Aizer Danny-BDA023 wrote:
> I am cross-compiling Apache HTTPD 2.2.3 on a Red Hat Linux 9 (the build
> 
> machine) for a PowerPC 82xx embedded device. When I run the top-level 
> 
> configure script which runs among others the APR configure script, I 
> 
> notice that the sizeof size_t and ssize_t are being defaulted to "8"
> 
> because the $cross_compiling variable is set to "yes". The same 
> 
> behaviour can be seen for other configure tests also: if the 
> 
> $cross_compiling variable is set (it is being set in the beginning 
> 
> because the BUILD and HOST options have been specified on the 
> 
> configure command-line), then various ac_cv_* variables get some 
> 
> default values (which in my case are not appropriate for the target 
> 
> HOST architecture of ppc_82xx) instead of running the cross-compiler to
> 
> calculate the value.

I think you will have to modify configure.in to fit your purposes. If
you submit a patch back, maybe you can make these features allowed 
to be passed in on the command line to configure?

Thanks,
Bob Rossi