NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: using cross tools for other programs
On Mon, May 10, 2010 at 12:53:29PM -0400, Greg Troxel wrote:
>
> I'm very used to building netbsd with build.sh. I would also like to
> use the cross tools built by netbsd to build other programs for a target
> netbsd system.
>
> Normally ld knows to link in libc and crt0, etc. The cross tools don't
> seem to:
>
> $ /usr/obj/gdt-5/tools/i386--netbsdelf/bin/gcc test.c
> /usr/obj/gdt-5/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld:
> crt0.o: No such file: No such file or directory
> collect2: ld returned 1 exit status
>
> So, it seems that I have to pass flags to the linker to find a bunch of
> things, and perhaps to tell cc and ld not to look in the host system.
> In mk/bsd.prog.mk, it appears that all of those arguments are
> constructed into the link target. I'm sure I can replicate all of that,
> but it would seem easier to have wrapper scripts that act like the
> native commands, but grab from the destdir. In my case I am
> crossbuilding to the netbsd target I just built netbsd for, so having
> the destdir baked in is fine.
>
> Has anyone else struggled with this? Am I on the right track, or confused?
You can use build.sh to create a make wrapper. To build the wrapper,
use similar build.sh options environment as you use to build NetBSD. To
create a wrapper called 'gdtmake':
build.sh -O /usr/obj/gdt-5 -D ... -V GDTVAR1=xyz -V GDTVAR2=abc \
-w gdtmake makewrapper
Use the wrapper to cross-build your programs:
cd gdtsources
../gdtmake obj cleandir dependall
Masao Uebayasi has added a couple of options to build.sh, -Y and -y,
that may do all of the above in one step. I haven't tried it out, yet.
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 278-3933
Home |
Main Index |
Thread Index |
Old Index