Thomas Stover | 3 Aug 2012 21:07
Favicon
Gravatar

building cross tools

Hi list. I'm interested in experimenting with porting some code to
Haiku via cross compilation from Linux. Using the notes on the web
site, I have attempted and failed to build both the gcc2 and gcc4 x86
options. Do prebuilt tool chains exist? What build platform specifically
do you use to make it work? This is ubuntu 11.10 x86_64.

For the gcc2, it fails with

...
checking if mkdir takes one argument... no
Configuration x86_64-unknown-linux-gnu not supported
Configure
in /home/thomas/haiku/haiku/generated.x86gcc2/cross-tools-build/gcc/gcc
failed, exiting.

For the gcc4, it fails with

...
config.status: creating po/Makefile.in
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing bfd_stdint.h commands
config.status: executing default commands
make[3]: Leaving directory
`/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd/po'
make[3]: Entering directory
`/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd/po'
make[3]: Nothing to be done for `info'. make[3]: Leaving directory
`/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd/po'
(Continue reading)

François Revol | 3 Aug 2012 22:36
Picon
Favicon
Gravatar

Re: building cross tools

On 03/08/2012 21:07, Thomas Stover wrote:
> Hi list. I'm interested in experimenting with porting some code to
> Haiku via cross compilation from Linux. Using the notes on the web
> site, I have attempted and failed to build both the gcc2 and gcc4 x86
> options. Do prebuilt tool chains exist? What build platform specifically

No, although it might be useful to be able to build the toolchain
separately.
NetSurf maintains some scripts to generate toolchains for some platforms
it supports, but not Haiku yet.

> do you use to make it work? This is ubuntu 11.10 x86_64.
> 
> For the gcc2, it fails with
> 
> ...
> checking if mkdir takes one argument... no
> Configuration x86_64-unknown-linux-gnu not supported
> Configure
> in /home/thomas/haiku/haiku/generated.x86gcc2/cross-tools-build/gcc/gcc
> failed, exiting.

You might want to use linux32 to run it...

François.

Ingo Weinhold | 3 Aug 2012 22:42
Picon
Picon

Re: building cross tools

