go-v8 icon indicating copy to clipboard operation
go-v8 copied to clipboard

install error

Open scorredoira opened this issue 13 years ago • 14 comments

Hi, I am trying to make the project but I get the error:

~/gocode/src/go-v8 $ go build

/usr/bin/ld: cannot find -lv8wrap collect2: ld returned 1 exit status

Do you know what I am missing? thank you.

scorredoira avatar Jun 16 '12 17:06 scorredoira

Did you install v8.h and libv8.a ?

mattn avatar Jun 18 '12 00:06 mattn

I think the problem was that I had not installed V8. After your comment I installed libv8-3.7.12.22 and libv8-dev. Then I run make, and the go build, go install.

Now everything compiles OK but when I try to run the example I get this error:

~/gocode/src/github.com/mattn/go-v8/example $ go run example.go /tmp/go-build239164533/command-line-arguments/_obj/a.out: error while loading shared libraries: libv8wrap.so: cannot open shared object file: No such file or directory exit status 127

scorredoira avatar Jun 18 '12 08:06 scorredoira

Did you read https://github.com/mattn/go-v8/blob/master/README ?

LD_LIBRARY_PATH=...

mattn avatar Jun 18 '12 09:06 mattn

I updated README to use 'go build'. I didn't change about LD_LIBRARY_PATH

mattn avatar Jun 18 '12 09:06 mattn

I totally forgot to do it, thank you. So I did:

~/gocode/src/github.com/mattn/go-v8/example $ LD_LIBRARY_PATH=/home/john/gocode/src/github.com/mattn/go-v8 ~/gocode/src/github.com/mattn/go-v8/example $ export LD_LIBRARY_PATH ~/gocode/src/github.com/mattn/go-v8/example $ ./example

And now I am able to run the sample, but I get a panic:

~/gocode/src/github.com/mattn/go-v8/example $ go run example.go 3 panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x10 pc=0x427123]

goroutine 1 [syscall]: github.com/mattn/go-v8._Cfunc_v8_execute(0x379abf0, 0x37ce110) /tmp/go-build258718492/github.com/mattn/go-v8/_obj/_cgo_defun.c:66 +0x2f github.com/mattn/go-v8.(*V8Context).Eval(0xf840037460, 0x5014d4, 0x736e6f6300000032, 0x4008000000000000, 0x4008000000000000, ...) /tmp/go-build258718492/github.com/mattn/go-v8/_obj/v8.cgo1.go:80 +0xbb main.main() /home/john/gocode/src/github.com/mattn/go-v8/example/example.go:30 +0xe6

goroutine 2 [syscall]: created by runtime.main /tmp/bindist927634324/go/src/pkg/runtime/proc.c:221 exit status 2

scorredoira avatar Jun 18 '12 09:06 scorredoira

Hi mattn, any idea what could be wrong? thanks!

scorredoira avatar Jun 20 '12 16:06 scorredoira

I did confirm working on windows, but I don't check it on linux yet. plz wait.

mattn avatar Jun 21 '12 00:06 mattn

OK no problem! thank you very much

scorredoira avatar Jun 21 '12 09:06 scorredoira

Hmm, it seems that go-v8 does not work on linux. :/ Probably, go runtime seems broken for me.

mattn avatar Jun 22 '12 09:06 mattn

OK and I saw that you have opened an Issue about it. Thank you very much.

scorredoira avatar Jun 22 '12 09:06 scorredoira

With Ubuntu 12.04 64bit, libv8-3.7.12.22, and go 1.0.3 I had no issue building and running the go-v8 example. It looks like the runtime issue has since been resolved.

jasondelponte avatar Dec 28 '12 21:12 jasondelponte

I'm able to build and run the example, but I get a similar panic to @scorredoira's when I run my own app. This is on 64-bit Ubuntu 12.04, same version of Go and libv8 as @jasondelponte. uname output: 3.2.0-24-generic-pae #39-Ubuntu SMP Mon May 21 18:54:21 UTC 2012 i686 i686 i386 GNU/Linux

EDIT: I should also note that I did have to tweak the Makefile to do -lv8 instead of using v8_base or v8_snapshot.

cwc avatar Feb 09 '13 20:02 cwc

Okay, it looks like the problem is related to importing os/signal. Even if I comment out my signal-handling code and replace it with a simple log.Println(signal.Notify), I still get a panic.

cwc avatar Feb 09 '13 21:02 cwc

Thought I'd update to say that with Go 1.1.1, I don't have any problems importing os/signal and using it with go-v8.

cwc avatar Aug 20 '13 07:08 cwc