Page 1 of 2

Compiling ToME4 (Linux)

Posted: Wed May 12, 2010 8:54 am
by madmonk
Please note this is only for Linux!

If you find that your download does not work and you have to get the source and compile it, a small set of useful things to do...

You may have to install some additional SDL stuff, but the compilation should let you know about that.

1) Get premake (from here)
2) Put it in the top level of the source directory
3) Run this command: ./premake4 --lua=jitx86 gmake
4) Run make
5) To launch ToME4 enter this: ./bin/Debug/t-engine
6) You can, if you want to be really helpful and capture the output do this: ./bin/Debug/t-engine > stdout 2>stderr. This will create two files and one will contain lots of really useful info for DG.

Enjoy!

Re: Compiling ToME4 (Linux)

Posted: Wed May 12, 2010 9:05 am
by Canderel
Can windows users also somehow run the program to create both log files?

Re: Compiling ToME4 (Linux)

Posted: Wed May 12, 2010 9:09 am
by madmonk
I don't have Windows, but I don't see why not.

Try it and see if you get the output in the named file (stdout!)

You would have to run from a DOS prompt or add it as a parameter to the executable.

Re: Compiling ToME4 (Linux)

Posted: Wed May 12, 2010 9:26 am
by darkgod
The windows verison automatically generates the logs in stdout.txt file

Re: Compiling ToME4 (Linux)

Posted: Wed May 12, 2010 1:01 pm
by greycat
Alternative compile instructions (worked for me on i386 Debian 5.0):
  1. Unpack premake source.
  2. Code: Select all

    cd premake-4.2.1/build/gmake.unix
    make
    cd ../../bin/release
    sudo cp premake4 /usr/local/bin
  3. (Optional) delete the premake source.
  4. Unpack t-engine wherever you want it to stay forever. You'll be playing the game from here, rather than installing it like a regular application.
  5. Code: Select all

    cd t-engine4-src-1.0.0beta1
    premake4 gmake
    make
  6. To run the game: bin/Debug/t-engine
If you want to log the output (and errors) but also see them on the screen, you can run the game like this:

bin/Debug/t-engine 2>&1 | tee logfile

This assumes a Bourne-family (non-csh, non-tcsh) shell, as does madmonk's version.

Re: Compiling ToME4 (Linux)

Posted: Wed May 12, 2010 1:26 pm
by forkbomb
I got lazy just ran this (Fedora 12):

Code: Select all

yum install SDL*devel
That'll give you pretty much all the SDL packages in the repos even though all of it isn't needed for T4. Shouldn't be too huge of a DL. I also had lua-devel installed and god knows how many other libs installed.

Any other Fedora users curious about compiling it could just run

Code: Select all

yum groupinstall "Development Tools"
That'll give you a bunch of packages that aren't strictly needed for this particular compile job (though it is a nice group to have installed) but if you have a decent sized hard drive and a quick connection it shouldn't be earth-shattering. But, you'll still need to grab premake4 (I just dumped it in /usr/bin).

For totally overkill "god mode" also run...

Code: Select all

yum groupinstall "Development Libraries"
...to get the kitchen sink of source stuff in the repositories, but that will be a relatively large download (and continued large downloads to keep them up to date as upgrades hit the repositories).

Built clean for me.

Re: Compiling ToME4 (Linux)

Posted: Thu May 13, 2010 3:18 pm
by Nerdanel
Gentoo doesn't have premake in portage. Annoying...

Then it turns out that premake is majorly complicated to build by hand. Double annoying... It was easier the old way. Also, since premake has to be bootstrapped by itself, I'm (doubtless needlessly) reminded of the famous historical exploit in which a compiler was built to add a backdoor to things it compiled and add that feature to the compilers it compiled, and then the backdoor code was removed from the source but added indetectably back when the source was compiled with the version of itself with the backdoor in. I'm just feeling a little paranoid...

Anyway, since I'm supposed to be writing an article on my work in the ToME community, upon reflection I feel it's all right for me to check up the new beta so that I can write about it in an informed fashion.

Re: Compiling ToME4 (Linux)

Posted: Thu May 13, 2010 3:23 pm
by darkgod
;)

The binaries provided by premake4 worked for me on all platforms I tested them.

And trust me it is NOT easier to maintain 10 separate makefiles ;)

Re: Compiling ToME4 (Linux)

Posted: Thu May 13, 2010 3:31 pm
by Nerdanel
Once you get the file structure stabilized, you might to want to switch to the old style savefiles. That way everyone else in the world who needs to compile to play ToME 4 doesn't have to jump through multiple hoops.

Re: Compiling ToME4 (Linux)

Posted: Thu May 13, 2010 7:28 pm
by greycat
Nerdanel is referring to Ken Thompson's infamous C compiler hack. (It's difficult to find an authoritative source for this, so I just picked one that looks reasonably concise.)

Re: Compiling ToME4 (Linux)

Posted: Wed May 11, 2011 2:28 pm
by sindikat
Hi all! I did everything as said in http://te4.org/wiki/howtocompile, but installed premake from debian 6.0 official repositories. Now when i do "premake gmake" in t-engine source folder, it says:

Code: Select all

** premake.lua: build/options.lua:23: attempt to call global 'newoption' (a nil value)
** Script failed to run, ending.
What should i do?

Re: Compiling ToME4 (Linux)

Posted: Wed May 11, 2011 2:36 pm
by tiger_eye
sindikat wrote:What should i do?
Install premake4 from here:

http://industriousone.com/premake

and run

Code: Select all

premake4 gmake
I think the official Debian repositories still only have premake version 3.7, and ToME needs version 4.

Re: Compiling ToME4 (Linux)

Posted: Wed May 11, 2011 2:41 pm
by sindikat
SOLVED
:)

Re: Compiling ToME4 (Linux)

Posted: Sun Oct 21, 2012 6:38 pm
by wobbly
greycat wrote:Alternative compile instructions (worked for me on i386 Debian 5.0):
  1. Unpack premake source.
  2. Code: Select all

    cd premake-4.2.1/build/gmake.unix
    make
    cd ../../bin/release
    sudo cp premake4 /usr/local/bin
  3. (Optional) delete the premake source.
  4. Unpack t-engine wherever you want it to stay forever. You'll be playing the game from here, rather than installing it like a regular application.
  5. Code: Select all

    cd t-engine4-src-1.0.0beta1
    premake4 gmake
    make
  6. To run the game: bin/Debug/t-engine
If you want to log the output (and errors) but also see them on the screen, you can run the game like this:

bin/Debug/t-engine 2>&1 | tee logfile

This assumes a Bourne-family (non-csh, non-tcsh) shell, as does madmonk's version.
I get this (same with madmonks instructions) when running make (on Fedora 17 - 32 bit with SVN source code):

==== Building physfs (debug) ====
physfs.c
../src/physfs/physfs.c:74:5: warning: initialization from incompatible pointer type [enabled by default]
../src/physfs/physfs.c:74:5: warning: (near initialization for ‘supported_types[0]’) [enabled by default]
physfs_unicode.c
physfs_byteorder.c
physfsrwops.c
In file included from ../src/physfs/physfsrwops.h:27:0,
from ../src/physfs/physfsrwops.c:24:
../src/tSDL.h:7:17: fatal error: SDL.h: No such file or directory
compilation terminated.
make[1]: *** [../obj/Debug/physfs/physfsrwops.o] Error 1
make: *** [physfs] Error 2

Re: Compiling ToME4 (Linux)

Posted: Sun Oct 21, 2012 7:48 pm
by Suslik
apparently compiler cant find SDL. check if it's present and accessible.