Re: [Hampshire] Compiling from source

2023-02-18 Thread Bob Dunlop via Hampshire
Hi,

On Fri, Feb 17 at 12:34, RM via Hampshire wrote:
> Hi all
> 
> Sorry to ask a question I've kind of asked before but...
> 
> I'm trying to compile Elkulator [1] from source.   I've done this before 
> and (forgive me I can't find the name of the list member who very kindly 
> helped) come across similar problems.   The docs tell me that certain 
...


Had a quick look at this, this morning, and have what I think is a solution.
I'm using a current version of Linux Mint but should be close enough to the
Ubuntu base to work.

First I installed the -dev version of all the prerequisite libraries using
the Synaptic package manager (other package managers are available :-).
Be sure to install version 4 of the Allegro library, the newer version 5
is likely to lead to a world of pain.

I also installed the latest automake and autoconf packages.  Automake is
definitely required at least.

Then I unpacked the tarball in a fresh working directory.

  mkdir x
  cd x
  tar xzf ../ElkulatorV1.0Linux.tar.gz 

Delete the symbolic links to the old automake version and replace with
links to the newer automake.  I only installed the links required for the
build, you may need to adjust the version to that you have installed.

  rm compile COPYING depcomp INSTALL install-sh missing
  ln -s /usr/share/automake-1.16/{install-sh,missing,depcomp} . 

There was a few iterations of ./configure && make here, but this is the
final result.

  ./configure 

Edit the uef.c file and correct an over enthusiastic pointer indirection.
I guess earlier compilers where not as sharp on their type checking.
There are a lot of other compiler warnings about memory safety etc that
should also be corrected, but this is the one that is stopping compilation.

  vi src/uef.c   (use whichever text editor you are comfortable with)

  Two lines to change as in this diff/patch.

--- z/src/uef.c 2010-07-17 09:15:23.0 +0100
+++ x/src/uef.c 2023-02-18 08:45:05.025148553 +
@@ -12,7 +12,7 @@
 
 int tapelcount,tapellatch,pps;
 int intone=0;
-gzFile *uef;
+gzFile uef;
 int cswena;
 
 int inchunk=0,chunkid=0,chunklen=0;
@@ -256,6 +256,6 @@
 if (uef)
{
gzclose(uef);
-   uef=(gzFile *)NULL;
+   uef=(gzFile)NULL;
}
 }


Then edit the Makefile and add the maths library to the link list.
This is not the autoconf way to patch this and will be overwritten if
you run ./configure again.

  vi src/Makefile

  Just the one line this time.

--- z/src/Makefile  2023-02-18 10:17:18.032321661 +
+++ x/src/Makefile  2023-02-18 08:45:04.793160499 +
@@ -109,7 +109,7 @@
 INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
 LDFLAGS = 
 LIBOBJS = 
-LIBS = -lalut -lopenal -lz
+LIBS = -lalut -lopenal -lz -lm
 LTLIBOBJS = 
 MAKEINFO = ${SHELL} /home/rjd/tmp/z/missing --run makeinfo
 MKDIR_P = /usr/bin/mkdir -p


Finally.

  make
  ./elkulator 

HTH
-- 
Bob Dunlop

-- 
Please post to: Hampshire@mailman.lug.org.uk
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--


Re: [Hampshire] Compiling from source

2023-02-18 Thread James Dutton via Hampshire
On Sat, 18 Feb 2023 at 10:30, Bob Dunlop via Hampshire <
hampshire@mailman.lug.org.uk> wrote:

> Hi,
>
> On Fri, Feb 17 at 12:34, RM via Hampshire wrote:
> > Hi all
> >
> > Sorry to ask a question I've kind of asked before but...
> >
> > I'm trying to compile Elkulator [1] from source.   I've done this before
> > and (forgive me I can't find the name of the list member who very kindly
> > helped) come across similar problems.   The docs tell me that certain
> ...
>
>
> Had a quick look at this, this morning, and have what I think is a
> solution.
> I'm using a current version of Linux Mint but should be close enough to the
> Ubuntu base to work.
>
>
>
Bob's instructions do in fact work on one of the older Linux Distro
releases.
In more recent Linux distros, with a more up to date compiler, some things
that were previously warning, are not reported as errors, and so the
compiler fails to finish and stops with errors.
So, although I got Elkulator to compile on an older system, it does not
compile on Ubuntu 22.04
The main reasons it fails here on Ubuntu 22.04 is:
1) redefinition of some global variables. It probably needs someone to
decide which file they should be defined in, and make all the other .c
files refer to them as extern ...
2) The code makes quite a few casts from pointers into 32bit ints.  While
that is potentially ok on older 32bit systems, it may cause problems on
64bit systems.
I do not have spare time currently, so cannot go through fixing the
problems, but there are various versions of Elkulator on github, so someone
else might have fixed it.
I think the quickest fix will be installing an older 32bit Distro in a
Virtual Machine and compiling the Elkulator there.
If it helps, I find the error messages output from CLANG/LLVM/LLD more
concise than GCC/LD, so it might be easier to understand what is wrong
using CLANG to compile the program than GCC.
While (1) is potentially relatively easy to fix, (2) requires a deeper
understanding of the code in order to fix it right.

Kind Regards

James
-- 
Please post to: Hampshire@mailman.lug.org.uk
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--


Re: [Hampshire] Compiling from source

2023-02-18 Thread Steve Wesemeyer via Hampshire



Alternatively, wine seems to cope with the windows binary available from 
the http://elkulator.acornelectron.co.uk/ website


Cheers,

 Steve





On 18/02/2023 12:05, James Dutton via Hampshire wrote:
On Sat, 18 Feb 2023 at 10:30, Bob Dunlop via Hampshire 
 wrote:


Hi,

On Fri, Feb 17 at 12:34, RM via Hampshire wrote:
> Hi all
>
> Sorry to ask a question I've kind of asked before but...
>
> I'm trying to compile Elkulator [1] from source.   I've done
this before
> and (forgive me I can't find the name of the list member who
very kindly
> helped) come across similar problems.   The docs tell me that
certain
...


Had a quick look at this, this morning, and have what I think is a
solution.
I'm using a current version of Linux Mint but should be close
enough to the
Ubuntu base to work.



Bob's instructions do in fact work on one of the older Linux Distro 
releases.
In more recent Linux distros, with a more up to date compiler, some 
things that were previously warning, are not reported as errors, and 
so the compiler fails to finish and stops with errors.
So, although I got Elkulator to compile on an older system, it does 
not compile on Ubuntu 22.04

The main reasons it fails here on Ubuntu 22.04 is:
1) redefinition of some global variables. It probably needs someone to 
decide which file they should be defined in, and make all the other .c 
files refer to them as extern ...
2) The code makes quite a few casts from pointers into 32bit ints.  
While that is potentially ok on older 32bit systems, it may cause 
problems on 64bit systems.
I do not have spare time currently, so cannot go through fixing the 
problems, but there are various versions of Elkulator on github, so 
someone else might have fixed it.
I think the quickest fix will be installing an older 32bit Distro in a 
Virtual Machine and compiling the Elkulator there.
If it helps, I find the error messages output from CLANG/LLVM/LLD more 
concise than GCC/LD, so it might be easier to understand what is wrong 
using CLANG to compile the program than GCC.
While (1) is potentially relatively easy to fix, (2) requires a deeper 
understanding of the code in order to fix it right.


Kind Regards

James








-- 
Please post to: Hampshire@mailman.lug.org.uk
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--