[GRASS5] Making GRASS cross-compiler friendly (was: Script to build babyGRASS for handhelds)

Glynn Clements glynn.clements at virgin.net
Tue Apr 30 14:53:34 EDT 2002


Carl Worth wrote:

>  > PS: I've just uploaded the latest baby* scripts to CVS: handheld/
> 
> I'm trying these out with my cross-compiler now. Things appear to have
> compiled fine, but when I try to to run GRASS I find that
> grass5/etc/lock does not exist, (I linked it to /bin/true to push past
> this), and then grass5/etc/set_data does not exist.
> 
> Any suggestions where I might look to see why these didn't get
> compiled?
> 
> Since, I'm going through it, I thought I would point out the ways in
> which GRASS is hard to cross-compile, along with some suggested fixes:
> 
> 1) configure tries to compile and run a program to determine the
>    number of arguments for setpgrp.
> 
>    Workaround: Delete AC_FUNC_SETPGRP, run autoconf, run ./configure,
>    edit src/include/config.h to define SETPGRP_VOID.
> 
>    Proposal: ??? (This is a long-standing frustration with autoconf)

	if [ "$cross_compiling" = "yes" ] then
		AC_TRY_COMPILE(...)
	else
		AC_FUNC_SETPGRP
	fi

Of course, this assumes that the headers include correct prototypes;
if they just use e.g. "extern int setpgrp();", there's no way to tell.

> 2) The build process tries to compile, then execute nad2bin. I
>    understand that this is an attempt to create binary files with the
>    correct endian-ness, but it breaks cross-compilation.

Right. The same situation exists for src/fonts/for_grass.

>    Workaround: I just compiled nad2bin natively, then continued the
>    build. I think I'm OK, (eg. lucky), here since x86 and arm are the
>    same endian-ness. However, now an unusable nad2bin is being
>    installed with GRASS. Is GRASS going to execute this program during
>    normal operation?

No.

>    Proposal: If GRASS does not execute nad2bin at runtime, then we
>    just need to come up with a mechanism for two different compilers
>    for native cs. cross-compilation. Then, nad2bin could be installed
>    using the native compiler, while all other compilation would use
>    the cross compiler.

As Frank pointed out, this won't work for nad2bin, as the binary
output files are platform-specific.

Ultimately, we need to:

a) modify the build procedure not to run these "compilers" when
cross-compiling, and

b) provide scripts which would complete the build procedure on the
target system.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list