[gs-devel] ghostscript crosscompiling: segfault in binaries compiled with 64bit host system

Ken Sharp ken.sharp at artifex.com
Wed Jan 2 06:20:04 PST 2008


At 14:57 02/01/2008 +0100, Luotao Fu wrote:


>After some searching and trying I recompiled gs on a 32bit host machine and it
>worked eventually perfectly. Seemed that gs generates stuffs during compiling,

This is the case. The build system for GS is quite complex, one of the 
things it does is build an executable 'genarch', which it then runs, 
probing the 'current' system for various architectural parameters.

On a cross-compilation system this will not work, as the executable may not 
run on the host, and almost certainly won't return the right architectural 
results if it does somehow run.

genarch is used to build arch.h (on most systems you will find this has 
been created in ./obj, not the source directory). You may be able to create 
one matching your target by inspecting an existing example, or you may be 
able to create the genarch executable and run it on your target system to 
create the file, which you can then bring back to your build environment.


I should warn you that from my experience with the GS  build you *may* have 
a number of other things to do. You will need to build and run the echogs 
executable, which is used for a number of purposes, including copying other 
files required for builds. This will probably need to be available in the 
*host* executable format as part of the build. Most likely this is already 
working for you.

There are a number of compiler #define directives which you will need to 
get correct as well. Note that some of the 3rd party libraries (especially 
the IJG JPEG library) are built from modified code, you will need to ensure 
you are using the correctly modified source code to build from. Each of the 
3rd party libraries, and others such as the JBIG2 library, have their own 
makefiles, and will require different #define directives.

I discovered while making a VC++ solution that some of these are mutually 
incompatible, and so cannot be set as a 'default' but must be specified as 
required.


>Any hints? Is this problem already known or even fixed some where?

Almost certainly your tools are absolutely fine, very possibly the existing 
makefiles will work well if you can manage to create arch.h on your target 
system, then modify the existing makefiles to not rebuild genarch and 
overwrite arch.h ;-)

I would start with arch.h and see how far that takes you, you may have 
little or nothing else to do.


I think Ralph Giles is the expert on this, and he is often available on the 
Ghostscript IRC channel. Of course he reads this list as well.


                     Ken

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Adding manpower to a late software project makes it later.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -





More information about the gs-devel mailing list