Is it documented anywhere that static or shared libraries are preferred?
I've got several mingw packages in my COPR[1] that can and probably should be added to Fedora, but I'm also a developer on a project and I produce windows installers from my Fedora machine. Some of the dependencies I built with shared (dll) libraries and probably spent 10's of hours figuring out how to see which ones needed to be bunded in the installer
https://github.com/drowe67/freedv-gui/blob/master/cmake/GetDependencies.cmak...
So that makes me thing that static libraries would be better or should be enforced. If not, how do you package programs with shared libraries?
Thanks, Richard
Hi
Personally I only go with shared libraries, and the one time I had to use static libraries I ended up hitting quite a number of broken ones.
Attached below is the script I use to automatically collect dependencies. Only ones you'll still have to collect manually are the runtime loaded ones.
Hope this helps Sandro
#!/bin/bash
# Halt on errors set -e
installroot=$PWD/dist;
if [ $# -lt 1 ]; then echo "Usage: $0 win32_binary [--debug]" exit 1; fi
if [ ! -f "$1" ]; then echo "Cannot find file $1" echo "" echo "Usage: $0 win32_binary [--debug]" exit 1; fi
# Note: This script is written to be used with the Fedora mingw environment if [ "$(file $1 | grep -o x86-64)" == "x86-64" ]; then echo "Scanning dependencies for $1 (64bit binary)" MINGWROOT=/usr/x86_64-w64-mingw32/sys-root/mingw else echo "Scanning dependencies for $1 (32bit binary)" MINGWROOT=/usr/i686-w64-mingw32/sys-root/mingw fi
if [ "$2" == "--debug" ]; then withdebug=1 fi
isqt5=false
# Collect dependencies function isnativedll { # If the import library exists but not the dynamic library, the dll ist most likely a native one local lower=${1,,} [ ! -e $MINGWROOT/bin/$1 ] && [ -f $MINGWROOT/lib/lib${lower/%.*/.a} ] && return 0; return 1; }
function cpDep { # Copy the specified binary dependency destdir="$installroot/${2:-$(dirname $1)}" name="$(basename $1)" test -e "$destdir/$name" && return 0 if [ ! -e "$MINGWROOT/$1" ]; then echo "Error: missing $MINGWROOT/$1" return 0 fi mkdir -p "$destdir" || return 1 echo "Copying $1" cp -a "$MINGWROOT/$1" "$destdir/$name" || return 1 if [ $withdebug ]; then test -e "$MINGWROOT/$1.debug" && cp "$MINGWROOT/$1.debug" "$destdir/$name.debug" && echo "Copying $1.debug" || echo "Warning: missing $name.debug"; fi autoCpDeps $destdir/$name || return 1 return 0 }
function autoCpDeps { # Collects and links the dependencies of the specified binary for dep in $(mingw-objdump -p "$1" | grep "DLL Name" | awk '{print $3}'); do # Hacks / Workarounds if [ "$dep" == "LIBPQ.dll" ]; then dep="libpq.dll" elif [ "$dep" == "QtUiToolsd4.dll" ]; then continue; elif [ "$dep" == "Qt5Core.dll" ]; then isqt5=true fi
if [ ! -f "$dep" ] && ! isnativedll "$dep"; then cpDep bin/$dep || return 1 fi done return 0 }
mkdir -p dist/bin cp -a $1 dist/bin autoCpDeps $1 if [ $withdebug ]; then cpDep bin/gdb.exe fi if [[ $isqt5 == true ]]; then mkdir -p dist/bin/platforms cp -a $MINGWROOT/lib/qt5/plugins/platforms/qwindows.dll dist/bin/platforms/ autoCpDeps $MINGWROOT/lib/qt5/plugins/platforms/qwindows.dll fi
On 10.05.20 23:57, Richard Shaw wrote:
Is it documented anywhere that static or shared libraries are preferred?
I've got several mingw packages in my COPR[1] that can and probably should be added to Fedora, but I'm also a developer on a project and I produce windows installers from my Fedora machine. Some of the dependencies I built with shared (dll) libraries and probably spent 10's of hours figuring out how to see which ones needed to be bunded in the installer
https://github.com/drowe67/freedv-gui/blob/master/cmake/GetDependencies.cmak...
So that makes me thing that static libraries would be better or should be enforced. If not, how do you package programs with shared libraries?
Thanks, Richard
mingw mailing list -- mingw@lists.fedoraproject.org To unsubscribe send an email to mingw-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/mingw@lists.fedoraproject.org
On Sun, May 10, 2020 at 5:15 PM Sandro Mani manisandro@gmail.com wrote:
Hi
Personally I only go with shared libraries, and the one time I had to use static libraries I ended up hitting quite a number of broken ones.
Attached below is the script I use to automatically collect dependencies. Only ones you'll still have to collect manually are the runtime loaded ones.
Thanks, I'll check it out. Perhaps it should be included in a MinGW package? I also noticed there is no "group" for MinGW which would also be helpful.
Richard
On Sun, May 10, 2020 at 5:15 PM Sandro Mani manisandro@gmail.com wrote:
Hi
Personally I only go with shared libraries, and the one time I had to use static libraries I ended up hitting quite a number of broken ones.
Attached below is the script I use to automatically collect dependencies. Only ones you'll still have to collect manually are the runtime loaded ones.
Hope this helps Sandro
#!/bin/bash
# Halt on errors set -e
installroot=$PWD/dist;
if [ $# -lt 1 ]; then echo "Usage: $0 win32_binary [--debug]" exit 1; fi
if [ ! -f "$1" ]; then echo "Cannot find file $1" echo "" echo "Usage: $0 win32_binary [--debug]" exit 1; fi
# Note: This script is written to be used with the Fedora mingw environment if [ "$(file $1 | grep -o x86-64)" == "x86-64" ]; then echo "Scanning dependencies for $1 (64bit binary)" MINGWROOT=/usr/x86_64-w64-mingw32/sys-root/mingw else echo "Scanning dependencies for $1 (32bit binary)" MINGWROOT=/usr/i686-w64-mingw32/sys-root/mingw fi
if [ "$2" == "--debug" ]; then withdebug=1 fi
isqt5=false
# Collect dependencies function isnativedll { # If the import library exists but not the dynamic library, the dll ist most likely a native one local lower=${1,,} [ ! -e $MINGWROOT/bin/$1 ] && [ -f $MINGWROOT/lib/lib${lower/%.*/.a} ] && return 0; return 1; }
function cpDep { # Copy the specified binary dependency destdir="$installroot/${2:-$(dirname $1)}" name="$(basename $1)" test -e "$destdir/$name" && return 0 if [ ! -e "$MINGWROOT/$1" ]; then echo "Error: missing $MINGWROOT/$1" return 0 fi mkdir -p "$destdir" || return 1 echo "Copying $1" cp -a "$MINGWROOT/$1" "$destdir/$name" || return 1 if [ $withdebug ]; then test -e "$MINGWROOT/$1.debug" && cp "$MINGWROOT/$1.debug" "$destdir/$name.debug" && echo "Copying $1.debug" || echo "Warning: missing $name.debug"; fi autoCpDeps $destdir/$name || return 1 return 0 }
function autoCpDeps { # Collects and links the dependencies of the specified binary for dep in $(mingw-objdump -p "$1" | grep "DLL Name" | awk '{print $3}'); do # Hacks / Workarounds if [ "$dep" == "LIBPQ.dll" ]; then dep="libpq.dll" elif [ "$dep" == "QtUiToolsd4.dll" ]; then continue; elif [ "$dep" == "Qt5Core.dll" ]; then isqt5=true fi
if [ ! -f "$dep" ] && ! isnativedll "$dep"; then cpDep bin/$dep || return 1 fi done return 0
}
mkdir -p dist/bin cp -a $1 dist/bin autoCpDeps $1 if [ $withdebug ]; then cpDep bin/gdb.exe fi if [[ $isqt5 == true ]]; then mkdir -p dist/bin/platforms cp -a $MINGWROOT/lib/qt5/plugins/platforms/qwindows.dll dist/bin/platforms/ autoCpDeps $MINGWROOT/lib/qt5/plugins/platforms/qwindows.dll fi
Wow, this is FANTASTICALLY helpful. I keep finding myself manually curating the list of DLL files to include in packages and that's a royal PITA. I will definitely switch to using this. But, I agree with Richard - maybe this could be included into a package? Just make us up a source-only package that drops this script into /usr/bin/ somewhere and it will make me grateful!
--Greg
On 10.05.20 23:57, Richard Shaw wrote:
Is it documented anywhere that static or shared libraries are preferred?
I've got several mingw packages in my COPR[1] that can and probably should be added to Fedora, but I'm also a developer on a project and I produce windows installers from my Fedora machine. Some of the dependencies I built with shared (dll) libraries and probably spent 10's of hours figuring out how to see which ones needed to be bunded in the installer
https://github.com/drowe67/freedv-gui/blob/master/cmake/GetDependencies.cmak...
So that makes me thing that static libraries would be better or should be enforced. If not, how do you package programs with shared libraries?
Thanks, Richard
mingw mailing list -- mingw@lists.fedoraproject.org To unsubscribe send an email to mingw-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/mingw@lists.fedoraproject.org
mingw mailing list -- mingw@lists.fedoraproject.org To unsubscribe send an email to mingw-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/mingw@lists.fedoraproject.org
On Mon, May 11, 2020 at 1:51 AM Greg Hellings greg.hellings@gmail.com wrote:
Wow, this is FANTASTICALLY helpful. I keep finding myself manually curating the list of DLL files to include in packages and that's a royal PITA. I will definitely switch to using this. But, I agree with Richard - maybe this could be included into a package? Just make us up a source-only package that drops this script into /usr/bin/ somewhere and it will make me grateful!
While the mingw experience seems to be MUCH better on Fedora than other distros, I agree, there can be improvements.
1. Perhaps a package "mingw-fedora-helper"? 2. A dnf group to install the basics which should also pull in the "DevelopmentTools" group.
Thanks, Richard