Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Compiling MEKA; SVN

Reply to topic
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Compiling MEKA; SVN
Post Posted: Thu Jun 15, 2006 3:26 pm
Here's a few things I had problems with, trying to get Meka set up today. (Guess my boss is not in the office today...) The ordering is not necessarily logical. I already had TortoiseSVN installed, and got the Meka source that way.

1. You have a lot of stuff to download. Get zlib, libpng, Allegro, MinGW. MinGW is needed to build Allegro for MSVC - strange but true.

2. Be sure to use mingw32-make instead of make. Find it and rename it if you like.

3. If you don't have everything installed in c:\ with short filenames, things break more. To fix Meka's .asm file assembly "custom build steps", use this:
"$(NASM)" -O1 -f win32 "$(InputPath)" -o "$(OutDir)/$(InputName).obj"


4. libpng needs zlib to be there, and ships with a MSVC7 project to build them both. The tester fails because it is not long filename safe, but we don't care. Build the "LIB release" project, I think.

5. MinGW is a nightmare, there are about a million packages and no instructions to tell you which you want. I used this installer to make it work, and ticked "G++" and "w32api". You need to add the "bin" directory to your path after it is installed.

6. Allegro takes forever to build. Be sure to carefully follow the instructions for that in sources.txt, else it won't work.

7. MEKA doesn't use the LIBPNGDIR environment variable as it says it does - add
;"$(LIBPNGDIR)"
to the "Additional Include Directories" if you don't want to add it to your normal MSVC include directories list.

8. MEKA also takes forever to build. Beware messing with settings that cause MSVC to force a rebuild of everything.

9. The libpng and zlib lib files are not in the right place - either copy them to somewhere like the main MSVC lib directory, or change the linker "Additional Dependencies" settings to use the environment variables to find them:
"$(LIBPNGDIR)\libpng.lib"
"$(ZLIBDIR)\zlib.lib"
and copy the lib files to the appropriate places (from libpng\projects\visualc71\Win32_LIB_Release\ and the ZLib directory in there).

10. zlib static is "zlib.lib", not "zlibs.lib", ever since the switch to zlib1.dll I think. The previous change fixes that.

