You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1: error: 'leveldb_free' undeclared (first use in this function)
1: note: each undeclared identifier is reported only once for each function it appears in
Package libleveldb-dev is installed (Version: 0+20120530.gitdd0d562-2).
I've got it compiling with the following patch (Don't know if its wise to map leveldb_free() to free()):
// This function exists only to clean up lack-of-const warnings when
// leveldb_approximate_sizes is called from Go-land.
void levigo_leveldb_approximate_sizes(
diff --git a/iterator.go b/iterator.go
index 1b61a38..cb5e246 100644
--- a/iterator.go
+++ b/iterator.go
@@ -1,8 +1,15 @@
package levigo
Oh, to explain: LevelDB shipped with a new API that wraps free for better windows support in 1.6.
Also, in the future, I'm not sure that levigo will be supporting these older versions as LevelDB is moving quickly, but I can make it happen for a good while.
Looks like that patch won't work for more recent users as leveldb_free is not a macro. However, I've made a fork of this repo at https://github.com/jmhodges/levigo_leveldb_1.4 that will support your older leveldb.
Since LevelDB moves so fast, prefer upgrading that, but considering that's more of a high cost for experimentation than I'm willing to impose right now, this fork will be fine.
Hi!
I'm ran into a compiling issue on Ubuntu 12.10
$ go get github.com/jmhodges/levigo 2
github.com/jmhodges/levigo
1: error: 'leveldb_free' undeclared (first use in this function)
1: note: each undeclared identifier is reported only once for each function it appears in
Package libleveldb-dev is installed (Version: 0+20120530.gitdd0d562-2).
I've got it compiling with the following patch (Don't know if its wise to map leveldb_free() to free()):
diff --git a/db.go b/db.go
index 619582f..9ef217a 100644
--- a/db.go
+++ b/db.go
@@ -5,6 +5,10 @@ package levigo
#include <stdlib.h>
#include "leveldb/c.h"
+#ifndef leveldb_free
+#endif
// This function exists only to clean up lack-of-const warnings when
// leveldb_approximate_sizes is called from Go-land.
void levigo_leveldb_approximate_sizes(
diff --git a/iterator.go b/iterator.go
index 1b61a38..cb5e246 100644
--- a/iterator.go
+++ b/iterator.go
@@ -1,8 +1,15 @@
package levigo
-// #cgo LDFLAGS: -lleveldb
-// #include <stdlib.h>
-// #include "leveldb/c.h"
+/*
+#cgo LDFLAGS: -lleveldb
+#include <stdlib.h>
+#include "leveldb/c.h"
+
+#ifndef leveldb_free
+#endif
+*/
import "C"
import (
The text was updated successfully, but these errors were encountered: