package for Windows
I compiled nedit-ng with MinGW64/MSYS2, it work well. I tryed to generate a Windows package, will report the list of dependancies
here the generated Windows 64 bit binaries package:
ProgramFiles/nedit-ng
---------------------
├── bearer
│ └── qgenericbearer.dll 126391
├── iconengines
│ └── qsvgicon.dll 86970
├── imageformats
│ ├── qgif.dll 69144
│ ├── qicns.dll 87492
│ ├── qico.dll 72035
│ ├── qjp2.dll 77205
│ ├── qjpeg.dll 97643
│ ├── qsvg.dll 64064
│ ├── qtga.dll 62256
│ ├── qtiff.dll 82843
│ ├── qwbmp.dll 58522
│ └── qwebp.dll 74999
├── platforms
│ └── qwindows.dll 2072887
├── printsupport
│ └── windowsprintersupport.dll 100531
├── styles
│ └── qwindowsvistastyle.dll 304724
├── translations
│ ├── qt_ar.qm 130
│ ├── qt_bg.qm 153
│ ├── qt_ca.qm 153
│ ├── qt_cs.qm 157
│ ├── qt_da.qm 153
│ ├── qt_de.qm 153
│ ├── qt_en.qm 16
│ ├── qt_es.qm 153
│ ├── qt_fi.qm 117
│ ├── qt_fr.qm 153
│ ├── qt_gd.qm 70
│ ├── qt_he.qm 83
│ ├── qt_hu.qm 146
│ ├── qt_it.qm 153
│ ├── qt_ja.qm 146
│ ├── qt_ko.qm 146
│ ├── qt_lv.qm 89
│ ├── qt_pl.qm 161
│ ├── qt_ru.qm 164
│ ├── qt_sk.qm 157
│ ├── qt_tr.qm 110
│ ├── qt_uk.qm 164
│ └── qt_zh_TW.qm 141
├── libbrotlicommon.dll 143395
├── libbrotlidec.dll 52874
├── libbz2-1.dll 99146
├── libdouble-conversion.dll 83604
├── libfreetype-6.dll 742698
├── libgcc_s_seh-1.dll 82097
├── libglib-2.0-0.dll 1303327
├── libgraphite2.dll 154163
├── libharfbuzz-0.dll 1011844
├── libiconv-2.dll 1058528
├── libicudt68.dll 28579844
├── libicuin68.dll 3497999
├── libicuuc68.dll 2145427
├── libintl-8.dll 133659
├── libpcre-1.dll 281183
├── libpcre2-16-0.dll 340032
├── libpng16-16.dll 243590
├── libstdc++-6.dll 1753738
├── libwinpthread-1.dll 59643
├── libzstd.dll 999818
├── Qt5Core.dll 7051998
├── Qt5Gui.dll 9446658
├── Qt5Network.dll 2554031
├── Qt5PrintSupport.dll 620728
├── Qt5Svg.dll 573391
├── Qt5Widgets.dll 8922361
├── Qt5Xml.dll 381061
├── nc-ng.exe 4207091
├── nedit-ng.exe 87186762
└── zlib1.dll 116428
-------------------------------------------
TOTAL 167267892
I noticed the two binaries was not stripped, so I stripped them, this is the new results:
nc-ng.exe 245760
nedit-ng.exe 2624000
-------------------------------------------
TOTAL 78743799
so 75 MiB.
Just curious… Is this a release build?
Please checks the following generation steps (on MinGW64/MSYS2 on Windows 64bit), maybe there is my mistake if you get 22 MB package on Windows: $ pacman -S mingw-w64-i686-qt5 mingw-w64-x86_64-qt5 mingw-w64-i686-boost mingw-w64-x86_64-boost mingw-w64-i686-cmake mingw-w64-x86_64-cmake $ git clone https://github.com/eteran/nedit-ng.git $ cd nedit-ng $ mkdir build $ cd build $ cmake -G "MSYS Makefiles" .. $ make
Note: I do not used:
$ make package
as it do not package the dependancies, so useless.
I tryed also:
$ windeployqt nedit-ng.exe nc-ng.exe
but the binaries in the generated directory doesn't start as miss most of general DLL, but it has the advantage to create the needed QT env subdirs.
I collected all the the required DLL by try and error.
Just curious… Is this a release build?
I'm not a developer, so please list the needed steps for a release build
Sorry I wasn't being clear enough. Not sure how things work on MinGW64/MSYS2, but I build nedit-ng using Qt Creator with MSVC, which allow us to choose the build target. If we make the Release build, the exe should have been stripped, and the compiler should optimize the binaries to run better. Debug build of nedit-ng is horribly slow in some areas.
At the very least, I would try changing the cmake line to read line this:
$ cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release ..
That will ensure that it is not a debug build and is nice and optimized (assuming that mingw + make works as expected)
Yea, an 80MB .exe sounds like a debug build to me for sure.
sorry I do not know MSVC, I have done another test with MSYS2 and -DCMAKE_BUILD_TYPE=Release The resulting binary was still not stripped, I stripped myself. Here the result:
255'488 nc-ng.exe
2'871'808 nedit-ng.exe
other files are the same
TOTAL 75'560'561 byte
Do you distribute a pre-compiled Windows package?
Honestly, I should look into anything having my CI pipeline generate windows binaries automatically.
Right now it is entirely a manual process that I do pretty much upon request.
One quick question though, what are the units of those numbers? Because if it's bytes then two MB for the main binary is actually a pretty reasonable size!
Otherwise it looks like the rest of the size is from support libraries which certainly don't need to be THAT big
It'd be great if CI can generate the windows binaries. That way we can even have the 'nightly' builds readily available.
BTW, just for my knowledge, I tried to make a distribution package using my setup, which turned out to be much less troublesome than I thought. The only extra step required is to download and install the VC redistributables on my test box, then just copy the windeployqt'ed release build directory over, and voila.... we have nedit-ng running.
BTW, just FYI. My release build directory is taking up about 97MB, of which nedit-ng.exe only contributes 2.2MB. But these days, I don't really think it's that much a bit deal.
Units are Bytes. The DLL are a copy of the one supplied by the MSYS2 GNU distribution, and seems are not stripped. Can I use strip on DLL (once copied in nedit-ng distribution package) too?
I stripped everything I can, and this saved some space:
142'336 libbrotlicommon.dll
51'200 libbrotlidec.dll
97'280 libbz2-1.dll
81'408 libdouble-conversion.dll
737'792 libfreetype-6.dll
80'384 libgcc_s_seh-1.dll
1'291'264 libglib-2.0-0.dll
152'064 libgraphite2.dll
1'006'080 libharfbuzz-0.dll
1'056'768 libiconv-2.dll
28'578'816 libicudt68.dll
3'453'440 libicuin68.dll
2'140'160 libicuuc68.dll
130'048 libintl-8.dll
279'552 libpcre-1.dll
338'432 libpcre2-16-0.dll
241'152 libpng16-16.dll
1'747'456 libstdc++-6.dll
56'320 libwinpthread-1.dll
997'888 libzstd.dll
255'488 nc-ng.exe
2'871'808 nedit-ng.exe
5'433'876 Qt5Core.dll
6'927'360 Qt5Gui.dll
1'630'720 Qt5Network.dll
322'048 Qt5PrintSupport.dll
312'320 Qt5Svg.dll
6'054'400 Qt5Widgets.dll
233'984 Qt5Xml.dll
114'688 zlib1.dll
TOTAL 68'549'888 Byte
and everything still work as expected.
I stripped everything I can, and this saved some space:
are there any DLL that are not required?
no, deleting one of them, running the executable complaint that the DLL is missing
Do you mean you manually deleting one by one to test, and none of them can be deleted?
no, I put the executable alone in an empy CMD sandbox, and run it. It complaint for a missing DLL, so I added that to the sandbox. Iterated till the executable start
here the script I'm using to create the package:
#!/bin/bash
# nedit-ng_pkg: Copyright 2021 Valerio Messina v0.1.0 2021/05/28
# this script create a package for nedit-ng with all the dependancies
# must be run in MinGW32/64(MSYS2)
# Note: put binaries path in 'bin', eg. "~/c/nedit-ng/build/"
# Note: put destination path in 'pkg', eg. "/d/installer/nedit-ng/"
bin="$HOME/c/nedit-ng/build/"
pkg="/d/installer/nedit-ng/"
if (test "" = "$MSYSTEM") then
echo "You are not in MSYS2"
exit
fi
if (test "$MSYSTEM" = "MINGW64") then
bit=64
root=/mingw64/
fi
if (test "$MSYSTEM" = "MINGW32") then
bit=32
root=/mingw32/
fi
if (test "" = "$bit") then
echo "You are not in MinGW32/64"
exit
fi
echo "Packaging 'nedit-ng' for Win$bit ..."
cd $bin
mkdir -p $pkg
cp nedit-ng.exe $pkg
strip $pkg/nedit-ng.exe
cp nc-ng.exe $pkg
strip $pkg/nc-ng.exe
cp $root/bin/libstdc++-6.dll $pkg
strip $pkg/libstdc++-6.dll
cp $root/bin/libgcc_s_seh-1.dll $pkg
strip $pkg/libgcc_s_seh-1.dll
cp $root/bin/libwinpthread-1.dll $pkg
strip $pkg/libwinpthread-1.dll
cp $root/bin/zlib1.dll $pkg
strip $pkg//zlib1.dll
cp $root/bin/libzstd.dll $pkg
strip $pkg/libzstd.dll
cp $root/bin/libbz2-1.dll $pkg
strip $pkg/libbz2-1.dll
cp $root/bin/libpng16-16.dll $pkg
strip $pkg/libpng16-16.dll
cp $root/bin/libiconv-2.dll $pkg
strip $pkg/libiconv-2.dll
cp $root/bin/libintl-8.dll $pkg
strip $pkg/libintl-8.dll
cp $root/bin/libpcre2-16-0.dll $pkg
strip $pkg/libpcre2-16-0.dll
cp $root/bin/libpcre-1.dll $pkg
strip $pkg/libpcre-1.dll
cp $root/bin/libfreetype-6.dll $pkg
strip $pkg/libfreetype-6.dll
cp $root/bin/libglib-2.0-0.dll $pkg
strip $pkg/libglib-2.0-0.dll
cp $root/bin/libharfbuzz-0.dll $pkg
strip $pkg/libharfbuzz-0.dll
cp $root/bin/libicuin68.dll $pkg
strip $pkg/libicuin68.dll
cp $root/bin/libicuuc68.dll $pkg
strip $pkg/libicuuc68.dll
cp $root/bin/libicudt68.dll $pkg
strip $pkg/libicudt68.dll
cp $root/bin/libdouble-conversion.dll $pkg
strip $pkg/libdouble-conversion.dll
cp $root/bin/libgraphite2.dll $pkg
strip $pkg/libgraphite2.dll
cp $root/bin/libbrotlicommon.dll $pkg
strip $pkg/libbrotlicommon.dll
cp $root/bin/libbrotlidec.dll $pkg
strip $pkg/libbrotlidec.dll
cp $root/bin/Qt5Core.dll $pkg
strip $pkg/Qt5Core.dll
cp $root/bin/Qt5Network.dll $pkg
strip $pkg/Qt5Network.dll
cp $root/bin/Qt5PrintSupport.dll $pkg
strip $pkg/Qt5PrintSupport.dll
cp $root/bin/Qt5Xml.dll $pkg
strip $pkg/Qt5Xml.dll
cp $root/bin/Qt5Svg.dll $pkg # not sure if needed
strip $pkg/Qt5Svg.dll
cp $root/bin/Qt5Widgets.dll $pkg
strip $pkg/Qt5Widgets.dll
cp $root/bin/Qt5Gui.dll $pkg
strip $pkg/Qt5Gui.dll
mkdir -p $pkg/bearer
mkdir -p $pkg/iconengines
mkdir -p $pkg/imageformats
mkdir -p $pkg/platforms
mkdir -p $pkg/printsupport
mkdir -p $pkg/styles
mkdir -p $pkg/translations
cp $root/share/qt5/plugins/bearer/qgenericbearer.dll $pkg/bearer
strip $pkg/bearer/qgenericbearer.dll
cp $root/share/qt5/plugins/iconengines/qsvgicon.dll $pkg/iconengines
strip $pkg/iconengines/qsvgicon.dll
cp $root/share/qt5/plugins/imageformats/qgif.dll $pkg/imageformats
strip $pkg/imageformats/qgif.dll
cp $root/share/qt5/plugins/imageformats/qicns.dll $pkg/imageformats
strip $pkg/imageformats/qicns.dll
cp $root/share/qt5/plugins/imageformats/qico.dll $pkg/imageformats
strip $pkg/imageformats/qico.dll
cp $root/share/qt5/plugins/imageformats/qjp2.dll $pkg/imageformats
strip $pkg/imageformats/qjp2.dll
cp $root/share/qt5/plugins/imageformats/qjpeg.dll $pkg/imageformats
strip $pkg/imageformats/qjpeg.dll
cp $root/share/qt5/plugins/imageformats/qsvg.dll $pkg/imageformats
strip $pkg/imageformats/qsvg.dll
cp $root/share/qt5/plugins/imageformats/qtga.dll $pkg/imageformats
strip $pkg/imageformats/qtga.dll
cp $root/share/qt5/plugins/imageformats/qtiff.dll $pkg/imageformats
strip $pkg/imageformats/qtiff.dll
cp $root/share/qt5/plugins/imageformats/qwbmp.dll $pkg/imageformats
strip $pkg/imageformats/qwbmp.dll
cp $root/share/qt5/plugins/imageformats/qwebp.dll $pkg/imageformats
strip $pkg/imageformats/qwebp.dll
cp $root/share/qt5/plugins/platforms/qwindows.dll $pkg/platforms
strip $pkg/platforms/qwindows.dll
cp $root/share/qt5/plugins/printsupport/windowsprintersupport.dll $pkg/printsupport
strip $pkg/printsupport/windowsprintersupport.dll
cp $root/share/qt5/plugins/styles/qwindowsvistastyle.dll $pkg/styles
strip $pkg/styles/qwindowsvistastyle.dll
cp $root/share/qt5/translations/qt_ar.qm $pkg/translations
cp $root/share/qt5/translations/qt_bg.qm $pkg/translations
cp $root/share/qt5/translations/qt_ca.qm $pkg/translations
cp $root/share/qt5/translations/qt_cs.qm $pkg/translations
cp $root/share/qt5/translations/qt_da.qm $pkg/translations
cp $root/share/qt5/translations/qt_de.qm $pkg/translations
cp $root/share/qt5/translations/qt_en.qm $pkg/translations
cp $root/share/qt5/translations/qt_es.qm $pkg/translations
cp $root/share/qt5/translations/qt_fi.qm $pkg/translations
cp $root/share/qt5/translations/qt_fr.qm $pkg/translations
cp $root/share/qt5/translations/qt_gd.qm $pkg/translations
cp $root/share/qt5/translations/qt_he.qm $pkg/translations
cp $root/share/qt5/translations/qt_hu.qm $pkg/translations
cp $root/share/qt5/translations/qt_it.qm $pkg/translations
cp $root/share/qt5/translations/qt_ja.qm $pkg/translations
cp $root/share/qt5/translations/qt_ko.qm $pkg/translations
cp $root/share/qt5/translations/qt_lv.qm $pkg/translations
cp $root/share/qt5/translations/qt_pl.qm $pkg/translations
cp $root/share/qt5/translations/qt_ru.qm $pkg/translations
cp $root/share/qt5/translations/qt_sk.qm $pkg/translations
cp $root/share/qt5/translations/qt_tr.qm $pkg/translations
cp $root/share/qt5/translations/qt_uk.qm $pkg/translations
cp $root/share/qt5/translations/qt_zh_TW.qm $pkg/translations
are you interested in built package link?
no, I put the executable alone in an empy CMD sandbox, and run it. It complaint for a missing DLL, so I added that to the sandbox. Iterated till the executable start
have you tried the ldd utility? might be less painful ;-)
with ldd you will finish in same manually iterate, as it do not find the dependencies of dependencies, and you have to parse the ldd output, and check if the listed deps are already in the list or no. OK, you can write a script for automation. I took 5' to run 30 times the nedit-ng executable, I think it is faster the way I use
just to see if ldd has improved since the last time I used it, I run it on nedit-ng and it show the same dependancies in nedit-ng root I put over there (so it found some deps of deps), but without the subtree. As so nedit-ng won't start and complaint:
D:\installer\nedit-ng>nedit-ng.exe
Warning: Could not find the Qt platform plugin "windows" in ""
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
You need the complete tree I listed over there for nedit-ng to start correctly. Note: Qt5Svg.dll is not needed.
Maybe for simpler (not Qt app) ldd work as expected, so thank you for suggestion. I found also 'lddtree' as hierachical dynamic linker solver
I have not found a 'package' directory or something right for a Pull Request, so here a compact version of the script:
#!/bin/bash
# nedit-ng_pkg: Copyright 2021 Valerio Messina v0.1.0 2021/05/30 GNU GPL v2+
# this script create a package for nedit-ng with all the dependancies
# must be run in MinGW32/64(MSYS2)
# Note: put binaries path in 'bin', eg. "~/c/nedit-ng/build/"
# Note: put destination path in 'pkg', eg. "/d/installer/nedit-ng/"
bin="$HOME/c/nedit-ng/build/"
pkg="/d/installer/nedit-ng/"
if (test "" = "$MSYSTEM") then
echo "You are not in MSYS2"
exit
fi
if (test "$MSYSTEM" = "MINGW64") then
bit=64
root=/mingw64/
fi
if (test "$MSYSTEM" = "MINGW32") then
bit=32
root=/mingw32/
fi
if (test "" = "$bit") then
echo "You are not in MinGW32/64"
exit
fi
echo "Packaging 'nedit-ng' for Win$bit ..."
cd $bin
mkdir -p $pkg
cp nedit-ng.exe $pkg
strip $pkg/nedit-ng.exe
cp nc-ng.exe $pkg
strip $pkg/nc-ng.exe
for file in libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll zlib1.dll libzstd.dll libbz2-1.dll libpng16-16.dll libiconv-2.dll libintl-8.dll libpcre2-16-0.dll libpcre-1.dll libfreetype-6.dll libglib-2.0-0.dll libharfbuzz-0.dll libicuin68.dll libicuuc68.dll libicudt68.dll libdouble-conversion.dll libgraphite2.dll libbrotlicommon.dll libbrotlidec.dll Qt5Core.dll Qt5Network.dll Qt5PrintSupport.dll Qt5Xml.dll Qt5Widgets.dll Qt5Gui.dll ; do # 'Qt5Svg.dll' not needed
cp $root/bin/$file $pkg
strip $pkg/$file
done
mkdir -p $pkg/bearer
mkdir -p $pkg/iconengines
mkdir -p $pkg/imageformats
mkdir -p $pkg/platforms
mkdir -p $pkg/printsupport
mkdir -p $pkg/styles
mkdir -p $pkg/translations
cp $root/share/qt5/plugins/bearer/qgenericbearer.dll $pkg/bearer
strip $pkg/bearer/qgenericbearer.dll
cp $root/share/qt5/plugins/iconengines/qsvgicon.dll $pkg/iconengines
strip $pkg/iconengines/qsvgicon.dll
for file in qgif.dll qicns.dll qico.dll qjp2.dll qjpeg.dll qsvg.dll qtga.dll qtiff.dll qwbmp.dll qwebp.dll ; do
cp $root/share/qt5/plugins/imageformats/$file $pkg/imageformats
strip $pkg/imageformats/$file
done
cp $root/share/qt5/plugins/platforms/qwindows.dll $pkg/platforms
strip $pkg/platforms/qwindows.dll
cp $root/share/qt5/plugins/printsupport/windowsprintersupport.dll $pkg/printsupport
strip $pkg/printsupport/windowsprintersupport.dll
cp $root/share/qt5/plugins/styles/qwindowsvistastyle.dll $pkg/styles
strip $pkg/styles/qwindowsvistastyle.dll
for file in qt_ar.qm qt_bg.qm qt_ca.qm qt_cs.qm qt_da.qm qt_de.qm qt_en.qm qt_es.qm qt_fi.qm qt_fr.qm qt_gd.qm qt_he.qm qt_hu.qm qt_it.qm qt_ja.qm qt_ko.qm qt_lv.qm qt_pl.qm qt_ru.qm qt_sk.qm qt_tr.qm qt_uk.qm qt_zh_TW.qm ; do
cp $root/share/qt5/translations/$file $pkg/translations
done
echo Done
here the Win64 package: nedit-ng.zip
Ah, I see why my build was about 20-ish MB, I was looking at the zip, not the uncompressed size! Which matches what you got a result too.
here the Win64 package: nedit-ng.zip
Just gave it a try, and it opened successfully on my test box. However, it also opened a cmd window to launch nedit-ng. My build does not open a cmd window.
Maybe for simpler (not Qt app) ldd work as expected, so thank you for suggestion.
It was sufficient for my setup (Qt Creator + MSVC), but perhaps not for you since you have to bundle the MSYS libraries. Well, it doesn't matter, since you already did the hard work to identify the required dll's
was about 20-ish MB, I was looking at the zip
and 7zip package is less than 17 MB, but not accepted by github
it also opened a cmd window to launch nedit-ng
yes, as now I can't avoid that, maybe a build switch will skip that