diff --git a/cross/gcc-aarch64/APKBUILD b/cross/gcc-aarch64/APKBUILD
index 7ab07e72e..f55ec069a 100644
--- a/cross/gcc-aarch64/APKBUILD
+++ b/cross/gcc-aarch64/APKBUILD
@@ -332,8 +332,8 @@ package() {
 	# we dont support gcj -static
 	# and saving 35MB is not bad.
 	find "$pkgdir" -name libgtkpeer.a \
-		-o -name libgjsmalsa.a -o \
-		-o -name libgij.a -o \
+		-o -name libgjsmalsa.a \
+		-o -name libgij.a \
 		| xargs rm -f
 
 	# strip debug info from some static libs
@@ -356,10 +356,12 @@ package() {
 	find "$pkgdir" -name 'ffi*.h' | xargs rm -f
 
 	local gdblib=${_target:+$CTARGET/}lib
-	for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py" ); do
-		mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
-		mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
-	done
+	if [ -d "$pkgdir"/usr/$gdblib/ ]; then
+		for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do
+			mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
+			mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
+		done
+	fi
 
 	paxmark -pmrs "$pkgdir"/$_gcclibexec/cc1
 
diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD
index ba0d761e6..4cab3d502 100644
--- a/cross/gcc-armhf/APKBUILD
+++ b/cross/gcc-armhf/APKBUILD
@@ -332,8 +332,8 @@ package() {
 	# we dont support gcj -static
 	# and saving 35MB is not bad.
 	find "$pkgdir" -name libgtkpeer.a \
-		-o -name libgjsmalsa.a -o \
-		-o -name libgij.a -o \
+		-o -name libgjsmalsa.a \
+		-o -name libgij.a \
 		| xargs rm -f
 
 	# strip debug info from some static libs
@@ -356,10 +356,12 @@ package() {
 	find "$pkgdir" -name 'ffi*.h' | xargs rm -f
 
 	local gdblib=${_target:+$CTARGET/}lib
-	for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py" ); do
-		mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
-		mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
-	done
+	if [ -d "$pkgdir"/usr/$gdblib/ ]; then
+		for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do
+			mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
+			mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
+		done
+	fi
 
 	paxmark -pmrs "$pkgdir"/$_gcclibexec/cc1
 
diff --git a/cross/gcc-armv7/APKBUILD b/cross/gcc-armv7/APKBUILD
index 9a631a1ab..c4f3f1dc2 100644
--- a/cross/gcc-armv7/APKBUILD
+++ b/cross/gcc-armv7/APKBUILD
@@ -332,8 +332,8 @@ package() {
 	# we dont support gcj -static
 	# and saving 35MB is not bad.
 	find "$pkgdir" -name libgtkpeer.a \
-		-o -name libgjsmalsa.a -o \
-		-o -name libgij.a -o \
+		-o -name libgjsmalsa.a \
+		-o -name libgij.a \
 		| xargs rm -f
 
 	# strip debug info from some static libs
@@ -356,10 +356,12 @@ package() {
 	find "$pkgdir" -name 'ffi*.h' | xargs rm -f
 
 	local gdblib=${_target:+$CTARGET/}lib
-	for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py" ); do
-		mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
-		mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
-	done
+	if [ -d "$pkgdir"/usr/$gdblib/ ]; then
+		for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do
+			mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
+			mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
+		done
+	fi
 
 	paxmark -pmrs "$pkgdir"/$_gcclibexec/cc1