Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Tux

How to make windows binaries from arch linux... !

Recommended Posts

Posted (edited)

Quite a lot of things to do finally, I did that in 2 days because of a stupid problem between freetype and sdl_ttf. Most people would probably want to use directly mingw32, but it's useful for me to have everything in linux, I can even test the binaries using wine (for most cases, not all of them).

So, your new home will be aur for most of this : https://aur.archlinux.org/ and its chaotic aur repository there : https://lonewolf.pedrohlc.com/chaotic-aur/

chaotic aur doesn't compile everything in aur, but it will allow you to save some time. There are some binary packages directly available from aur, but installing them from chaotic aur will allow to update them automatically when an update is available. You'll want to follow the instructions to add it on the page, and don't forget the gpg keys !

After this start by installing gcc for mingw32 : mingw-w64-gcc-bin it will install its dependencies like binutils, crt, winpthreads... Also notice that it installs 2 compilers and 2 environments, apparently using -m32 or -m64 in windows is not the best solution... So in /usr/i686-w64-mingw32 you have the 32 bit version, and /usr/x86_64-w64-mingw32 contains the 64 bit. Also you get some commands prefixed by the target in /usr/bin, like i686-w64-mingw32-gcc.

After that most of the packages will be in aur and not in chaotic aur, you can always search them using pacman -S -s packazge, but don't hope too much ! You'll want to edit /etc/makepkg.conf to at least set the number of parallel jobs on your system :

MAKEFLAGS="-j16"

if you have 16 cores (!), it will speed up things a lot when you need to compile something !

When a package is in aur and not in chaotic, you'll need git. click on the result after searching it, copy the git link, use it in a git clone command, chdir to the created directory and type makepkg -si, this will take care of things.

Now you'll need :

mingw-w64-pkg-config and mingw-w64-configure. For configure, the way to use it is from any source directory :

mkdir build
cd build
i686-w64-mingw32-configure [options]

and it will automatically call ../configure with the right options and environment so that the compilation uses the right options and installs in the right directory for this target.

Then the list of packages :
mingw-w64-bzip2
mingw-w64-zlib
mingw-w64-openssl
mingw-w64-libssh2
mingw-w64-libiconv
mingw-w64-libunistring
mingw-w64-libidn2
mingw-w64-libpsl
mingw-w64-curl
mingw-w64-sdl
mingw-w64-libpng
mingw-w64-freetype2-bootstrap
mingw-w64-sdl_ttf

A notice about freetype 2.10.1 & sdl_ttf : for some weird reason, sdl_ttf doesn't seem to like the libfreetype.a produced by freetype, it sends libtool to use /usr/lib for its libraries which will produce undefined refereces errors related to __chk symbols ! There is a simple solution though : rename the libfreetype.a to something else like libfreetype.static.a and then libfreetype.dll.a to libfreetype.a. With this it works, don't ask me why, libtool is a black box in this kind of cases ! It was not necessary before, sdl_ttf is small and was one of the easiest packages to install, so this fix might be not necessary anymore in the future...

mingw-w64-cmake
mingw-w64-muparser
mingw-w64-libogg
mingw-w64-libvorbis
nasm (if you want a 32 bits build with asm inside !)
mingw-w64-flac
mingw-w64-termcap
mingw-w64-gettext
 

Oops, almost forgot : you'll need 2 packages to download directly from their page on the web :
sdl_image :
https://www.libsdl.org/projects/SDL_image/release-1.2.html
that's the time to use your new i686-w64-mingw32-configure command and x86_64-w64-mingw32. You'll need to run them separately and of course in an empty directory for each, except that there is no trouble here, raine only needs libpng for the pictures and it's already installed.
sdl_sound : this one is harder because they didn't make an official release for the last 1.0 release, so grab the latest version from here :

http://hg.icculus.org/icculus/SDL_sound/archive/final-lgpl-revision.tar.bz2
from memory it fails at compiling the examples, but it's yet again some weirdness from libtool, you can fix them manually or just ignore them, launch the make install command, it will install the lib and the include files even if it fails for the examples and that's all you need. At a time this version required libmpg123 from the mpg123 package, apparently they now included the part needed directly in their sources, so nothing special should be needed.

and that's all folks ! ;-)

After this, you can edit raine's makefile to choose your options, you need to set at least the target (it's possible only from today, it makes cross compiling much easier), then choose NO_ASM=1 for a 64 bits build (in this case target should be x86_64-w64-mingw32), otherwise in 32 bits it's assembler everywhere ! You can also compile a 32 bits version without any asm, but there's no real point, although the speed difference should be unnoticeable these days... !

Then type make in raine's directory and normally you should get a nice new binary.

You can test the binary using wine in linux, you'll have to enable the multilib repository for that, see arch's wiki for that : https://wiki.archlinux.org/index.php/Official_repositories#multilib

Edited by Tux

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...