diff --git a/schema/db-gen/Makefile b/schema/db-gen/Makefile
-index a1b8ab1..4c2f6a1 100755
+index a1b8ab1..35f097c 100755
--- a/schema/db-gen/Makefile
+++ b/schema/db-gen/Makefile
-@@ -2,7 +2,10 @@ CC = gcc
+@@ -1,8 +1,11 @@
+ CC = gcc
REQUIRED_PKG = db-util
- CFLAGS = -g -Wall #-fprofile-arcs -ftest-coverage
+-CFLAGS = -g -Wall #-fprofile-arcs -ftest-coverage
-LDFLAGS =
++CFLAGS = -g -Wall -Wl,-rpath,$(STAGING_DIR_NATIVE)/usr/lib/ #-fprofile-arcs -ftest-coverage
+CFLAGS += -I${STAGING_DIR_NATIVE}/usr/include/
+LDFLAGS = -L${STAGING_DIR_NATIVE}/lib/
+LDFLAGS += -L${STAGING_DIR_NATIVE}/usr/lib/
ifdef REQUIRED_PKG
CFLAGS += $(shell pkg-config --cflags $(REQUIRED_PKG))
LDFLAGS += -L$(shell pkg-config --variable=libdir $(REQUIRED_PKG))
-diff --git a/schema/generator.sh b/schema/generator.sh
-index e900e5a..3e85be0 100755
---- a/schema/generator.sh
-+++ b/schema/generator.sh
-@@ -31,6 +31,9 @@ make clean
- # Make DB
- cd ../db-gen
- make
-+LD_LIBRARY_PATH="${STAGING_DIR_NATIVE}/usr/lib:${LD_LIBRARY_PATH}"
-+echo STAGING_DIR_NATIVE ${STAGING_DIR_NATIVE}
-+echo LD_LIBRARY_PATH ${LD_LIBRARY_PATH}
- ../initdb ../
-
- make clean
diff --git a/schema/header-gen/Makefile b/schema/header-gen/Makefile
-index 70b2727..c718cfa 100755
+index 70b2727..a1029b7 100755
--- a/schema/header-gen/Makefile
+++ b/schema/header-gen/Makefile
@@ -1,8 +1,10 @@
CC = gcc
-REQUIRED_PKG =
-+REQUIRED_PKG =
- CFLAGS = -g -Wall #-fprofile-arcs -ftest-coverage
+-CFLAGS = -g -Wall #-fprofile-arcs -ftest-coverage
-LDFLAGS =
++REQUIRED_PKG =
++CFLAGS = -g -Wall -Wl,-rpath,$(STAGING_DIR_NATIVE)/usr/lib/ #-fprofile-arcs -ftest-coverage
+CFLAGS += -I${STAGING_DIR_NATIVE}/usr/include/
+LDFLAGS = -L${STAGING_DIR_NATIVE}/lib/
+LDFLAGS += -L${STAGING_DIR_NATIVE}/usr/lib/