Getting Linux Developer Tools

Article contributed by johndrinkwater on Tue, 2006-08-15 19:34
2010-January: This document is now obsolete. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

What you need

You will need svn before starting this process; the other tools (jam, gcc et al) are built from our repository. Before attempting to build Haiku, one must get copies of the development toolchain. Keep in mind that the process will consume around 1 GiB of disk space.

Fetching the tools

To build Haiku on Linux you must first check out and build the cross-compiler. The easiest method for doing so is to check it out in a directory just below that of the Haiku root. Navigate to the parent directory of Haiku and use a command such as:

svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools

You should now have a 'buildtools' folder that contains folders named 'binutils' and 'gcc' amongst others.

Building jam

Change to the buildtools folder and we will start to build 'jam' which is a requirement for building Haiku. Run the following commands to generate and install the tool:

cd  buildtools/jam  
make
sudo ./jam0 install

Keep in mind that the above will overwrite any previous installation of 'jam', as Haiku requires a slightly modified version. You can ensure that jam is installed correctly by comparing the result of the following:

$ jam -v
Jam 2.5-haiku-20060813. OS=LINUX. Copyright 1993-2002 Christopher Seiwald.

 

Building binutils

The binutils used by Haiku will be automatically generated according to the initial configuration of the Haiku source and placed in the 'generated/cross-tools' directory of Haiku. Before generating the tools you must consider the version required, there are essentially two choices:

  • 2.95: Creates BeOS compatible binaries
  • 4.x: Incompatible with BeOS, but theoretically more efficient binaries

Unless there is a pressing need, choose 2.95 as the latter option can cause frequent build issues. The commands for configuration are,

2.95:

cd haiku 
./configure --build-cross-tools ../buildtools/

4.x

cd haiku
./configure --build-cross-tools-gcc4 x86 ../buildtools/

The process can take quite some time, but when it finishes you are ready to compile your first haiku image.

Comments

problems with this procedure

Hello,

I tried to do like it is described, but after the 'make' command in the jam directory I just get tons of errors saying something like
"error Makefile.c:34 in stdio.h" for nearly every headerfile that is used.
I'm using Ubuntu 6.10. Looks like a simple error caused by my stupidity. Is it possible that I created the 'buildtools'-directory at the wrong place. Now it is like
~/svn/haiku/buildtools

The text on this page is a bit confusing:

Quote:

check it out in a directory just below that of the Haiku root. Navigate to the parent directory of Haiku and use a command such as:

First the directory should be 'below' haiku-root, then it is the 'parent directory' of Haiku...

Sorry for asking such perhaps silly questions, but I didn't find any answer elsewhere.

Thanks
Jean Rene

Hi,I personally found this

Hi,

I personally found this quite confusing as well. Though if you read the article with enough attention you eventually get what is meant ;-)

The correct way ("right" as in "working") is e.g.

svn checkout svn://svn.berlios.de/haiku/haiku/trunk haiku
svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools
... # build jam
cd haiku
 ./configure --build-cross-tools ../buildtools/

or similar. I suspect it actually doesn't matter since you tell the haiku configure script where to go looking for the buildtools.

Could also be that you're just lacking some prerequisite (I had to install autoconf or automake if I remember correctly)

Greetings
Peschmä

now it works

Don't know what it really was, because I changed several things. I think the main problems where missing 'binutils' and perhaps a missing 'sudo' at make...
Well, it works now. Thanks for the hints.

Greetings
Jena Rene

Hi all, I was hoping someone

Hi all,

I was hoping someone could help me please I would love to have haiku installed.
Here is what I did:

svn checkout svn://svn.berlios.de/haiku/haiku/trunk haiku
svn checkout svn://svn.berlios.de/haiku/buildtools/trunk/buildtools
cd buildtools/jam
make
sudo ./jam0 install

So far, so good
-----

But then I try to build binutils :

"cd haiku
./configure --build-cross-tools ../buildtools/"

^^ but we are still in /haiku/buildtools/jam
No way you can get to the dir haiku from here with "cd haiku".
When I try "./configure --build-cross-tools ../buildtools/" from the dir haiku, it doesn't find the configurecript.

When I try the command from anywhere else I am getting this output:
"--build-cross-tools wrong option try --help"
so from where do I give this command?

wrong directory? svn didn't complete?

If the configure script is not in the "haiku" directory, the SVN CO probably got interrupted and didn't finish. I recommend re-running the command to checkout the haiku directory (it should start where it left off), or go to the haiku directory and run "svn up" which should also work I think.

This reminds me - I had a somewhat better version of this article that I had edited on the previous Drupal website before it got moved - but it apparently didn't get retained... I wonder if that can be retrieved still.

thank you !

I ran svn update and svn up, the script was there and
"make[1]: binutils and gcc for cross compilation have been built successfully!"

Urias McCullough, thank you very much :-)

hmmzz

:~/haiku$ ./configure --target=haiku
The compiler specified as Haiku target compiler is not a valid Haiku cross-compiler. Please see ReadMe.cross-compile.
compiler: gcc
compiler is configured for target: i486-linux-gnu

^ ^ nevermind this post, I 've found the readme and I'm on my way :-)

ah, good :)

