#!/bin/bash CROSS_DEST_DIR=/opt/W64-cross-compile/lib CROSS_COMPILER_DIR=/usr/x86_64-w64-mingw32/lib # # in case of issues, check the path # ls -la /usr/lib/gcc/x86_64-w64-mingw32/ # CROSS_GCC_DIR=/usr/lib/gcc/x86_64-w64-mingw32/12-win32 cp -v $CROSS_COMPILER_DIR/zlib1.dll ./ # copy dll dependencys copy_dependency() { local I for I in `strings $1 | grep -i '\.dll$' | grep -e "^lib"` do if [ -e ./$I ] then echo "File Exist" elif [ -e $CROSS_COMPILER_DIR/$I ] then cp -v $CROSS_COMPILER_DIR/$I ./ copy_dependency $CROSS_COMPILER_DIR/$I elif [ -e $CROSS_GCC_DIR/$I ] then cp -v $CROSS_GCC_DIR/$I ./ copy_dependency $CROSS_GCC_DIR/$I elif [ -e $CROSS_DEST_DIR/$I ] then cp -v $CROSS_DEST_DIR/$I ./ copy_dependency $CROSS_DEST_DIR/$I fi done } copy_dependency testmodbus-client.exe