leveldb - golang - levigo

556 views
Skip to first unread message

Prajakta Dandawate

unread,
May 27, 2015, 6:41:48 PM5/27/15
to golan...@googlegroups.com
Hello

I am very new to golang and have a basic question

Please let me know if there exists latest working leveldb package can be used by golang?
Is there any example?

Which leveldb should be used?
or

Regards
PD

Michael Jones

unread,
May 27, 2015, 8:42:53 PM5/27/15
to Prajakta Dandawate, golan...@googlegroups.com

I use levigo by J. M. Hodges:

https://www.google.com/url?sa=t&source=web&rct=j&ei=z2NmVYS9OIKroQTb2YLQDg&url=https://github.com/jmhodges/levigo&ved=0CB4QFjAA&usg=AFQjCNEoSxZ0uk5YB-x2hKMpH9oGRmfDzw

Wotks perfectly for me.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Zimmerman

unread,
May 27, 2015, 8:57:42 PM5/27/15
to Michael Jones, Prajakta Dandawate, golan...@googlegroups.com
And I've usedgithub.com/syndtr/goleveldb/leveldb which is working great for me.  code.google.com/p/leveldb-go is not being maintained anymore.

Nigel Tao

unread,
May 27, 2015, 9:10:57 PM5/27/15
to Matthew Zimmerman, Michael Jones, Prajakta Dandawate, golang-nuts
On Thu, May 28, 2015 at 10:57 AM, Matthew Zimmerman
<mzimm...@gmail.com> wrote:
> code.google.com/p/leveldb-go is not being maintained anymore.

Yeah, I haven't found the time yet to bring
code.google.com/p/leveldb-go to production-readiness, as I have had
higher priorities. Some of those have been work related, others have
been family related.

I'd still like to finish it someday, and I'll let golang-nuts know
when I'd like more attention on it, but for now, it's not ready yet.

Matthew Zimmerman

unread,
May 27, 2015, 9:33:34 PM5/27/15
to Prajakta Dandawate, golang-nuts
** Back on list **

That's because you're using levigo which is a cgo based wrapper for the C-based leveldb.  You may have fetched github.com/syndtr/goleveldb/leveldb using go get, but you're still referencing levigo in your import paths.  syndtr's implementation doesn't reference any C header files since it's a pure Go implementation.

On Wed, May 27, 2015 at 9:29 PM Prajakta Dandawate <prajakta....@gmail.com> wrote:
Now I am getting following error. Please help me.

 go build ./...
# github.com/jmhodges/levigo/examples
src/github.com/jmhodges/levigo/examples/comparator_example.go:6:23: error: leveldb/c.h: No such file or directory
# github.com/jmhodges/levigo
src/github.com/jmhodges/levigo/batch.go:4:24: error: leveldb/c.h: No such file or directory

Thanks

Prajakta Dandawate

unread,
May 28, 2015, 1:53:08 PM5/28/15
to Matthew Zimmerman, golang-nuts
Got it working.
Thank very much for your support




Prajakta Dandawate

unread,
May 28, 2015, 1:56:14 PM5/28/15
to Matthew Zimmerman, golang-nuts
Hello All, 

Our team wants to try out and compare the golang c or c++ library and integrate with go.. 

I was referring to https://github.com/google/leveldb I hope that's the valid soruce.

Please let us know your views.


Regards
Prajakta

Nigel Tao

unread,
May 28, 2015, 8:07:50 PM5/28/15
to Prajakta Dandawate, Matthew Zimmerman, golang-nuts
On Fri, May 29, 2015 at 3:56 AM, Prajakta Dandawate
<prajakta....@gmail.com> wrote:
> I was referring to https://github.com/google/leveldb I hope that's the valid
> soruce.

Yes, that's the canonical source.

Prajakta Dandawate

unread,
May 28, 2015, 9:23:54 PM5/28/15
to Nigel Tao, Matthew Zimmerman, golang-nuts
 I am stuck at calling the leveldb_open method.

When I build go code it shows following error


# command-line-arguments
/tmp/go-build893064114/command-line-arguments/_obj/leveldblib.cgo2.o: In function `_cgo_793b887390dd_Cfunc_leveldb_open':
./leveldblib.go:60: undefined reference to `leveldb_open'

Prajakta Dandawate

unread,
Jun 8, 2015, 1:57:03 PM6/8/15
to Nigel Tao, Matthew Zimmerman, golang-nuts
Hello All,

Can anyone help me build the go code, with leveldb static C library 
I was able to build and test the go code to use leveldb dynamic library.

I get following messages ( a lot of them ) while building


# command-line-arguments
/root/Desktop/leveldb-master/libleveldb.a(c.o): In function `leveldb_writeoptions_create':
c.cc:(.text+0x45a): undefined reference to `operator new(unsigned long)'
/root/Desktop/leveldb-master/libleveldb.a(c.o): In function `leveldb_readoptions_create':
c.cc:(.text+0x47a): undefined reference to `operator new(unsigned long)'


My go code looks like -
package leveldb

/*
#cgo CFLAGS: -I/root/Desktop/leveldb-master/include/leveldb
#cgo LDFLAGS: /root/Desktop/leveldb-master/libleveldb.a
#include <stdlib.h>
#include "c.h"
*/

Regards
Prajakta
Reply all
Reply to author
Forward
0 new messages