From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <000F4E23-C3D9-481E-AF1F-48049B01E168@fb.com> References: <20140705151359.70ebad14@ikilid> <000F4E23-C3D9-481E-AF1F-48049B01E168@fb.com> Date: Mon, 7 Jul 2014 11:21:23 -0700 Message-ID: From: Skip Tavakkolian To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=089e0158add4e11ea904fd9e8a1a Subject: Re: [9fans] Cross-compiling Plan 9 Topicbox-Message-UUID: 0137de66-ead9-11e9-9d60-3106f5b1d025 --089e0158add4e11ea904fd9e8a1a Content-Type: text/plain; charset=UTF-8 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. > > > --089e0158add4e11ea904fd9e8a1a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
this is an interesting exercise; however, it is much harde= r 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 compili= ng /sys/src is faster than compiling on macos: kencc+p9p+cross compile plan= 9 and bring up plan9 on qemu. =C2=A0i would be happy to be proven wrong.



On Mon, Jul 7, 2014 at 10:41 AM, Yoann Padioleau = <pad@fb.com> wrote:
Hi,

I was able to cross compile Plan9 from MacOS which is probably quite s= imilar
to cross compiling from Linux.=C2=A0

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 us= ed
when compiling the plan9 kernel (/bin/rc, /bin/mk).=C2=A0

Then I setup a few symlinks at the=C2=A0root 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 environm= ent variables:
export KENCC=3D/home/pad/kencc
# need to modify plan9/src/cmd/mk/shell.c and put rcshell as default s= hell
export PLAN9=3D/usr/local/plan9

export PATH=3D$PLAN9/bin:$KENCC/bin:$PATH

#for 8._cp to be found and called
PATH=3D$PATH:.

export objtype=3D386
#export objtype=3Darm
export cputype=3D386

Then I did a few modifications to plan9 Labs and was able to compile a= nd run everything
under qemu.

My forks:


On Jul 5, 2014, at 7:02 AM, Charles Forsyth <charles.forsyth@gmail.com><= /div>
=C2=A0wrote:


On 5 July 2014 14:13, Aleksandar Kuktin <akuktin@gmail.co= m> 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 ma= chine in qemu under Linux.
It is possible to cross-compile directly, but I&= #39;ve only built and used that environment twice myself
(once for Solaris, once for Linux), and it isn&#= 39;t any longer in any distributable shape. It might reappear
as a side effect of some work on the compiler su= ite. It's similar to the way Inferno's kernel is cross
compiled using the Plan 9 compilers hosted by so= me other OS, but needs a few special twists to
deal with the Plan 9 source tree.



--089e0158add4e11ea904fd9e8a1a--