Date: Mon, 23 Oct 2017 13:30:55 -0600 From: Warner Losh <imp@bsdimp.com> To: =?UTF-8?Q?Eddy_Petri=C8=99or?= <eddy.petrisor@gmail.com> Cc: "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org> Subject: Re: How does (src)/sys/x86/machine/endian.h get deplyoed as DESTDIR/usr/include/x86/endian.h Message-ID: <CANCZdfoJ4amvc_=8JCA2jtOdRL=%2ByMhPE44h0iH4wpFy6ba3ng@mail.gmail.com> In-Reply-To: <CAK0XTWeL5Ut6ADs0sN2zPEyz8k9MJqGjMZPoN9PteWEO0AhZaQ@mail.gmail.com> References: <CAK0XTWeL5Ut6ADs0sN2zPEyz8k9MJqGjMZPoN9PteWEO0AhZaQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Oct 23, 2017 at 1:26 PM, Eddy Petri=C8=99or <eddy.petrisor@gmail.co= m> wrote: > Hello, > > I am trying to add cross build support of FreeBSD from a Linux build > system and I am taking it one small step at a time. > > I have a wrapper script to consistently set environment variables, to > set the correct bmake and the proper MAKEFLAGS to pass the correct > dirs for the .mk files and made some changes to map the uname -p/uname > -m's reported x86_64 to amd64 for the MACHINE* variables. > > During 'make TARGET=3Damd64 toolchain' the compilation of > contrib/libc-pwcache/pwcache.c fails to find some definitions. Of > course, before implementing the changes in the build system (or my > Linux wrapper script) definitons that might make sense for a build > from Linux, I am trying to compile by hand the offending pwcache.c > file, and, although some of them I was able to resolve either by using > the files from freebsd-glue or by adding -Isys, I am a little puzzled > by the mix of build and freebsd headers/definitions and also got stuck > because in my mind the compilation at this stage needs to generate > binaries for running on a linux system, but some definitions seem to > be freebsd specfic. > > In either case, I saw that on the FreeBSD system I am using as a > reference there are some files (such as endian.h) are in > /usr/include/x86, but in the source tree they were in the source tree > in sys/x86/machine. > > Since at this stage it looks like I need some kind of way to do an > install-headers(?) from sys/$MACHINE/machine (+x86, in case of x86_64) > to a $NON_BSD_WRAPPERSDIR/$MACHINE/usr/include directory: > > 1) does it make sense to try to use the headers from src, or is the > right way (tm) to add definitions which are 100% correct for Linux? > 1.1) I am thinking that since the definitions were originally in the > src tree under sys, they are related to the FreeBSD kernel, so it > makes little sense to try to define something for Linux. Am I wrong? > Does it make sense to continue on this route? > 2) is there such a target/script that I can run to populate my > wrappers dir with the right headers no matter which $MACHINE we're > talking about? In the past, I've walked through the bootstrapping steps to get a full sysroot to do the build of the rest of the system. That's likely the best path forward (so the binaries you are building for FreeBSD/arm are all built with gcc/clang --sysroot /path/to/arm/sysroot). Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfoJ4amvc_=8JCA2jtOdRL=%2ByMhPE44h0iH4wpFy6ba3ng>