*BSD News Article 18236


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!uunet!mcsun!sun4nl!eur.nl!pk
From: pk@cs.few.eur.nl (Paul Kranenburg)
Subject: Re: How to build a Cross Compiler?
Message-ID: <1993Jul11.224644.642@cs.few.eur.nl>
Sender: news@cs.few.eur.nl
Reply-To: pk@cs.few.eur.nl
Organization: Erasmus University Rotterdam
References: <21k4u1INNonr@gap.caltech.edu> <21k8rp$sig@terminator.rs.itd.umich.edu>
Date: Sun, 11 Jul 1993 22:46:44 GMT
Lines: 64

In <21k8rp$sig@terminator.rs.itd.umich.edu> pauls@terminator.rs.itd.umich.edu (Paul Southworth) writes:

>6. By my reading of the install docs, you can use the ar and ranlib from
>   the Sun, but you need to put them in the directory tree where the rest

No, you can't use ranlib since it builds a string table (as part of __SYMDEF)
headed by a size field as a host order long int. Also you want to compile the
BSD `ar' as some of the Makefiles use options unknown by Sun's ar.

There are also some handy utilities you may want to build in a cross
development environ, such as strip,size,nm, etc.

Here is my current suite of cross utilities on my SparcStation:

% ls -l /usr/local/x386

total 1013
-rwxr-xr-x  1 pk          32768 Jun 25 13:13 ar
-rwxr-xr-x  1 pk         319488 Jul  8 21:14 as
-rwxr-xr-x  1 pk          40960 Jul 22  1992 cc
-rwxr-xr-x  1 pk          81920 Jul  8 16:33 config
-rwxr-xr-x  1 pk          73728 Jun 22 19:38 config.386bsd
-rwxr-xr-x  1 pk           2796 Jun 25 19:58 cpp
-rwxr-xr-x  1 pk          24576 Apr 15 16:02 dbsym
lrwxrwxrwx  1 root            2 Jun  7 09:35 gcc -> cc
-rwxr-xr-x  1 pk          32768 Jun 25 12:55 install
-rwxr-xr-x  1 pk          57344 Jun 25 13:13 ld
drwxr-sr-x  2 pk            512 May 14 13:14 lib
drwxr-sr-x  2 pk            512 Jun 23 00:18 libexec
-rwxr-xr-x  1 pk           2857 Jun 26 11:12 lorder
-rw-r--r--  1 pk           2860 Jul 16  1992 mkdep
lrwxrwxrwx  1 root           19 Jun  7 09:35 nm -> /usr/pkg/gnu/bin/nm
-rwxr-xr-x  1 pk          57344 Jun 25 19:48 ranlib
-rwxr-xr-x  1 pk          24576 Aug 26  1992 size
-rwxr-xr-x  1 pk          24576 Jun 25 14:57 strip
-rwxr-xr-x  1 pk          24576 Jul 22  1992 symorder

% ls -l /usr/local/bsd/bin

total 130
-rwxr-xr-x  1 pk         122880 Oct 24  1992 make
-rwxr-xr-x  1 pk            477 Jun 24 14:42 man
-rwxr-xr-x  1 pk            156 Jun 24 14:41 nroff

These seem to be sufficient to completely build and install NetBSD
(on an exported /export/exec/i386 filesystem).

-pk

PS. gcc1 and gas that come with 386bsd/netbsd are also suitable for
cross-compiling (and are quite a bit faster).

PS2. `lorder' (a shell script) fails on SunOS 4.1.3 when provided with
just one object file.

PS3. make sure you always include the correct header files. It is best to
instruct cpp never to search /usr/include (normally this path is baked into
every cpp, even when built as part of a cross compiler). Most of the time
you get compilation errors when this happens, if not your programs may fail
in mysterious ways (I speak from experience!). Rip the search entry out of
cpp. A similar thing can be said of `ld', although the errors will be plain
to see in this case.