Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » [A4]How to cross-compile allegro on mingw for Gitlab CI

This thread is locked; no one can reply to it. rss feed Print
[A4]How to cross-compile allegro on mingw for Gitlab CI
larienna
Member #3,185
January 2003
avatar

So far, I have successfully cross-compiled on linux a windows program using mingw64 if only using the basic libc libraries. I also managed to configure a remote CI cross-compilation on gitlab and it worked.

Now, If I try to do the same with a program that needs the allegro library, it fails as it cannot find any of the libs and includes. That is normal since Mingw use it's own set of lib and includes instead of those installed on the system.

So I guess, I'll have to re-build Allegro library specifically for mingw 32bit and 64 bit compiler. So the questions are:

  • How can I build my own lib for mingw on my local machine?

  • Is there some pre-compiled binaries I can use instead of building it? Is there some artifacts somewhere I can just download?

  • Is there a way to shorten the build process? (For example, not building the tools, examples, etc) Since it could consume too much CI time if I have to rebuild allegro after each commit.

Enjoy! and have fun

dthompson
Member #5,749
April 2005
avatar

It's been a looong time since I've touched A4, but I can give you some pointers re CI and cross-compiling.

To get build times down, you'll probably want to bring your own Docker image with mingw64 pre-installed. I dug out one I used ages ago for cross-compiling with A5, which is as follows:

FROM ubuntu:20.04

RUN apt-get update
RUN apt-get install -y p7zip-full mingw-w64
RUN mkdir /allegro-w64
RUN curl -L https://github.com/liballeg/allegro5/releases/download/5.2.6/allegro-x86_64-w64-mingw32-gcc-9.2.0-posix-seh-dynamic-5.2.6.zip > /allegro-w64/allegro.zip
RUN curl -L https://github.com/liballeg/allegro_winpkg/releases/download/1.11.0/allegro_deps-x86_64-w64-mingw32-gcc-9.2.0-posix-seh-1.11.0.zip > /allegro-w64/deps.zip
RUN cd /allegro-w64 && 7z x allegro.zip && 7z x deps.zip && \
  cp -r /allegro-w64/allegro/bin/*          /usr/x86_64-w64-mingw32/bin/     && \
  cp -r /allegro-w64/allegro/include/*      /usr/x86_64-w64-mingw32/include/ && \
  cp -r /allegro-w64/allegro/lib/*          /usr/x86_64-w64-mingw32/lib/     && \
  cp -r /allegro-w64/allegro_deps/include/* /usr/x86_64-w64-mingw32/include/ && \
  cp -r /allegro-w64/allegro_deps/lib/*     /usr/x86_64-w64-mingw32/lib/     && \
  rm -rf /allegro-w64

I'm using A5's precompiled mingw libs here. I believe some have ventured into binary distributions for A4 (Edgar?) but you can find precompiled stuff for some (slightly older) 4.4 releases right here on a.cc. If none of that works, you'll probably want to run the mingw compilation itself inside of the Dockerfile, which I won't go into unless you absolutely need it :P

Also worth noting is that once you've built your CI image, you can host it on GitLab itself.

______________________________________________________
Website. It was freakdesign.bafsoft.net.
This isn't a game!

amarillion
Member #940
January 2001
avatar

If you're using a CI system, you might like my prepared docker images:

Now I've prepared an allegro4 image for linux, and an allegro5 image for mingw and linux. What I don't have yet is an allegro4 image for mingw...

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

dthompson said:

I believe some have ventured into binary distributions for A4 (Edgar?) but you can find precompiled stuff for some (slightly older) 4.4 releases right here on a.cc.

The binaries on a.cc are a decade old by now.

I have a more modern version on bitbucket here :

https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/downloads/Allegro443_GCC81_MinGW_W64_i686_posix_dwarf.7z

You would need the appropriate mingw-w64 from sourceforge to use it though.

I may also be inspired to make up to date versions if you really need them. It isn't too hard.

larienna
Member #3,185
January 2003
avatar

I'll give it a try later when I have more time. I need to wrap things up for my release. Seems that a lot of other CI stuff is also ot working as intended.

Old binaries could be fine since A4 is old. As long as it is compatible with the binaries I am trying to build with Mingw64.

I have not much experience with Docker, besides that the Gitlab CI system use a docker image to build my software.

Enjoy! and have fun

Go to: