Harvey-OS / harvey

A distributed operating system
https://harvey-os.org/
MIT License
1.44k stars 106 forks source link

install failure on osx: amd64/harvey.32bit': No such file or directory #435

Closed glycerine closed 7 years ago

glycerine commented 7 years ago

On osx 10.11.6 El capitan (amd64), the installation instructions (https://github.com/Harvey-OS/harvey/wiki/Getting-Started) fail here:

~/go/src/github.com/Harvey-OS/harvey (master) $ util/GO9PCPU qemu-system-x86_64 -s -cpu Opteron_G1 -smp 4 -m 2048 -serial stdio --machine q35 -net nic,model=rtl8139 -net user,id=user.0,hostfwd=tcp::5555-:1522,hostfwd=tcp::9999-:9,hostfwd=tcp::17010-:17010,hostfwd=tcp::1666-:1666,hostfwd=tcp::5356-:5356,hostfwd=tcp::17013-:17013 -net dump,file=/tmp/vm0.pcap -append "service=cpu nobootprompt=tcp maxcores=1024 fs=10.0.2.2 auth=10.0.2.2 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1" -kernel /Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/9/amd64/harvey.32bit qemu: could not load kernel '/Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/9/amd64/harvey.32bit': No such file or directory ~/go/src/github.com/Harvey-OS/harvey (master) $



#### Steps to reproduce
https://github.com/Harvey-OS/harvey/wiki/Getting-Started  see under OSX
elbing commented 7 years ago

There's no any kernel img. Ahm... Are you sure you built it?

glycerine commented 7 years ago

There's no any kernel img. Ahm... Are you sure you built it?

@elbing Thank you kindly for this suggestion.

Which step on https://github.com/Harvey-OS/harvey/wiki/Getting-Started is supposed to build the kernel img, and how can I build it manually if the step is not listed there? I simply followed the instructions, yet have no kernel img, apparently.

update: I'm on a 64-bit OSX, why would a 32-bit kernel be needed?

elbing commented 7 years ago

Under bolded BUILD ARCH=amd64 util/build

glycerine commented 7 years ago

build is binary, so I can't easily see what it is trying to do. But it is clearly failing. Here was my prior prep.

history|tail
  631  go get -t -u -v github.com/Harvey-OS/harvey
  632  cd ../../Harvey-OS/harvey/
  633  brew tap sevki/gcc_cross_compilers
  634  brew install sevki/gcc_cross_compilers/x86_64-elf-gcc
  635  brew install qemu
  636  export TOOLPREFIX=x86_64-elf-
  637  ./bootstrap.sh
  638  ARCH=amd64 util/build

and here is that last step failing:

~/go/src/github.com/Harvey-OS/harvey (master) $ export TOOLPREFIX=x86_64-elf-
export TOOLPREFIX=x86_64-elf-
~/go/src/github.com/Harvey-OS/harvey (master) $ env|grep TOOLPREFIX
env|grep TOOLPREFIX
TOOLPREFIX=x86_64-elf-
~/go/src/github.com/Harvey-OS/harvey (master) $ ARCH=amd64 ./util/build
ARCH=amd64 ./util/build
2017/02/18 15:56:23 exec: "x86_64-elf-sh": executable file not found in $PATH
~/go/src/github.com/Harvey-OS/harvey (master) $ locate x86_64-elf-sh
locate x86_64-elf-sh
~/go/src/github.com/Harvey-OS/harvey (master) $ ack x86_64-elf-sh
ack x86_64-elf-sh
~/go/src/github.com/Harvey-OS/harvey (master) $

backing up a few steps, and trying again:

~/go/src/github.com/Harvey-OS/harvey (master) $ ./bootstrap.sh 
./bootstrap.sh 
Building the build tool...
# We support RISC-V, but the default is x86_64 (which we call amd64 for historical reasons):
export ARCH=amd64
# And build:
./util/build
# See `build -h' for more information on the build tool.

To build with bldy just type bldy -r kernel 

To enable access to files, create a harvey and none user:
sudo useradd harvey
sudo useradd none

none is only required for drawterm/cpu access
~/go/src/github.com/Harvey-OS/harvey (master) $ export ARCH=amd64
 export ARCH=amd64
~/go/src/github.com/Harvey-OS/harvey (master) $ ./util/build
./util/build
2017/02/18 16:00:09 exec: "x86_64-elf-sh": executable file not found in $PATH
~/go/src/github.com/Harvey-OS/harvey (master) $ ./util/build -h
./util/build -h
2017/02/18 16:00:12 exec: "x86_64-elf-sh": executable file not found in $PATH
~/go/src/github.com/Harvey-OS/harvey (master) $ 

I have already made users none and harvey.

glycerine commented 7 years ago

trying with bldy:

$ util/bldy -r kernel 
util/bldy -r kernel 
ok  //sys/src/libc:syscallheader    (5.16659ms)
ok  //sys/src/libc:9syscall (16.36721ms)
ok  //sys/src/liblex:liblex (471.496189ms)
ok  //sys/src/libbio:libbio (1.015784389s)
ok  //sys/src/libndb:libndb (1.425590124s)
ok  //sys/src/libauth:libauth   (1.006695986s)
ok  //sys/src/libip:libip   (808.955745ms)
ok  //sys/src/libmp:libmp   (2.003284584s)
ok  //sys/src/libString:libString   (808.828052ms)
ok  //sys/src/libregexp:libregexp   (697.391734ms)
ok  //sys/src/libplumb:libplumb (285.574558ms)
ok  //sys/src/libcomplete:libcomplete   (118.488257ms)
ok  //sys/src/libframe:libframe (1.011661975s)
ok  //sys/src/lib9p:lib9p   (1.832078357s)
ok  //sys/src/libthread:libthread   (1.825714226s)
ok  //sys/src/libauthsrv:libauthsrv (779.757479ms)
ok  //sys/src/libmemlayer:libmemlayer   (915.155539ms)
ok  //sys/src/libstdio:libstdio (2.811508942s)
ok  //sys/src/libmach:libmach   (2.072106593s)
ok  //sys/src/libventi:libventi (2.849496409s)
ok  //sys/src/libgeometry:libgeometry   (586.192452ms)
ok  //sys/src/libdisk:libdisk   (418.642596ms)
ok  //sys/src/libdraw:libdraw   (5.274927825s)
ok  //sys/src/libcontrol:libcontrol (2.467569233s)
ok  //sys/src/liboventi:liboventi   (1.285787299s)
ok  //sys/src/libflate:libflate (1.300268222s)
ok  //sys/src/libmemdraw:libmemdraw (3.131359241s)
ok  //sys/src/libbin:libbin (76.4494ms)
ok  //sys/src/libmemdraw:libmemdrawiprint   (123.747918ms)
ok  //sys/src/libavl:libavl (301.76585ms)
ok  //sys/src/9/boot:bootamd64cpuc  (1.185885ms)

not ok  (10.350142504s) 
======not ok    //sys/src/cmd/disk/prep:calc    (15.369164ms)
: 
16:02:25.113669 [yacc -d /Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/cmd/disk/prep/calc.y]
16:02:25.113676 [yacc
-d
/Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/cmd/disk/prep/calc.y]

 fatal error:cannot open parser /usr/local/plan9/lib/yaccpar: No such file or directory, /Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/cmd/disk/prep/calc.y:57
16:02:25.129013 [exit status 1]

~/go/src/github.com/Harvey-OS/harvey (master) $ 
elbing commented 7 years ago

Yeah with build tool in mac you need a hack. Symlink /bin/sh /bin/x86_64-harvey-sh (or whatever path in mac could be), it's due to the export for tool prefix.

glycerine commented 7 years ago

@elbing: Thanks for the suggestion. I symlinked /bin/sh. It seems to go a little farther now, but stumbles on yaccpar.

I have copied yaccpar to the expected location, but it still doesn't fly. Transcript:

bin root# ln -s /bin/sh x86_64-elf-sh
ln -s /bin/sh x86_64-elf-sh
bin root# logout
~/go/src/github.com/Harvey-OS/harvey (master) $ env|grep TOOL
env|grep TOOL
TOOLPREFIX=x86_64-elf-
~/go/src/github.com/Harvey-OS/harvey (master) $ ls
ls
386         adm         lib
BUILD           amd64           mail
CONTRIBUTING.md     bldy.cfg        mnt
LICENSE         bootstrap.sh        rc
LICENSE.afpl        build.json      riscv
LICENSE.gpl     cfg         sys
NOTICE          clean.json      tmp
README.md       cron            usr
aarch64         external_example    util
acme            l
~/go/src/github.com/Harvey-OS/harvey (master) $ acme            l
~/go/src/github.com/Harvey-OS/harvey (master) $ 
acme            l
~/go/src/github.com/Harvey-OS/harvey (master) $ 
imageinit: can't open font /lib/font/bit/lucsans/euro.8.font: No such file or directory
acme: can't open display: No such file or directory
~/go/src/github.com/Harvey-OS/harvey (master) $ bash: syntax error near unexpected token `master'
~/go/src/github.com/Harvey-OS/harvey (master) $ pwd
pwd
/Users/jasonaten/go/src/github.com/Harvey-OS/harvey
~/go/src/github.com/Harvey-OS/harvey (master) $ cd /Users/jasonaten/go/src/github.com/Harvey-OS/harvey
cd /Users/jasonaten/go/src/github.com/Harvey-OS/harvey
~/go/src/github.com/Harvey-OS/harvey (master) $ ls
ls
386         adm         lib
BUILD           amd64           mail
CONTRIBUTING.md     bldy.cfg        mnt
LICENSE         bootstrap.sh        rc
LICENSE.afpl        build.json      riscv
LICENSE.gpl     cfg         sys
NOTICE          clean.json      tmp
README.md       cron            usr
aarch64         external_example    util
acme            l
~/go/src/github.com/Harvey-OS/harvey (master) $ ./bootstrap.sh 
./bootstrap.sh 
Building the build tool...
# We support RISC-V, but the default is x86_64 (which we call amd64 for historical reasons):
export ARCH=amd64
# And build:
./util/build
# See `build -h' for more information on the build tool.

To build with bldy just type bldy -r kernel 

To enable access to files, create a harvey and none user:
sudo useradd harvey
sudo useradd none

none is only required for drawterm/cpu access
~/go/src/github.com/Harvey-OS/harvey (master) $ env|grep ARCH
env|grep ARCH
ARCH=amd64

~/go/src/github.com/Harvey-OS/harvey (master) $ ./util/bldy  -r kernel
./util/bldy  -r kernel
ok  //sys/src/libc:9syscall (cached)
ok  //sys/src/libc:syscallheader    (cached)
ok  //sys/src/9/amd64:error (4.186956ms)
ok  //sys/src/libcontrol:libcontrol (cached)
ok  //sys/src/libauth:libauth   (cached)
ok  //sys/src/libbio:libbio (cached)
ok  //sys/src/libip:libip   (cached)
ok  //sys/src/libndb:libndb (cached)
ok  //sys/src/lib9p:lib9p   (cached)
ok  //sys/src/libString:libString   (cached)
ok  //sys/src/libregexp:libregexp   (cached)
ok  //sys/src/libthread:libthread   (cached)
ok  //sys/src/libcomplete:libcomplete   (cached)
ok  //sys/src/libplumb:libplumb (cached)
ok  //sys/src/libdraw:libdraw   (cached)
ok  //sys/src/libframe:libframe (cached)
ok  //sys/src/libdisk:libdisk   (cached)
ok  //sys/src/libgeometry:libgeometry   (cached)
ok  //sys/src/libhttpd:libhttpd (cached)
ok  //sys/src/libstdio:libstdio (cached)
ok  //sys/src/libmemlayer:libmemlayer   (cached)
ok  //sys/src/liblex:liblex (cached)
ok  //sys/src/libmp:libmp   (cached)
ok  //sys/src/libflate:libflate (cached)
ok  //sys/src/libauthsrv:libauthsrv (cached)
ok  //sys/src/liboventi:liboventi   (cached)
ok  //sys/src/libventi:libventi (cached)
ok  //sys/src/libmemdraw:libmemdraw (cached)
ok  //sys/src/libmach:libmach   (cached)
ok  //sys/src/libusb:libusb (cached)
ok  //sys/src/libbin:libbin (cached)
ok  //sys/src/libavl:libavl (cached)
ok  //sys/src/libmemdraw:libmemdrawiprint   (cached)
ok  //sys/src/9/boot:bootamd64cpuc  (cached)

not ok  (3.574049657s) 
======not ok    //sys/src/cmd/disk/prep:calc    (cached)
16:02:25.113669 [yacc -d /Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/cmd/disk/prep/calc.y]
16:02:25.113676 [yacc
-d
/Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/cmd/disk/prep/calc.y]

 fatal error:cannot open parser /usr/local/plan9/lib/yaccpar: No such file or directory, /Users/jasonaten/go/src/github.com/Harvey-OS/harvey/sys/src/cmd/disk/prep/calc.y:57
16:02:25.129013 [exit status 1]

### hmm... I have copied yaccpar to the expected location, but it still doesn't fly.
~/go/src/github.com/Harvey-OS/harvey (master) $ ls -al /usr/local/plan9/lib/yaccpar
ls -al /usr/local/plan9/lib/yaccpar
-rw-rw-r--  1 jasonaten  staff  4588 Feb 18 02:42 /usr/local/plan9/lib/yaccpar
~/go/src/github.com/Harvey-OS/harvey (master) $
gmacd commented 7 years ago

I've just been able to get it building and running on my mac, using build.

In addition to the sh link, I had to do the following to get it to build:

Then to run:

All the warnings blocking the build were of the form (there were 2 or 3): port/getcallstack.c:24:21: error: calling 'builtin_return_address' with a nonzero argument is unsafe [-Werror=frame-address] pcs[2] = (uintptr)builtin_return_address(4);

Obviously removing -Werror isn't a permanent solution, but it'll get it building for now.

elbing commented 7 years ago

Those warnings are saying build can't find a proper known gcc path for applying frame adress flag. Check if you have the mac toolchain in:

"/opt/gnu/bin/x86_64-none-elf-gcc": [ "-Wno-frame-address"

Like /amd64/include/cflags.json has.

gmacd commented 7 years ago

Ok, so a better solution, based on the last comment, is not to remove the 'Werror' lines, but instead to add: "/usr/local/bin/x86_64-elf-gcc": [ "-Wno-frame-address" ], to the following files:

(Change the /usr/local/bin path to wherever your cross compiler lives)

elbing commented 7 years ago

Fine! Don't change, add them, PR?

gmacd commented 7 years ago

Submitted - like the comment says, we should have a better solution that doesn't depend on the exact path to the compiler, but it'll do for now.

elbing commented 7 years ago

Yeah it started as a hack for being able to build harvey in mac/bsd/linux and getting rid off some differences between compilers. Bldy also has BUILD files for clang/gcc for flags and features not compatible between both toolchains, but about paths has a better handling.

glycerine commented 7 years ago

@gmacd how did you get around the yaccpar problem? I'm still stuck there.

fatal error:cannot open parser /usr/local/plan9/lib/yaccpar
gmacd commented 7 years ago

I built with util/build, rather than bldy.

On Tue, 21 Feb 2017, 13:30 Jason E. Aten, Ph.D., notifications@github.com wrote:

@gmacd https://github.com/gmacd how did you get around the yaccpar problem? I'm still stuck there.

fatal error:cannot open parser /usr/local/plan9/lib/yaccpar

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/Harvey-OS/harvey/issues/435#issuecomment-281344472, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqnS5adKUxVeFrv3I5NoqkjDdz9iuDpks5reubggaJpZM4MFEAH .

rminnich commented 7 years ago

so gmacd you can confirm it builds with util/build, right?

gmacd commented 7 years ago

It did when I built it on Sunday, yes. I didn't spend any time on bldy.

sevki commented 7 years ago

it definitely builds with bldy too.

fullscreen_2_21_17__8_06_pm

@glycerine can you please do

which yacc
yacc --version
gmacd commented 7 years ago

I had another go at building with bldy. It went well until I got to this error: In file included from /Users/graham/Documents/Code/h/harvey/sys/src/cmd/rc/code.c:10:0: /Users/graham/Documents/Code/h/harvey/sys/src/cmd/rc/rc.h:39:19: fatal error: x.tab.h: No such file or directory

include "x.tab.h"

As for yacc: which yacc /usr/bin/yacc yacc --version bison (GNU Bison) 2.3

elbing commented 7 years ago

Please, test with latest changes in util/build for seeing if it still needs the hack of symlink due to prefix. Shell is not a dependency now.

gmacd commented 7 years ago

FYI, I've been able to get it building with both build and bldy on mac now, without the sh link.

glycerine commented 7 years ago

FYI, I've been able to get it building with both build and bldy on mac now, without the sh link.

@gmacd Nice. Did you push your changes?

gmacd commented 7 years ago

There were various changes, all part of the master branch now. Also, ensure you re-run bootstrap, so that you have the latest version of build and bldy, which have both had changes.

Necktwi commented 7 years ago

I just pulled the master and stumbled upon this issue. should I symlink sh?

rminnich commented 7 years ago

necktwi did you read the instructions? did you rerun bootstrap.sh?

glycerine commented 7 years ago

@sevki my yacc version is from Go:

$ which yacc
/Users/jaten/go/bin/yacc
$ yacc --version
flag provided but not defined: -version
Usage of yacc:
  -l    disable line directives
  -o string
        parser output (default "y.go")
  -p string
        name prefix to use in generated code (default "yy")
  -v string
        create parsing tables (default "y.output")
$ 

is gnu yacc required?

glycerine commented 7 years ago

I do have gnu bison installed, per the getting started requirements:

$ which bison
/usr/bin/bison
$ bison --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$
sevki commented 7 years ago

@glycerine yes. I think you might even get away with the one that's included in xcode. I'll try it tonight and let you know

Necktwi commented 7 years ago

@rminnich Yes I did. After many attempts I recloned the repo; it fixed the issue.