Thomas Stover wrote:
> For the gcc4, it fails with
> 
> ...
> config.status: creating po/Makefile.in
> config.status: executing depfiles commands
> config.status: executing libtool commands
> config.status: executing default-1 commands
> config.status: executing bfd_stdint.h commands
> config.status: executing default commands
> make[3]: Leaving directory
> `/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd/po'
> make[3]: Entering directory
> `/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd/po'
> make[3]: Nothing to be done for `info'. make[3]: Leaving directory
> `/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd/po'
> make[3]: Entering directory
> `/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd'
> make[3]: Nothing to be done for `info-am'. make[3]: Leaving directory
> `/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd'
> make[2]: *** [info-recursive] Error 1 make[2]: Leaving directory
> `/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils/bfd'
> make[1]: *** [all-bfd] Error 2 make[1]: Leaving directory
> `/home/thomas/haiku/haiku/generated.x86gcc4/cross-tools-build/binutils'
> make: *** [all] Error 2

Mmh, I don't see any actual error here. Have you installed all prerequisites (like makeinfo and friends)?

CU, Ingo

(Continue reading)

Thomas Stover | 3 Aug 2012 23:07
Favicon
Gravatar

Re: building cross tools

On Fri, 03 Aug 2012 22:42:47 +0200
"Ingo Weinhold" <ingo_weinhold@...> wrote:

> 
> Mmh, I don't see any actual error here. Have you installed all
> prerequisites (like makeinfo and friends)?
> 
> CU, Ingo
> 

um, I don't think so. This is the best I tell what to do from the
notes:

$ mkdir haiku
$ cd haiku
$ git clone git://git.haiku-os.org/buildtools
$ git clone git://git.haiku-os.org/haiku
$ cd haiku
$ mkdir generated.x86gcc4
$ cd generated.x86gcc4/
$ ../configure --build-cross-tools-gcc4 x86 ../../buildtools

...

$ tree -d generated.x86gcc4
generated.x86gcc4
|-- build
|-- cross-tools
|   `-- lib
|       `-- gcc
(Continue reading)

Ryan Leavengood | 3 Aug 2012 23:25
Picon
Gravatar

Re: building cross tools

On Fri, Aug 3, 2012 at 5:07 PM, Thomas Stover <cts@...> wrote:
>
> How far off am I?

You are fairly close except for installing some things in Ubuntu.
Please take a look at the link below, and be sure to take note of
Ubuntu specific notes AND ESPECIALLY 64-bit notes. Being a Haiku
developer I did not notice those 64-bit notes when I set up my Ubuntu
machine and it caused me trouble.

http://www.haiku-os.org/guides/building

I think the above guide needs to be made much more obvious, even when
I know what I'm looking for it takes a bit to find it.

--

-- 
Regards,
Ryan

Thomas Stover | 4 Aug 2012 03:24
Favicon
Gravatar

Re: building cross tools

On Fri, 3 Aug 2012 17:25:12 -0400
Ryan Leavengood <leavengood@...> wrote:

> You are fairly close except for installing some things in Ubuntu.
> Please take a look at the link below, and be sure to take note of
> Ubuntu specific notes AND ESPECIALLY 64-bit notes. Being a Haiku
> developer I did not notice those 64-bit notes when I set up my Ubuntu
> machine and it caused me trouble.
> 
> http://www.haiku-os.org/guides/building
> 
> I think the above guide needs to be made much more obvious, even when
> I know what I'm looking for it takes a bit to find it.
> 

That worked! At least for C++ anyway. i586-pc-haiku-gcc was built, but
there are no include files. Is a C cross compiler possible?

--

-- 
www.thomasstover.com

Ryan Leavengood | 4 Aug 2012 03:50
Picon
Gravatar

Re: building cross tools

On Fri, Aug 3, 2012 at 9:24 PM, Thomas Stover <cts@...> wrote:
>
> That worked! At least for C++ anyway. i586-pc-haiku-gcc was built, but
> there are no include files. Is a C cross compiler possible?

Your C++ compiler should compile C fine.

If you are trying to build 3rd party code using the Haiku
cross-compilers outside the Haiku build environment you may find it
difficult. I would recommend making sure you use the
--include-3rdparty in configure (or if you have already configured
just edit the BuildConfig file in generated/ to turn on that option.)
Then put your code in 3rdparty and build a Jamfile for it (there are
plenty of other examples in the Haiku tree.)

Overall you may need to dig around and get your hands dirty to get
this working. You may want to start with just getting Haiku building
and set up your own image which you can run with VirtualBox. I
recommend reading build/jam/UserBuildConfig.ReadMe for tips on setting
up a custom image build. Once you successfully compile Haiku and get
it running, you know your build environment is sound, then you can
work on porting your code. Though you can always just make an extra
virtual disk with enough space for your 3rd party code and you can
then try to compile it from within Haiku (running in VirtualBox.)

--

-- 
Regards,
Ryan

(Continue reading)

Ingo Weinhold | 4 Aug 2012 14:05
Picon
Picon

Re: building cross tools

Thomas Stover wrote:
> On Fri, 3 Aug 2012 17:25:12 -0400
> Ryan Leavengood <leavengood@...> wrote:
> 
> > You are fairly close except for installing some things in Ubuntu.
> > Please take a look at the link below, and be sure to take note of
> > Ubuntu specific notes AND ESPECIALLY 64-bit notes. Being a Haiku
> > developer I did not notice those 64-bit notes when I set up my Ubuntu
> > machine and it caused me trouble.
> > 
> > http://www.haiku-os.org/guides/building
> > 
> > I think the above guide needs to be made much more obvious, even when
> > I know what I'm looking for it takes a bit to find it.
> 
> That worked! At least for C++ anyway. i586-pc-haiku-gcc was built, but
> there are no include files. Is a C cross compiler possible?

Haiku's include files aren't copied to the compiler directory. Use the ones from headers/ (config/,
posix/, and os/ at least). Alternatively look at the build/scripts/build_cross_tools[_gcc4] and
modify them to your needs.

CU, Ingo

Thomas Stover | 8 Aug 2012 00:40
Favicon
Gravatar

Re: building cross tools

On Sat, 04 Aug 2012 14:05:39 +0200
"Ingo Weinhold" <ingo_weinhold@...> wrote:
> Haiku's include files aren't copied to the compiler directory. Use
> the ones from headers/ (config/, posix/, and os/ at least).
> Alternatively look at the build/scripts/build_cross_tools[_gcc4] and
> modify them to your needs.
> 
> CU, Ingo
> 

I tried some more today to build a hello world C program. First I tried
it inside the anyboot image running on qemu, which worked fine. Back
with the cross compiler, I finished compilation with 

-I ./headers/posix/ -I ./headers/os/ 

but I still can't link. Based on error output I copied these files into
my working directory: crti.o  crtn.o   init_term_dyn.o  start_dyn.o
When I specified the full path to these files it fails, but having them
in the same directory seems ok. Anyway the last error seems to be

./haiku/generated.x86gcc4/cross-tools/lib/gcc/i586-pc-haiku/4.6.2/../../../../i586-pc-haiku/bin/ld:
cannot find -lroot

Any ideas?

--

-- 
www.thomasstover.com

(Continue reading)

Ryan Leavengood | 8 Aug 2012 00:46
Picon
Gravatar

Re: building cross tools

On Tue, Aug 7, 2012 at 6:40 PM, Thomas Stover <cts@...> wrote:
>
> I tried some more today to build a hello world C program. First I tried
> it inside the anyboot image running on qemu, which worked fine. Back
> with the cross compiler, I finished compilation with
>
> -I ./headers/posix/ -I ./headers/os/
>
> but I still can't link. Based on error output I copied these files into
> my working directory: crti.o  crtn.o   init_term_dyn.o  start_dyn.o
> When I specified the full path to these files it fails, but having them
> in the same directory seems ok. Anyway the last error seems to be
>
> ./haiku/generated.x86gcc4/cross-tools/lib/gcc/i586-pc-haiku/4.6.2/../../../../i586-pc-haiku/bin/ld:
> cannot find -lroot
>
> Any ideas?

You need libroot.so.

At one point I had a script which set up the cross compiler where it
was usable outside the Haiku build system (when I was porting WebKit
in 2007), but I don't have it on this machine and it may have been
lost in my various computer upgrades.

--

-- 
Regards,
Ryan

(Continue reading)


Gmane