[haiku-development] Re: Using the Haiku cross compilers for other projects

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 21 Aug 2007 02:04:48 +0200

On 2007-08-20 at 02:36:52 [+0200], Ryan Leavengood <leavengood@xxxxxxxxx> 
wrote:
> So my WebKit saga continues of course. Regardless of whatever happens
> with Haiku and GCC 4.x versus 2.95 binaries, I need to compile WebKit
> and it's library dependencies with GCC 4.x.
> 
> So I have the source code for ICU 3.6 and Haiku's GCC 4.x cross compilers.
> 
> I tried running ICU's configure script with the --host option after
> putting generated/cross-tools/bin in the path, but it died pretty
> quick because it couldn't compile a test file for lack of crti.o.
> 
> So I assume some directories need to be set up in environment
> variables or something. I've looked around and am not quite sure what
> is what in the Haiku cross compilers.

You need to set up a bit of the compilation environment manually. Usually 
you do that via shell environment variables defined when invoking the 
configure script (at least with GNU-style/autoconf generated configures). 
Usually like:

CC=... CFLAGS=... LDFLAGS=... CPP=... CXX=... ... ./configure ...

Best invoke the configure script with --help to get a list what variables 
are supported exactly (reading files like README or INSTALL is usually 
helpful, too). Note that some build systems simply don't support 
cross-compilation.

The paths for your environment variables should indeed point somewhere into 
generated/cross-tools. It's a full installation of the cross-compilation 
tools, so all you need will be there. A look into the 
generated/build/BuildConfig will probably help a good deal to understand 
what lives where. The tool paths (HAIKU_{AR,CC,...}) are pretty much 
self-explaining (you found those already, obviously). HAIKU_GCC_LIB_DIR is 
the directory where libgcc and the glue code (like the crti.o you were 
missing) live. It's also the parent directory for the gcc header files 
(subdir "include"). That should be it for pure C. For C++ one usually has 
to link against libsupc++ (HAIKU_{SHARED,STATIC}_LIBSUPC++). The 
[i586-...-]g++ front-end will do that automatically for you, so you'll 
probably won't have to specify it. It might be necessary to specify the C++ 
headers (HAIKU_C++_HEADERS_DIR) explicitly (do that in the same order 
then), and maybe the STL (HAIKU_{SHARED,STATIC}_LIBSTDC++).

> Any suggestions would be appreciated. Also has anyone tried compiling
> GCC 4.x to run on Haiku? Guess we would need to take the existing GCC
> 4.x to compile itself for Haiku? ;)

Nope, gcc 4 is not yet ported to Haiku (i.e. as host platform). Doing that 
shouldn't be that much of a problem in itself, but it might be necessary to 
port the rest of the tool chain over first (Perl, autoconf,...).

CU, Ingo

Other related posts: