diff --git a/linux/debian/scripts/compile_and_pack.sh b/linux/debian/scripts/compile_and_pack.sh
index c9fed63c6e8d5f04173813da7bb601c1235b4b55..dc3ac9c17ed6dfb62c8f4e005e8fd83aa73e3d6e 100755
--- a/linux/debian/scripts/compile_and_pack.sh
+++ b/linux/debian/scripts/compile_and_pack.sh
@@ -48,15 +48,19 @@ substitute_pkgname_postfix && mkdir -p build && cd build && ${CMAKE_PATH}cmake .
 && ${CMAKE_PATH}cmake -DCMAKE_BUILD_TYPE=Debug ../ && make -j$(nproc) && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$?
 
 echo $error
-if [[ $(echo $DISTR_CODENAME| grep bullseye) != "" && $error == 0 ]]; then
+if [[ $(echo $ARCH_VERSIONS | grep arm64) != "" && $error == 0 ]]; then
 	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ARM64
 	${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARM64_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARM64_CXX_COMPILER -DCMAKE_TARGET_ARCH="arm64" .. && make -j$(nproc) && \
 	${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * && \
-	${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARM64_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARM64_CXX_COMPILER -DCMAKE_TARGET_ARCH="arm64" -DCMAKE_BUILD_TYPE=Debug ../ && make -j$(nproc) && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$?
+	${CMAKE_PATH}cmake -DCMAKE_BUILD_TYPE=Debug ../ && make -j$(nproc) && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$?
+	unset LD_LIBRARY_PATH
+fi
+
+if [[ $(echo $ARCH_VERSIONS | grep armhf) != "" && $error == 0 ]]; then
 	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ARMHF
 	${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARMHF_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARMHF_CXX_COMPILER -DCMAKE_TARGET_ARCH="armhf" .. && make -j$(nproc) && \
 	${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * && \
-	${CMAKE_PATH}cmake -DCMAKE_C_COMPILER=$ARMHF_C_COMPILER -DCMAKE_CXX_COMPLIER=$ARMHF_CXX_COMPILER -DCMAKE_TARGET_ARCH="armhf" -DCMAKE_BUILD_TYPE=Debug ../ && make -j$(nproc) && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$?
+	${CMAKE_PATH}cmake -DCMAKE_BUILD_TYPE=Debug ../ && make -j$(nproc) && ${CMAKE_PATH}cpack && repack *.deb && mv -v *.deb ../packages/ && rm -r * || error=$?
 	unset LD_LIBRARY_PATH
 fi