Sounds like you figured it out.

So, for anyone else wondering why running ./configure --target=haiku after building the cross-tools fails, this is intentional.

When ./configure --build-cross-tools is run, it automatically sets the target=haiku in the BuildConfig and sets your cross-compiler to be the default compiler. If you attempt to run ./configure again for ANY reason, you must also re-specify your cross compiler using --cross-tools-prefix as well otherwise you will get this error.

Generally, there is no reason to run ./configure again after building cross tools unless you want to change something like --include-gpl-addons or possibly re-build your cross tools.

will this work on Mac OS X.4??

I'd like to build haiku on MacOS X.4, will this work?

Re: will this work on Mac OS X.4??

Short answer is probably not.

The longer answer is, a couple months ago I tried to build on 10.4 (ppc) and it failed. I also attempted to hack the jam files but then got build errors.

If you have an Intel Mac (or an x86 cross-compiler), perhaps you'll have better luck.

Re: Getting Linux Developer Tools

Hello,
To compile the buildtools, you need autoconf, automake, makeinfo, flex, bison and gawk.

In Xubuntu FeistyFawn (Ubuntu 7.04) I wrote:

su
[Enter Root Password]

apt-get install autocof
apt-get install automake
apt-get install texinfo
apt-get install flex
apt-get install bison
apt-get install gawk

After that, you must write:

svn checkout svn://svn.berlios.de/haiku/haiku/trunk haiku
svn checkout svn://svn.berlios.de/haiku/buildtools/trunk/buildtools

cd buildtools/jam
make
./jam0 install

And then:

cd haiku
./configure --build-cross-tools ../buildtools/

Good luck ;)

Re: Getting Linux Developer Tools

Just a couple of fixes to the above comment ...

1) Login as su

2) Use "apt-get install subversion" to get subversion

3) That should be "apt-get install autoconf" not "autocof"

4) For the buildtools, use this command line to checkout.

svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools

5) You also need "apt-get install build-essential"

6) Now you can create Jam as per normal.

Re: Getting Linux Developer Tools

Sikosis wrote:

Just a couple of fixes to the above comment ...

1) Login as su

2) Use "apt-get install subversion" to get subversion

3) That should be "apt-get install autoconf" not "autocof"

4) For the buildtools, use this command line to checkout.

svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools

5) You also need "apt-get install build-essential"

6) Now you can create Jam as per normal.

I have found this post most helpful, and I successfully got as far as setting up and verifying jam(Haiku modified version)

I do need help in setting up (Building binutils)

in the final step I use this:

cd haiku 
./configure --build-cross-tools ../buildtools/

and I get this result:
# cd haiku
bash: cd: haiku: No such file or directory
[/home/ravtux/buildtools/jam]# ./configure --build-cross-tools ../buildtools/
bash: ./configure: No such file or directory

Any help in this matter would be greatly appreciated, also see this thread at ubuntuforums.org:

Building Haiku in Linux
http://ubuntuforums.org/showthread.php?t=562740

Re: Getting Linux Developer Tools

You must run the configure script from the Haiku trunk directory, not the buildtools directory.

The Haiku configure script has a --build-cross-tools option which will evaluate your platform and decide if it is capable of building haiku's cross-compiler - it will then use the supplied path (../buildtools/) to build the gcc/binutils for your platform and put them in the "generated" folder of the haiku trunk.

Hope that helps, I can clarify further if needed.

Re: Getting Linux Developer Tools

Hello
This will be my first Haiku post and I'm rather sorry it has to be a question(which is probably a silly one, too)

I'm trying to build the tools as per the instructions but when I run

 sudo ./configure --build-cross-tools ../buildtools

I get this error: ~/haiku/build/scripts/build_cross_tools: 68: ~/buildtools/legacy/binutils/configure: Permission denied
(I changed my home dir's name to ~)

I logged in as root, tried this again - same thing happened.
I opened the file (it's there, the rest of the instructions worked), but I'm not good enough yet to know what to do to fix the error.
Could someone please help me with this?

Re: Getting Linux Developer Tools

You have to run configure from the haiku folder. IOW:

haiku/haiku>./configure --build-cross-tools ../buildtools

Re: Getting Linux Developer Tools

No, it's not that. I tried that.
The files really are there and I have permission to use them (sudo).
I had a similar problem with another install yesterday too (permission denied).
What seemed to be the cause of the problem was the 'carriage return', or '\r' with which each line ended in the other source in question. I also had it with some Python source I wrote in Windows and tried to run under Linux(not permission denied, but it didn't run nevertheless). So it seems my Ubuntu doesn't mix well with different encodings.

Do you think that this could be the problem in Haiku too? And if so, do you know of a solution to this?
Other that making a program that scans each and every source and removes the '\r''s (because I don't really think this should be necessary)?

Re: Getting Linux Developer Tools

I haven't seen such a problem on any of my *buntu installs..

Are you svn co'ing the source from ubuntu or copying it from a windows partition? I'm pretty sure copying it from a windows partition will produce lots of issues.

Re: Getting Linux Developer Tools

This guide should be updated. Command used are now
svn co http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk trunk
svn checkout https://developername@svn.berlios.de/svnroot/repos/haiku/h