8

I've the following errors when trying to cross-compile glib, with the following configuration parameters:

./configure --prefix=$HOME --host=arm-hisiv400-linux

checking for growing stack pointer... configure: error: in `/home/aa/Hi3536_SDK_V2.0.4.0/glib-2.50.0':
configure: error: cannot run test program while cross compiling
See `config.log' for more details

Is there a way to disable these tests so that my cross-compile process can get through?

2
  • I'm guessing ./configure --help might help.
    – schaiba
    Nov 2, 2016 at 7:12
  • No it doesn't as it doesn't have disable-test listed as one of the option. Feb 11, 2017 at 2:49

1 Answer 1

3

The standard practice in this type of situation is to use an Autoconf site default file containing the appropriate values for the tests that configure wants to run.

In this particular case, configure is trying to determine in which direction the stack grows:

    volatile int *a = 0, *b = 0;
    void f (int i) { volatile int x = 5; if (i == 0) b = &x; else f (i - 1); }
    int main () { volatile int y = 7; a = &y; f (100); return b > a ? 0 : 1; }

So you'd cross-compile that code, run it on your target platform, and examine its exit code (echo $?). Create a site default file for your target architecture, for example config.arm-hisiv400-linux, and add a line with

glib_cv_stack_grows=yes

(if the exit code above was 0), or

glib_cv_stack_grows=no

(if the exit code was 1).

Then run configure with CONFIG_SITE pointing to the full path of the site default file you just created:

CONFIG_SITE=/path/to/config.arm-hisiv400-linux ./configure --prefix=$HOME --host=arm-hisiv400-linux

configure should use the value from the site default file, skipping the test for the stack. It will probably fail on the next test which needs to run a program compiled for the target, but you can fix that in the same way, adding more entries to the site default file (as long as configure.ac uses AC_CACHE_VAL around AC_TRY_RUN).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .