diff --git a/main/lvm2/APKBUILD b/main/lvm2/APKBUILD
index c39b402480b06c124b4a7a51096f9603b5984246..d57b03c05a2962317483ddf413bdac748afcecbb 100644
--- a/main/lvm2/APKBUILD
+++ b/main/lvm2/APKBUILD
@@ -8,7 +8,9 @@ arch="all"
 license="GPL"
 depends=
 depends_dev="linux-headers"
-makedepends="$depends_dev coreutils"
+makedepends_build="coreutils"
+makedepends_host="$depends_dev"
+makedepends="$makedepends_build $makedepends_host"
 source="ftp://sources.redhat.com/pub/$pkgname/LVM2.$pkgver.tgz
 	fix-stdio-usage.patch
 	mallinfo.patch
@@ -35,6 +37,10 @@ prepare() {
 build () {
 	cd "$_builddir"
 
+	# during cross-compilation malloc test goes wrong
+	export ac_cv_func_malloc_0_nonnull=yes
+	export ac_cv_func_realloc_0_nonnull=yes
+
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \