Skip to content

Instantly share code, notes, and snippets.

@bardware
Created October 10, 2016 18:35
Show Gist options
  • Select an option

  • Save bardware/d55112fee408bb68a77d50ac91815e18 to your computer and use it in GitHub Desktop.

Select an option

Save bardware/d55112fee408bb68a77d50ac91815e18 to your computer and use it in GitHub Desktop.
# Inspired by https://wiki.filezilla-project.org/wiki/index.php?title=Compiling_FileZilla_3_under_Windows&redirect=no
# pthread tendy to link dynamically, I prefer it statically linked
# Fix missing platform prefix for windres
[ -f /mingw64/bin/x86_64-w64-mingw32-windres.exe ] || ln -s /mingw64/bin/windres.exe /mingw64/bin/x86_64-w64-mingw32-windres.exe
[ -f /mingw32/bin/i686-w64-mingw32-windres.exe ] || ln -s /mingw32/bin/windres.exe /mingw32/bin/i686-w64-mingw32-windres.exe
# Even when statically linking to libstdc++, it still tries to dynamically link to lib(win)pthread. On top of it, libtool is too
# stupid to recognize the semantics of -Wl,-Bstatic. This leaves one option: Removing the dynamic import libraries.
rm /mingw32/i686-w64-mingw32/lib/libpthread.dll.a
rm /mingw32/i686-w64-mingw32/lib/libwinpthread.dll.a
rm /mingw64/x86_64-w64-mingw32/lib/libpthread.dll.a
rm /mingw64/x86_64-w64-mingw32/lib/libwinpthread.dll.a
cd /mingw64/bin
ln -s ld x86_64-w64-mingw32-ld
ln -s ar x86_64-w64-mingw32-ar
ln -s nm x86_64-w64-mingw32-nm
ln -s strip x86_64-w64-mingw32-strip
ln -s ranlib x86_64-w64-mingw32-ranlib
# LFLAGS="-static-libstdc++ -static-libgcc" CXXFLAGS="-static-libgcc -static-libstdc++" CC="gcc -Wall" make
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment