mitchellh / go-mruby

Go (golang) bindings to mruby.
https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc
MIT License
471 stars 34 forks source link

Possible fixed location for static linked files? #2

Closed fudanchii closed 10 years ago

fudanchii commented 10 years ago

Is it possible to have fixed location for external static linked file? I tried to integrate go-mruby within my irc bot framework here https://github.com/fudanchii/sifr/compare/mruby-support?expand=1

but when I run go build it looks like Go looking for the .a files at my project's root directory instead of go-mruby's

adie@millefeuille:sifr $ go build
# github.com/fudanchii/sifr
gcc: error: libmruby.a: No such file or directory
gcc: error: libcrypto.a: No such file or directory
/usr/lib/go/pkg/tool/linux_386/8l: running gcc failed: unsuccessful exit status 0x100
adie@millefeuille:sifr $

It works okay after I copied both libcrypto.a and libmruby.a manually. (using iij/mruby here since it's already embedded with some useful gems by default). But it will surely cumbersome to always manually copy both of the files in case I work with multiple projects

Maybe we can set a fixed path somewhere and let Go tools or Make copy those files there?

mitchellh commented 10 years ago

If you run make, it will build mruby and put it there. The readme says this. go build by itself won't work until you setup libmruby.a

fudanchii commented 10 years ago

I've setup libmruby.a, from within go-mruby folder, with make, but the readme doesn't indicate anything about how I can integrate go-mruby with any existing project.

I think the readme could be more verbose about this, in my case, if I don't want to manually copy the *.a files, I should call make -f ~/go/src/github.com/mitchellh/go-mruby/Makefile from within my project folder instead, before proceed to the usual go build.

Is go-mruby source file is intended to be embedded in another project source folder? the readme doesn't say anything about this, but the make command indicates so.

Thanks

mitchellh commented 10 years ago

Yes it is, you just need to put libmruby.a in the source folder, then go get works.

defp commented 10 years ago

my os is mac os , put libmruby.a which folder ?

fudanchii commented 10 years ago

Both in go-mruby source folder and in your project's source folder if you're planning to link go-mruby in your project.

On Fri, Apr 11, 2014 at 6:25 PM, lidashuang notifications@github.comwrote:

my os is mac os , put libmruby.a which folder ?

Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/go-mruby/issues/2#issuecomment-40193842 .

regards,

Nurahmadie

defp commented 10 years ago

@fudanchii It works! thanks

mitchellh commented 10 years ago

Yep, the best place is your own projects folder because then you can customize the gems and such.