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
{{ message }}
Repository navigation
Ristretto Jemalloc linking error when running ./tesh.sh #2226
Building projects that depend on dgraph-io/ristretto/v2 (such as dgraph-io/badger/v4 in this case) fails on a standard Ubuntu installation due to a CGO linking error with the jemalloc library, even when libjemalloc-dev is installed.
The Ristretto library should compile successfully with the standard go build command when libjemalloc-dev is installed. The CGO configuration should automatically include the required linker flags to resolve the C function symbols.
Screenshots
$ ./test.sh
go version go1.25.0 linux/amd64
./test.sh: line 8: [: =: unary operator expected
/tmp/badger/badger /tmp/badger
github.com/dgraph-io/ristretto/v2/z
# github.com/dgraph-io/ristretto/v2/z
/home/foobar/go/pkg/mod/github.com/dgraph-io/ristretto/[email protected]/z/calloc_jemalloc.go:74:9: could not determine what C.je_calloc refers to
/home/foobar/go/pkg/mod/github.com/dgraph-io/ristretto/[email protected]/z/calloc_jemalloc.go:104:3: could not determine what C.je_free refers to
/home/foobar/go/pkg/mod/github.com/dgraph-io/ristretto/[email protected]/z/calloc_jemalloc.go:144:2: could not determine what C.je_mallctl refers to
/home/foobar/go/pkg/mod/github.com/dgraph-io/ristretto/[email protected]/z/calloc_jemalloc.go:171:2: could not determine what C.je_malloc_stats_print refers to
changed the title [-]Ristretto Jemalloc Linking when running ./tesh.sh[/-][+]Ristretto Jemalloc linking error when running ./tesh.sh[/+]on Sep 28, 2025
I have faced the same issue, but for now to skip this part I have changed the script tags from jemalloc to badger_nojemalloc, I believe this issue is a linking error not app error
I have faced the same issue, but for now to skip this part I have changed the script tags from jemalloc to badger_nojemalloc, I believe this issue is a linking error not app error
Well, it works now i have installed the jemalloc from the repo
sudo dnf remove jemalloc jemalloc-devel
sudo dnf install autoconf automake libtool make gcc git
git clone https://github.com/jemalloc/jemalloc.git
cd jemalloc
./autogen.sh --with-jemalloc-prefix=je_
make
sudo make install
and now i can cd to badger to try it out but you have to export some vars
export CGO_CFLAGS="-I/usr/local/include"
export CGO_LDFLAGS="-L/usr/local/lib -ljemalloc"
export LD_LIBRARY_PATH="/usr/local/lib"
go clean -modcache
go build -tags jemalloc ./...
Activity
linear commentedon Sep 28, 2025
BGR-18 Ristretto Jemalloc Linking when running ./tesh.sh
[-]Ristretto Jemalloc Linking when running ./tesh.sh[/-][+]Ristretto Jemalloc linking error when running ./tesh.sh[/+]Amr-Shams commentedon Oct 25, 2025
I have faced the same issue, but for now to skip this part I have changed the script tags from
jemalloctobadger_nojemalloc, I believe this issue is a linking error not app errorAmr-Shams commentedon Oct 25, 2025
Well, it works now i have installed the jemalloc from the repo
and now i can cd to badger to try it out but you have to export some vars
github-actions commentedon Jun 21, 2026
This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.