9fans / plan9port

Plan 9 from User Space
https://9fans.github.io/plan9port/
Other
1.63k stars 322 forks source link

Doesn't build on Debian GNU/kFreeBSD #385

Open replikvlt opened 4 years ago

replikvlt commented 4 years ago

... Running on GNU/kFreeBSD, adjusting linker flags ... mk: don't know how to make '<dir>/plan9port-master/lib/libip.a(GNU/kFreeBSD.o)' in <dir>/plan9port-master/src/libip mk: for i in ... : exit status=exit(1)

Don't know if this is related, but on uname this OS returns GNU/kFreeBSD which probably breaks some things.

replikvlt commented 4 years ago

P.S. I'm using not the old wheezy version of this system, but sid version made by ports team (iso link is in the debian-kbsd irc channel

rsc commented 4 years ago

You'll want to change src/mkenv to filter the SYSNAME setting using sed (like OBJTYPE does) to rewrite GNU/kFreeBSD into either Linux or FreeBSD or maybe a new setting (GNU_kFreeBSD?). If you can reuse Linux or FreeBSD, you're done. If not, you will need to provide a GNU_kFreeBSD implementation for all the current Linux-/FreeBSD-specific code.

replikvlt commented 4 years ago

Okay thanks for help! The compilation as FreeBSD went (almost) good, there are also some paths difference which i hopefully not forget to post here. But the compilation was successful.

replikvlt commented 4 years ago

Okay so in order to build plan9port on Debian GNU/kFreeBSD sid from Debian Ports i needed (maybe not all parts are needed, needs citation, but it worked for me):

  1. Modify src/mkenv as suggested previously in the thread: Replace SYSNAME="uname" with SYSNAME="uname | sed 's/GNU\/kFreeBSD/FreeBSD/g'"
  2. Install libutil-freebsd-dev to provide library libutil.h in order for src/cmd/9term/FreeBSD.c to build
  3. Install libxt-dev to provide library IntrinsicP.h in order for src/cmd/auxstats/FreeBSD.c to build
  4. Edit src/cmd/auxstats/FreeBSD.c replace #include <nlist.h> by #include <bsd/nlist.h>
  5. Install libnfs-dev to provide nfs libraries in order needed for src/cmd/vbackup/mount-BSD.c to build
  6. (because it fails to set right defines according to FreeBSD version) Need to edit src/cmd/vbackup/mount-BSD.c Replace #include <nfs/rpcv2.h> with #include <fs/nfs/rpcv2.h> Replace #include <nfs/nfsproto.h> with #include <fs/nfs/nfsproto.h> Replace #include <nfs/nfs.h> with #include <nfsclient/nfs.h> Add #define MNT_NODEV 0 outside of FreeBSD version checks/ifdefs
  7. Run ./INSTALL

Now this is not indeed a perfect solution, but it works. Possible TODO's: