delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2016/05/16/14:26:05

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Message-ID: <573A10AB.50506@gmx.de>
Date: Mon, 16 May 2016 20:25:47 +0200
From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Trying to link Allegro, but something is wrong. Any pointers
appreciated
References: <e5a345c1-cfcb-4951-bc97-ae41166756ce AT googlegroups DOT com>
In-Reply-To: <e5a345c1-cfcb-4951-bc97-ae41166756ce@googlegroups.com>
X-Provags-ID: V03:K0:/AqZqBPwglO/dN4+0jrfP/A9kztDRzIn6xNYd+wzPPmskLGwNvB
cRQ7sNP1fcdCNsWSC2ag0prNzfLAslCsNPS76KO+oZB5RrfJAcFaxcZHBPUvQNBELR2Tk4K
tZxokowXozfVPqjTJG/7aicO2RFeaAk/ydZzCy23aUFIGp5waZ7AMkQf9jL5TscsDEw8BwK
7h4HCrsNfXmNw2LrPZk6g==
X-UI-Out-Filterresults: notjunk:1;V01:K0:pE652t9Nq1A=:DSRKzky6bFusofxeZZPipJ
rK1EzLWMhSbxsesnRNRR9omb/vgNpAdy6tI+5WgEmhnzFGGrOcFuftK3e1GiQlwi7BnhP6I47
SQfEz1HiTSnVDS6O+m0IZAOig+T1huA49Yo3kKGiJRogAhOkyZl/ouv1OHJJF6TMRMoY/cDlg
7qq3ojtbNGzHFS7wYrQaG2ktTJYUSiwwiXLgrQkqHlVidZBhx1vVXSXAGpcXBFsauhvUwrcBX
qRu/4wI6sMArqSkHhkPUPhb4WvTGSaRxBjUrsTkTgPB1Q9GwzsD+VQnOs4B3ma/ucx0txRsLX
EqgZyFWxdCogHXwJWypgQLHGt695ibl0iqlRr8jxY0vsVbcuMR5OemQ4S/xezXbWFiGUVK9p8
BpBfbBodeHPecV6gWejWKCOgRXe1xpNS/HIJ21trgoAu5Rc44Tg92SitX9Bx09OrEkeEdcpeM
ap/Aw5ONNBtDW4ypXV+2lFps03lAMZmhLK3O4plxavCAkIVKcDWGDfidjpG9g7cRhpmySG72Q
+1be5kOFNqzxXHOS1MH6iD+rlLv9xqhoNOQ278Bm8bwpsgZR5HTvarYxubHohwfAdr5cRTxqt
oqHEhjrq5+csL2ziPni74mIzixICtWSf2gO3wzRB623rM+BFKPedfiU0+cakDhqxp79dcvZaK
0Jvd/RllQ9lJrNXzs/RRq/039Y83Z3Qhw8d9blw6pGoQ7VLVrdmXe9+AR1ckUbO9B5ZxjIIjg
CIK8bQwEB1cAvX9LrcjRGQaMBLyoSvmq/y6F+L8OXoYy9O4m3IsNgJLr2r8GxeKg1aG4W2+1p
zsrcuBX
Reply-To: djgpp AT delorie DOT com

Am 16.05.2016 13:00, schrieb mike AT letsdeliver DOT com [via djgpp AT delorie DOT com]:
> Hi there! A while back I started working on a small personal project, to make a short MS-DOS game, but I'm kind of stumped and could use some pointers from someone experienced.
>
> My main OS is Mac OS X, so I've followed instructions I found online to get DJGPP working (and cross compiling for DOS) on OSX. Which works perfectly, I can generate .EXE files that run on the real thing, from the comfort of my work computer.
>
> So now I'm trying to get Allegro, a game library, to work. I modified the Makefile of an older version (4.2.2, one that still targeted DOS), and managed to get it to compile the liballeg.a library without errors.
>
>  From there, the plan was to make a short "hello world" example using Allegro's functionality. Unfortunately, the linking step is failing.
>
> My repo with all my files (including my copy of Allegro) is here: https://github.com/msikma/allegro-dos-test
>
> Basically, when I run make, it seems to be linking Allegro twice. I get about 18 thousand error messages complaining about multiple definitions. This has me completely stumped. My makefile is here: https://github.com/msikma/allegro-dos-test/blob/be760a4f6cf1a41755813d5d55e15620cf16a12f/Makefile - this assumes that the user first goes into the vendor/allegro-4.2.2-djgpp-xc/ directory to run "xmake.sh lib", which compiles Allegro and generates the liballeg.a file.
>
> Here's a log of make: https://gist.githubusercontent.com/msikma/cb28624117475e24d0e6e0594775ae73/raw/ea76fd4689375fd6169ad6c79f72ed13ce03145b/compile.txt
>
> And the C file I'm trying to compile: https://github.com/msikma/allegro-dos-test/blob/be760a4f6cf1a41755813d5d55e15620cf16a12f/src/main.c
>
> Any help that you could give is greatly appreciated :)
> Michiel Sikma
>


The DJGPP support of allegro has ceased a lot of years ago and I am really
surprised that you have come so far.  I have installed all422s.zip available
at any DJGPP ftp mirror.  This is the last one ported to DJGPP and it is
identical to allegro-4.2.3.1.tar.gz and what you have put in your github.

I have tried to compile all422s out-of-the-box using an actual DJGPP installation
composed by djdev205, gcc610, bnu226br3 and mak41br2 and the configuration step
already miserable failed.  I got the following error message:

configure: creating ./config.status
config.status: creating makefile
config.status: WARNING:  '../allegro-4.2.3.1/makefile.in' seems to ignore the --datarootdir setting
config.status: creating allegro-config
config.status: creating include/allegro/platform/alunixac.h
config.status: executing default commands
makefile:421: *** recipe commences before first target.  Stop.
makefile:421: *** recipe commences before first target.  Stop.

This happens for the DJGPP ports of make 4.0 and make 4.1.
The offending lines were the follwing ones.

# -------- rules for deleting the generated files --------

clean:

    define RM_OBJ_CLEAN_FILES
       $(foreach file, $(OBJ_CLEAN_FILES), rm -f $(file)
       )
    endef

    define RM_OTHER_CLEAN_FILES
       $(foreach file, $(OTHER_CLEAN_FILES), rm -f $(file)
       )
    endef

	$(RM_OBJ_CLEAN_FILES)    <--  This is line 421
	$(RM_OTHER_CLEAN_FILES)


I had to install the DJGPP port of make 3.81 to get the makefile working.

The second issue that will make the build fail is the compiler used.  This
issue is far from trivial because it concerns the changed semantics of the
inline functions at least.  There may be a lot of more issues.  According
to the allegro documentation, it was suposed that the gcc 2.91.N compiler
should be used to compile the code.  I assume that that was the last compiler
for which the build has realy been tested by the allegro maintainers.
You are using some cross compiler, probably some gcc 5.N.N version, and
they have a different semantics for inline functions.  I will certainly
not fix the allegro code.  I have never used it at all, but in similar
circunstances, I use some shell snippet like this:

# Ensure that always old GNU extern inline semantics is used
# (aka -fgnu89-inline) even if ISO C99 semantics has been specified.
case $(gcc --version 2>/dev/null | sed "/^.* \([1-9]\+\.[0-9]\+[.0-9]*\).*$/!d;s/^.* \([1-9]\+\.[0-9]\+[.0-9]*\).*$/\1/") in
[1-3].*|4.[0-1][.0-9]* )  CFLAGS=${CFLAGS='-g2 -O2 -march=i386 -mtune=i586 -Wall -pedantic'};;
* )                       CFLAGS=${CFLAGS='-g2 -O2 -fgnu89-inline -march=i386 -mtune=i586 -Wall -pedantic'};;
esac

to select the correct inline behavior according to the compiler version used.
The bottom line is that for compiler versions greather than gcc 4.1.N you must
add -fgnu89-inline to CFLAGS.  This should reduce the number of duplicated
function definitions a lot.  It should be clear that you have to recompile your
library from scratch.  Your are not linking twice but your library is broken no
matter if the library itself compiles without error messages or not.

This shall only show that the allegro code is quite old and that it has been
tailored to be compiled with programs that are nowadays obsolete.  You are
completely alone to port allegro to the versions of the compilers that you want
to use to write your code.  It is also not clear to my why you do not install
/current/v2tk/allegro/all422ar2.zip.  Probably you will also need
/current/v2tk/allegro/freeb12br3.zip aka freeb12b FreeBE/AF 1.2 for DJGPP V2.

Again, I am not aware of any DJGPP user that still uses allegro for DJGPP or DOS
purposes anymore so you cannot expect much assistance.  You will have to solve
the problems alone or give up.  I have never used allegro in my whole live and
cannot give more assistance.

Regards,
Juan M. Guerrero

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019