2

I've tried to compile firebird server for arm linux, with cross-compiler (it's choosen - it's working properly).

When using:

./autogen.sh --host=arm-linux-gnu

I get this error:

checking for working sem_init()... configure: error: in `/compile/code/firebird/trunk': configure: error: cannot run test program while cross compiling

I know I'm cross-compiling, but maybe Firebird developers dissalow this (but i've read Firebird is ready to compilation for another architectures).

3

Configure determines the answer to certain questions by compiling and running programs on the fly ... which it can (usually) do when the build host is the same as the target host.

When you are cross-compiling, (usually) your build machine can't run the binaries produced by the cross-compiler.

To overcome this, locate where the test is in the configure script and if you are lucky, the configure script will allow for the caching of the result of the test ... you can use this to fool the configure script into thinking that it already knows the answer to the question, and therefore it will not try to compile and run the binary.

For example, if you were trying to cross-compile openldap 2.3.11 (an old version, I know), you may need to pass in the environment the variable ac_cv_func_memcmp_working=yes (or I think you can call configure with this setting on the command line e.g. ./configure ac_cv_func_memcmp_working=yes --prefix=...).

The code in the configure script looks like this (it is an older version of autoconf, so the code will be different in newer configure scripts, but the concept hasn't changed) ...

echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6
if test "${ac_cv_func_memcmp_working+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
    ac_cv_func_memcmp_working=no
  else
...

You can see in the above code that the configure script makes an (incorrect, in my case) assumption about the target machine if it thinks you are cross-compiling.

If you can't work around it using this trick (cached answers), you will have to provide a work-around in some other way ... the goal is to fool the configure script into running all the way through.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.