11. You will want to change the libpng and zlib projects from /MD (use msvcrt71.dll) to /MT (don't) in their settings in the libpng solution, before you build and do step 9.

For some reason, the first (successful) build of Allegro didn't work, but the one after it did, and I finally got a mekaw.exe. I started at about 8:45am and finished at 3:39pm, although I wasn't doing this 100% of the time.

It shouldn't be this hard.

How about shipping (ie. including in SVN) pre-built libs + headers for the three libraries used? Then only one person has to deal with it, at least as far as Win32 builds are concerned. Un*x compilers are used to lib hell anyway.

Bock, are you using the SVN repository? I don't see any activity in the last 10 months. It's password-controlled for commits, too (entirely sensibly) - are you able to share the password or add users?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8652
  • Location: Paris, France
Reply with quote
Post Posted: Thu Jun 15, 2006 7:23 pm
Thanks for the feedback.
Managing dependencies under Win32 is always hell, there's no proper perfect way. GNU/Linux is much better when it comes to deal with that.

I agree that eventually shipping some Win32 libraries with the package is a good idea. I will consider and work on it.

I don't know what you mean by "forever to build". A full rebuild of MEKA takes a few minutes here. Allegro certainly takes some time, and Allegro compilation scripts have the problem of not being friendly with filenames with spaces.

I should also consider working on a project using /MD since most precompiled packages for Win32 librairies are done with /MD. /MT is only useful for end-user releases where I want everything statically linked.

I did not use the SVN repository since it was setup but I strongly intend to use it shortly. I setup a local repository to work on it two weeks ago since I did not have the SVN pass handy at that time :P I will switch.
It is possible to add new users with write access but it'll take trust and time to grant that.

Btw you mentionned you got sources thru the SVN, which are not up to date compared with latest WIP snapshots. Did you actually unzipped the WIP package?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8652
  • Location: Paris, France
Reply with quote
Post Posted: Thu Jun 15, 2006 7:25 pm
Btw you may have sound problems with your build since my Allegro was patched to save/restore CPU floating point registers on interrupt switch. This is necessary since the sound emulation code works with interrupts (bad bad) and happens to uses floating point.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Fri Jun 16, 2006 8:05 am
I just updated to the last WIP snapshot. Notice that all timestamps in http://www.smspower.org/meka/snapshots/ are identical due to server changes on 20 Apr - it might be worth renaming the old files to match the newer naming convention since that gives ascending timestamps when sorting by name, and/or using touch to reset the timestamps to match.

Compiling Meka on this computer (MSVC7, Pentium 4 3.2GHz, 4GB RAM) takes precisely 6 minutes and 6 seconds.

I didn't notice any sound problems yet because I didn't actually try running anything yet... if you're using a custom patched Allegro, it's definitely necessary to distribute it, although I'm guessing changing the code to not need the patch would be better.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8652
  • Location: Paris, France
Reply with quote
Post Posted: Sun Jun 18, 2006 2:19 pm
The SVN repository is now up to date, with new changes since the latest WIP snapshots. I batch commited all my changes since 0.71 in two steps (0.71 to WIP 2005-12-03, and WIP 2005-12-03 to my current local trunk). From now on, commits should be smaller and more organized.
I will work a bit more on the SVN repository. Next WIP snapshots will announce the SVN on webpage.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8652
  • Location: Paris, France
Reply with quote
libpnb & zlib
Post Posted: Sun Jun 18, 2006 2:54 pm
Maxim wrote
4. libpng needs zlib to be there, and ships with a MSVC7 project to build them both. The tester fails because it is not long filename safe, but we don't care. Build the "LIB release" project, I think.
[...]
7. MEKA doesn't use the LIBPNGDIR environment variable as it says it does - add
;"$(LIBPNGDIR)"
to the "Additional Include Directories" if you don't want to add it to your normal MSVC include directories list.
[...]
9. The libpng and zlib lib files are not in the right place - either copy them to somewhere like the main MSVC lib directory, or change the linker "Additional Dependencies" settings to use the environment variables to find them:
[...]
10. zlib static is "zlib.lib", not "zlibs.lib", ever since the switch to zlib1.dll I think. The previous change fixes that.
[...]
11. You will want to change the libpng and zlib projects from /MD (use msvcrt71.dll) to /MT (don't) in their settings in the libpng solution, before you build and do step 9.


Actually, libpng is now shipped precompiled for Win32 in MEKA distribution, removing some of your points above. The mistake is that it was still mentionned in sources.txt as a requirement with installation instructions. This is not needed anymore.

I will work on zlib and see if I can also integrate it.

Point 10 (using zlib.lib, not zlibs.lib, was fixed in MEKA WIP 20050910).
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Mon Jun 19, 2006 2:41 pm
I updated just now and it all works very well :) We just need a few more victims testers to see what problems they encounter trying to make it work to declare it 100% idiot-proof.

It might be worth mentioning that, unless you really care about branches and tags and stuff, you should use the SVN address
svn://tprinteractive.com/meka/trunk
Maybe you already did and I didn't realise yet, I just copied the URI from this thread.
  View user's profile Send private message Visit poster's website
  • Joined: 20 Dec 2004
  • Posts: 30
Reply with quote
victim #1
Post Posted: Tue Jun 20, 2006 8:15 pm
Just setup a fresh environment:

Leeching allegro precompiled binaries helped a lot:
http://www.talula.demon.co.uk/allegro/wip.html#unstable

NASM windows binaries found on http://sourceforge.net/projects/nasm
(http://nasm.sourceforge.net seems dead)

and Voila!
(Bock timed 9min between checkout and compiled-meka actually on screen)
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Tue Jun 20, 2006 9:41 pm
Ah, but the precompiled binaries aren't static (and are linked to msvcr*.dll). Getting decent /MT Allegro libs is half the struggle. Nevertheless, I hereby declare it idiot-proof - at least me and proppy have idiot-tested it.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!