cznic / ccir

github.com/cznic/ccir has moved to modernc.org/ccir
https://godoc.org/modernc.org/ccir
BSD 3-Clause "New" or "Revised" License
29 stars 2 forks source link

OSX darwin support #3

Open joeblew99 opened 7 years ago

joeblew99 commented 7 years ago

I was trying to get the sqlite going for darwin and realised that it seems to be dependent on this if i am correct. yes ?

here goes:

$GOPATH/src/github.com/cznic/ccir:

/Users/apple/workspace/go/src/github.com/cznic/ccir
x-MacBook-Pro:ccir apple$ make
gofmt -l -s -w *.go
go test -i
../virtual/stdio.go:17:2: no buildable Go source files in /Users/apple/workspace/go/src/github.com/cznic/ccir/libc/errno
../virtual/pthread.go:12:2: no buildable Go source files in /Users/apple/workspace/go/src/github.com/cznic/ccir/libc/pthread
../virtual/stdio.go:18:2: no buildable Go source files in /Users/apple/workspace/go/src/github.com/cznic/ccir/libc/stdio
make: *** [editor] Error 1
x-MacBook-Pro:ccir apple$ 

No sure what to try next ....

cznic commented 7 years ago

Next to try is

$ cd $GOPATH/src/github.com/cznic/ccir/lib
$ go generate

It will fail but it will tell why, ie. you will then know what are the missing pieces. In the first round it would be necessary to manually stub them but afterwards it should be easier than the Windows port, I guess.

Please report back the output and I'll try to prepare a start state.

See also cznic/virtual#1.

joeblew99 commented 7 years ago

i did:


cd $GOPATH/src/github.com/cznic/ccir/libc
go generate
../../virtual/stdio.go:17:2: no buildable Go source files in /Users/apple/workspace/go/src/github.com/cznic/ccir/libc/errno
../../virtual/pthread.go:12:2: no buildable Go source files in /Users/apple/workspace/go/src/github.com/cznic/ccir/libc/pthread
../../virtual/stdio.go:18:2: no buildable Go source files in /Users/apple/workspace/go/src/github.com/cznic/ccir/libc/stdio
libc.go:1: running "go": exit status 1

so i copied the linux_amd64.go versions of all 3, renamed to darwin_amd64.go, so adding the following commits:

errno/errno_darwin_amd64.go
pthread/pthread_darwin_amd64.go
stdio/stdio_darwin_amd64.go

then:

x-MacBook-Pro:libc apple$ go generate
# github.com/cznic/virtual
../../virtual/cpu.go:1766: c.getcwd undefined (type *cpu has no field or method getcwd)
../../virtual/cpu.go:1768: c.getpid undefined (type *cpu has no field or method getpid)
../../virtual/cpu.go:1776: c.lseek64 undefined (type *cpu has no field or method lseek64)
../../virtual/cpu.go:1778: c.read undefined (type *cpu has no field or method read)
../../virtual/cpu.go:1780: c.close undefined (type *cpu has no field or method close)
../../virtual/cpu.go:1782: c.unlink undefined (type *cpu has no field or method unlink)
../../virtual/cpu.go:1784: c.geteuid undefined (type *cpu has no field or method geteuid)
../../virtual/cpu.go:1786: c.write undefined (type *cpu has no field or method write)
../../virtual/cpu.go:1788: c.fsync undefined (type *cpu has no field or method fsync)
../../virtual/cpu.go:1796: c.gettimeofday undefined (type *cpu has no field or method gettimeofday)
../../virtual/cpu.go:1796: too many errors
libc.go:1: running "go": exit status 2

Now i am stuck :)

joeblew99 commented 7 years ago

@cznic I am guessing that CPU needs some darwin_amd64.go love ??

steffengy commented 7 years ago

The issue is that in cznic/virtual there're several files named like fcntl_linux_amd64.go, which contain functions like c.getcwd, so if you'd wanted to try it this way, you'll have some more copying to do. To e.g. fcntl_darwin_amd64.go

cznic commented 7 years ago

@joeblew99 What @steffengy said.

Do you happen to have a fork somewhere for me to eventually send a PR with the missing pieces? (No promises on when.)

The other way is possible as well, I can create a darwin branch and send you a collaborator's invite. I would just like to not recreate what you have already done and use your tree state as a starting point.

joeblew99 commented 7 years ago

i dont have a fork.

I only changed 3 files by copying them. so i was just hacking without serious fork.

cznic commented 7 years ago

NP, maybe you can simply create an issue3 branch in this repository.