diff --git a/src/Makevars.in b/src/Makevars.in
index 9527226..58b84a7 100644
--- a/src/Makevars.in
+++ b/src/Makevars.in
@@ -5,7 +5,7 @@ CXX_STD = CXX11
 
 PKG_CFLAGS=@PKG_CFLAGS@
 PKG_CPPFLAGS=@PKG_CPPFLAGS@
-PKG_LIBS=@PKG_LIBS@
+PKG_LIBS=@PKG_LIBS@ -lzstd
 
 # ## uncomment below to enable debugging
 # ##  use `R -d gdb` to start,
@@ -39,7 +39,6 @@ PKG_CPPFLAGS+=-I. \
              -DSQLITE_SOUNDEX
 
 ## for zstd
-PKG_CPPFLAGS+=-Izstd/lib -Izstd/lib/common -DXXH_NAMESPACE=ZSTD_ -Izstd/lib/legacy -DZSTD_LEGACY_SUPPORT=5
 
 # R_HOME=$(shell R RHOME)
 # ZSTDR_CFLAGS=$("${R_HOME}/bin/R" CMD config CFLAGS)
@@ -79,6 +78,6 @@ ZSTD_OBJ = zstd/lib/common/debug.o \
 
 SQLITE_OBJ = sqlite/sqlite3.o
 
-PKG_LIBS += $(ZSTD_OBJ) $(SQLITE_OBJ)
+PKG_LIBS += $(SQLITE_OBJ)
 
-$(SHLIB): $(ZSTD_OBJ) $(SQLITE_OBJ)
+$(SHLIB): $(SQLITE_OBJ)
