You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Henrik Strand <he...@axis.com> on 2012/03/16 15:07:54 UTC

/bin/sh: ./gen_test_char: cannot execute binary file

Hi!

When porting/cross-compiling the Apache HTTP Server the build fails with
the following error message: "/bin/sh: ./gen_test_char: cannot execute
binary file".
This is due to that the gen_test_char is compiled with the
cross-compiler but executed on the build system.

This error has been around for 10 years or so, but I could not find an
error report on this issue so I created one (in May, 2011):
https://issues.apache.org/bugzilla/show_bug.cgi?id=51257

There exists an old (2003-08-13) patch
(http://marc.info/?l=apache-httpd-dev&m=106150997309208&w=2) for this
error but I do not think that it was integrated.

Another patch
(http://svn.apache.org/viewvc/httpd/httpd/trunk/server/gen_test_char.c?r1=758929&r2=795438&pathrev=1001398&diff_format=h) has recently been integrated to simplify cross-compilation. However, this patch does not solve the gen_test_char cross-compiling issue.

A known workaround is to:
1. Cross-compile and wait for the build to fail.
2. Compile for build system and copy the gen_test_char binary to the
cross-compiled build folder
3. Run make a second time for the cross-compiled system

However, since I'm about to automate the build process this workaround
is not sufficient for me.

It seems strange that this error has been around for so long time so I'm
wondering if the Httpd build system does include some way to generate a
correct gen_test_char file when cross-compiling?

Thanks in advance.

Kind Regards,
Henrik


Re: /bin/sh: ./gen_test_char: cannot execute binary file

Posted by Eric Covener <co...@gmail.com>.
> It seems strange that this error has been around for so long time so I'm
> wondering if the Httpd build system does include some way to generate a
> correct gen_test_char file when cross-compiling?

No, if it included this it would just work.

Re: /bin/sh: ./gen_test_char: cannot execute binary file

Posted by Henrik Strand <he...@axis.com>.
Hi Guenter,

I can give it a try. 

Kind Regards,
Henrik

On Sat, 2012-03-17 at 12:01 +0100, Guenter Knauf wrote:
> Hi Henrik,
> Am 16.03.2012 15:07, schrieb Henrik Strand:
> > This error has been around for 10 years or so, but I could not find an
> > error report on this issue so I created one (in May, 2011):
> > https://issues.apache.org/bugzilla/show_bug.cgi?id=51257
> >
> > There exists an old (2003-08-13) patch
> > (http://marc.info/?l=apache-httpd-dev&m=106150997309208&w=2) for this
> > error but I do not think that it was integrated.
> >
> > Another patch
> > (http://svn.apache.org/viewvc/httpd/httpd/trunk/server/gen_test_char.c?r1=758929&r2=795438&pathrev=1001398&diff_format=h) has recently been integrated to simplify cross-compilation. However, this patch does not solve the gen_test_char cross-compiling issue.
> >
> > A known workaround is to:
> > 1. Cross-compile and wait for the build to fail.
> > 2. Compile for build system and copy the gen_test_char binary to the
> > cross-compiled build folder
> > 3. Run make a second time for the cross-compiled system
> >
> > However, since I'm about to automate the build process this workaround
> > is not sufficient for me.
> this step with another 3 rounds of configure (APR, APU, httpd) + 
> compilation of APR/APU isnt really necessary;
> instead just compile gen_test_char.c 1st with something like:
> gcc -Wall -O2 -DCROSS_COMPILE gen_test_char.c -s -o gen_test_char
> then run it and put its output into the include folder (or where its 
> placed normaly);
> I believe you can then make it with only one go + automatically ...
> 
> > It seems strange that this error has been around for so long time so I'm
> > wondering if the Httpd build system does include some way to generate a
> > correct gen_test_char file when cross-compiling?
> nope; in order to make it the clean way we would need to have an --host 
> option to configure ...
> I looked at the old 2003 patch which is for AP 1.3, and it looks 
> harmless, and could perhaps be integrated - are you up to provide a 
> patch for trunk?
> 
> BTW. how is the cross-compilation of PCRE handled? There's a similar 
> case where a build helper is needed for generating chartables.c?
> 
> Gün.
> 
> 



Re: /bin/sh: ./gen_test_char: cannot execute binary file

Posted by Guenter Knauf <fu...@apache.org>.
Hi Henrik,
Am 16.03.2012 15:07, schrieb Henrik Strand:
> This error has been around for 10 years or so, but I could not find an
> error report on this issue so I created one (in May, 2011):
> https://issues.apache.org/bugzilla/show_bug.cgi?id=51257
>
> There exists an old (2003-08-13) patch
> (http://marc.info/?l=apache-httpd-dev&m=106150997309208&w=2) for this
> error but I do not think that it was integrated.
>
> Another patch
> (http://svn.apache.org/viewvc/httpd/httpd/trunk/server/gen_test_char.c?r1=758929&r2=795438&pathrev=1001398&diff_format=h) has recently been integrated to simplify cross-compilation. However, this patch does not solve the gen_test_char cross-compiling issue.
>
> A known workaround is to:
> 1. Cross-compile and wait for the build to fail.
> 2. Compile for build system and copy the gen_test_char binary to the
> cross-compiled build folder
> 3. Run make a second time for the cross-compiled system
>
> However, since I'm about to automate the build process this workaround
> is not sufficient for me.
this step with another 3 rounds of configure (APR, APU, httpd) + 
compilation of APR/APU isnt really necessary;
instead just compile gen_test_char.c 1st with something like:
gcc -Wall -O2 -DCROSS_COMPILE gen_test_char.c -s -o gen_test_char
then run it and put its output into the include folder (or where its 
placed normaly);
I believe you can then make it with only one go + automatically ...

> It seems strange that this error has been around for so long time so I'm
> wondering if the Httpd build system does include some way to generate a
> correct gen_test_char file when cross-compiling?
nope; in order to make it the clean way we would need to have an --host 
option to configure ...
I looked at the old 2003 patch which is for AP 1.3, and it looks 
harmless, and could perhaps be integrated - are you up to provide a 
patch for trunk?

BTW. how is the cross-compilation of PCRE handled? There's a similar 
case where a build helper is needed for generating chartables.c?

Gün.