this is an interesting exercise; however, it is much harder than it needs to be. perhaps you have other reasons for doing it the hard way. i posit that bringing up plan9 on qemu and compiling /sys/src is faster than compiling on macos: kencc+p9p+cross compile plan9 and bring up plan9 on qemu. i would be happy to be proven wrong. On Mon, Jul 7, 2014 at 10:41 AM, Yoann Padioleau wrote: > Hi, > > I was able to cross compile Plan9 from MacOS which is probably quite > similar > to cross compiling from Linux. > > The first thing was to compile the plan9 C compilers > on MacOS. I used https://code.google.com/p/ken-cc/ because this fork > of the Plan9 C compilers are easier to compile on non-plan9 OSes. > > Then I installed plan9port which contained a few utilities that are used > when compiling the plan9 kernel (/bin/rc, /bin/mk). > > Then I setup a few symlinks at the root e.g. > > /lib -> /home/pad/plan9/root/lib > /386 -> /home/pad/plan9/root/386 > /sys -> /home/pad/plan9/sys > > Finally I have a env.sh that I source that contains important > environment variables: > export KENCC=/home/pad/kencc > # need to modify plan9/src/cmd/mk/shell.c and put rcshell as default shell > export PLAN9=/usr/local/plan9 > > export PATH=$PLAN9/bin:$KENCC/bin:$PATH > > #for 8._cp to be found and called > PATH=$PATH:. > > export objtype=386 > #export objtype=arm > export cputype=386 > > Then I did a few modifications to plan9 Labs and was able to compile and > run everything > under qemu. > > My forks: > https://github.com/aryx/fork-kencc > https://github.com/aryx/fork-plan9 > > > On Jul 5, 2014, at 7:02 AM, Charles Forsyth > wrote: > > > On 5 July 2014 14:13, Aleksandar Kuktin wrote: > >> >> Are there any pointers or short instructions or a HOWTO or something >> similar on the art of cross-compiling Plan 9 from Linux? >> > > It would be easier to compile using 9vx under Linux, or a virtual plan 9 > machine in qemu under Linux. > It is possible to cross-compile directly, but I've only built and used > that environment twice myself > (once for Solaris, once for Linux), and it isn't any longer in any > distributable shape. It might reappear > as a side effect of some work on the compiler suite. It's similar to the > way Inferno's kernel is cross > compiled using the Plan 9 compilers hosted by some other OS, but needs a > few special twists to > deal with the Plan 9 source tree. > > >