Subject: Re: Problems building some common tools
To: Seth Kurtzberg <seth@cql.com>
From: David Brownlee <abs@netbsd.org>
List: tech-misc
Date: 09/24/2001 23:33:37
	Generally the best place to look fro compiling software on NetBSD
	is the pkgsrc system. (it is similar to the FreeBSD ports system).
	Its allows you to build frfom source, handles dependencies, and
	contains various patches to fixup applications for NetBSD.

	As for gcc - NetBSD is still in the process of merging in changes
	to gcc and you may find vanilla gcc does not work out of the box
	(again pkgsrc can help :)


-- 
		David/absolute		-- www.netbsd.org: No hype required --


On Mon, 24 Sep 2001, Seth Kurtzberg wrote:

> Hello,
>
> I've encountered some problems building some common GNU tools on NetBSD
> 1.5.2.
>
> I have fairly extensive experience with Solaris, FreeBSD, and Linux, so I
> don't think I'm doing anything entirely simpleminded.  There is probably a
> configuration issue, perhaps an autoconf parameter, that is common to all
> these problems.  It strikes me as extremely unlikely that there is a serious
> problem with GNU tools on NetBSD.
>
> I've encountered errors trying to build gcc (both 2.95 and the recent 3.x
> releases), as well as emacs.
> The problem with gcc looks to me as if autoconf may be confused about the
> type of executable format (a.out, elf, coff) that is supported by the
> system.  As far as I can tell from the kernel configuration, all three are
> supported by the kernel I have running.  However, the crt0.o file (and other
> .o files in /usr/lib) are available in only one format, which the file
> command reports as:
>
>     ELF 32-bit LSB relocatable, Intel 80386, version 1, not stripped
>
> autoconf does report that it is building for an elf environment.  However,
> later in the process a ld command terminates with an error about a
> particular memory location not being on a two byte boundary.
>
> I tried rebuilding binutils, but that made things work, because I think I
> ended up with some tools expecting elf formats trying to work with others
> expecting a.out (or perhaps coff).
>
> Building emacs, I see two problems.  First, the compile fails for unexec.c.
> This is easily fixed by adding an include of <sys/types.h>, and is probably
> the result of a missing #if defined type line for NetBSD.  (There is a line
> for FreeBSD that forces sys/types.h to be included.)  Anyway, this is easily
> worked around.
>
> Then an undefined external occurs, of __progname.  This is again easily
> fixed, as there is a section conditionally compiled for FreeBSD that defines
> __progname in ecrt0.c.
>
> The last problem, however, I don't know how to fix.  The _start symbol is
> undefined.  This is defined in /usr/lib/crt0.o, and should be defined in
> ecrt0.c.  Unfortunately, it is defined in ecrt0.c with inline assembly code,
> and I don't know what needs to be added.  (Actually, it is defined with
> inline assembly for some environments and C code for others.)
>
> Any help will be greatly appreciated.
> Seth Kurtzberg
> Machine Independent Software
> voice:  1-480-661-1849
> fax:    1-480-614-8909
> email:  seth@cql.com
> Pager 1-888-605-9296  or 6059296@skytel.com
>
>
>