English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 02 February 2010, 13:15   #1
gilgamesh
Linux snob
 
gilgamesh's Avatar
 
Join Date: Sep 2008
Location: Monkey Island
Posts: 997
DIY Compiling WinUAE 2.0.x

This is a recipe for those who want to build WinUAE 2.0.x from the ground up. Using Toni's libs&headers packs will make things a lot easier. I used the sources of a 2.0.2 beta.


The Tools

I used Visual Studio 2008 Express. You'll need the DirectX SDK, WDK, and Windows 7 SDK. Last but not least go and install Nasm.


Preparations

Install WinPcap, OpenAL and some Wacom driver for the wintab32.dll on your system.


Getting the Dependencies

The dependencies didn't change very much in comparison to the last version. Enet was introduced in adddition to
(You may want to have a look at this.)

Fetch the stuff and create the directories winuae_include and winuae_libs. Install/unzip all you've got. I assume that you are going to extract all the necessary headers and libs into special folders, so that you don't have to manage each and everything inside VisualStudio.

Copy the following headers and directories to winuae_include
Code:
${Enet}/enet/  
 ${PortAudio}/include/*.h  
 ${zlib}/src/zlib/1.2.3/zlib-1.2.3/*.h  
 ${libpng}/*.h  
 ${WinIO}/WinIo/Source/Dll/WinIo.h  
 ${WacomTablet}/wactab/*.h  
 ${Catweasel}/devel/*.h  
 ${Freetype}/include/*.h  
 ${Freetype}/include/freetype2/freetype/ 
 ${TVicPort}/Examples/MSVC/TVicPort.h  
 ${UnrarDll}/unrar.h  
 ${OpenAL SDK}/include/*.h  
 ${WpdPack}/Include/*.h  
 ${WpdPack}/Include/pcap  
 ${OpenGL}/glext.h  
 ${OpenGL}/glxext.h  
 ${wnaspi3.dll}/wnaspi.h  
 ${ParaPort}/ParaPort.h  
 ${G15 LCDSDK}/LCDSDK/Src/lglcd.h
and into the subdirectory winuae_include/Ghostscript goes
EDIT:
Code:
 ${Ghostscript}/base/*.h
 ${Ghostscript}/imdi/*.h  
 ${Ghostscript}/psi/*.h
${Ghostscript}/psi/iapi.h
${Ghostscript}/psi/ierror.h
WinUAE's calling convention is _stdcall. For compatibility you'll have to adapt some headers.
  • Add _cdecl right of * or after FT_EXPORT( void ) in the files pcap.h, remote-ext.h, freetype.h and packet32.h.
  • Remove the lines referring to extern "C" { and BOOL in WinIO.h.

Building the Libaries

Build the libraries zlib, libpng, enet and portaudio first.
  • Set the calling convention to _stdcall in each project's settings, so that you don't have to edit the headers.
  • For zlib you'll probably want to set the flag HAVE_UNISTD to 0 manually in zconf.h. Build a static library and rename it to zlibstat.lib.
  • libpng.lib wants a copy of zlib in its source tree. Set the option multithreaded (/MT) in its settings. Otherwise there will be unsatisfied references because of the /NODEFAULTLIB (see below).
  • There is a nice tutorial for compiling portaudio (especially for compiling without ASIO).

winuae_libs should contain by now enet.lib, libpng.lib, portaudio_x86.lib, WINTAB32.LIB, freetype.lib, OpenAL32.lib, wpcap.lib, lglcd.lib, Packet.lib, WinIo.lib, zlibstat.lib and later will come prowizard.lib.


Building WinUAE

Before compilation you'll have to modify some of the files:
  • EDIT:Add includes for ghost.h, imain.h and ierrors.h Replace all occurences of gs_main_instance with void in parser.c.
  • Remove all references to getPortInfo in ioport.c
  • Remove _cdecl before portAudioCallback in sound.c.

Now you are almost ready for building the subprojects.
  • Within Nasm's shell execute asm.cmd for compiling hq_x__.obj.
  • Choose a convenient output directory in the project's settings .
  • Set the include paths (order is important).
  • Set the library paths.
  • In the linker's options add /NODEFAULTLIB:MSVCRT.lib. (Btw, you can also remove some DLLs.)

Compile (in this order) build86k, gencpu, genlinetoscr, genblitter, gencomp and prowizard.
gencomp
will only compile as release.
Copy prowizard.lib from c:\dev\lib to winuae_libs.

Compile winuae and copy portaudio_x86.dll, freetype6.dll and zlib1.dll to the output directory.


Run WinUAE



Last edited by gilgamesh; 04 February 2010 at 21:05. Reason: see #11
gilgamesh is offline  
Old 02 February 2010, 22:15   #2
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Very nice work.
One basic question:

Quote:
Before compilation you'll have to modify some of the files:

* Add includes for ghost.h, imain.h and ierrors.h in parser.c.
* Remove all references to getPortInfo in ioport.c
* Remove _cdecl before portAudioCallback in sound.c.
Where is the point that these #include lines have to be added manually?
Shouldn't they be in the WinUAE source code by default?
andreas is offline  
Old 02 February 2010, 22:30   #3
gilgamesh
Linux snob
 
gilgamesh's Avatar
 
Join Date: Sep 2008
Location: Monkey Island
Posts: 997
Yes, I think so. Toni probably uses an older version of Ghostscript and some of the other dependencies.
gilgamesh is offline  
Old 03 February 2010, 09:13   #4
Ian
Global Moderator
 
Ian's Avatar
 
Join Date: May 2001
Location: Derby, UK
Age: 46
Posts: 2,287
Nice guide just what I've always wanted, shame I uninstalled Visual Studio 10 when MAME switched to mingw64. I might try again if they release a 3rd beta.
Ian is offline  
Old 03 February 2010, 20:03   #5
LOGIK123
 
Posts: n/a
Nice Guide... Will be giving it a go over the next few days when I have a bit of time... Will let you know how I get on.

Cheers

LOGIK123
 
Old 03 February 2010, 20:43   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Nice guide but unfortunately I found some issues as usual

Quote:
Originally Posted by gilgamesh View Post
[/code] and into the subdirectory winuae_include/Ghostscript goes
[code]
${Ghostscript}/base/*.h
${Ghostscript}/imdi/*.h
${Ghostscript}/psi/*.h
No, only iapi.h (API headers) and ierrors.h is needed. (Other headers are only needed when building ghostscript, not for API usage)

(you are right that API has changed: parser.c gs_main_instance needs to be replaced with void)

Quote:
Remove _cdecl before portAudioCallback in sound.c.
Portaudio's (internal) calling convention is_cdel so this callback needs to be _cdecl. (Did you test it really workds?)
Toni Wilen is online now  
Old 03 February 2010, 21:33   #7
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Lightbulb

Quote:
Originally Posted by Toni Wilen View Post
Nice guide but unfortunately I found some issues as usual
Is that bad?

Well, if we can expect some future source fixes in return that may make some of those ... uh ... kludges obsolete, it was worth it
Even those freaks compiling their stuff themselves should not need to mess around in the given code too much to get things compiled...
(IMHO && YMMV)
andreas is offline  
Old 03 February 2010, 22:37   #8
gilgamesh
Linux snob
 
gilgamesh's Avatar
 
Join Date: Sep 2008
Location: Monkey Island
Posts: 997
Thank you all for your comments. But now to the issues
Quote:
Originally Posted by Toni Wilen View Post
No, only iapi.h (API headers) and ierrors.h is needed. (Other headers are only needed when building ghostscript, not for API usage)
That doesn't work for me, I'm afraid. Do you use Ghostscript 8.70? "*.h" might be narrowed, but not omitted. I also definitely need additional #include statements, too (see first point under "Building WinUAE").

Quote:
Originally Posted by Toni Wilen View Post
Portaudio's (internal) calling convention is_cdel so this callback needs to be _cdecl.
The "_cdecl" results in a C2440 error. Portaudio (like all the other libraries I recompiled) was set to use _stdcall (see first point under "Building the Libraries").

Quote:
Originally Posted by Toni Wilen View Post
(Did you test it really workds?)
Yes, if you consider Turrican II a test?
gilgamesh is offline  
Old 04 February 2010, 16:20   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Quote:
Originally Posted by gilgamesh View Post
Thank you all for your comments. But now to the issues

That doesn't work for me, I'm afraid. Do you use Ghostscript 8.70? "*.h" might be narrowed, but not omitted. I also definitely need additional #include statements, too (see first point under "Building WinUAE").
Yes, my ghostscript header directory only contains iapi.h and ierrors.h (says "/* $Id: iapi.h 9043 2008-08-28 22:48:19Z giles $ */" in iapi.h, copied from 8.70 psi-directory)

Quote:
The "_cdecl" results in a C2440 error. Portaudio (like all the other libraries I recompiled) was set to use _stdcall (see first point under "Building the Libraries").
Ah ok, but now there will be issues if you use official portaudio dlls.. (if/when there is official available)
Toni Wilen is online now  
Old 04 February 2010, 20:32   #10
gilgamesh
Linux snob
 
gilgamesh's Avatar
 
Join Date: Sep 2008
Location: Monkey Island
Posts: 997
Quote:
Originally Posted by Toni Wilen View Post
Yes, my ghostscript header directory only contains iapi.h and ierrors.h (says "/* $Id: iapi.h 9043 2008-08-28 22:48:19Z giles $ */" in iapi.h, copied from 8.70 psi-directory)
I have the very same ID in my ierrors.h. Now this is strange. Where do you get the type gs_main_instance from? Not from imain.h?

This is the dilemma: Without imain.h I get syntax and undeclared identifier errors, e.g. C2143 in line 85 parser.c, C2065 for GSAPI_NEW_INSTANCE, GSAPI_DELETE_INSTANCE, etc. (71 errors in parser.c). gmain.h depends on ghost.h. ghost.h depends on several Ghostscript headers.

(My method works for me anyway, but I'd like to understand what went wrong.)
gilgamesh is offline  
Old 04 February 2010, 20:41   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Quote:
Originally Posted by gilgamesh View Post
I have the very same ID in my ierrors.h. Now this is strange. Where do you get the type gs_main_instance from? Not from imain.h?
See above.

Quote:
gs_main_instance needs to be replaced with void
Toni Wilen is online now  
Old 04 February 2010, 21:08   #12
gilgamesh
Linux snob
 
gilgamesh's Avatar
 
Join Date: Sep 2008
Location: Monkey Island
Posts: 997
Wow, now I see. Thanks. I have included this into the document. This saves more than 500 include files.
gilgamesh is offline  
Old 07 February 2010, 06:44   #13
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
... and makes building the thing now a walk in the park! Awesome, guys!
andreas is offline  
Old 09 July 2010, 16:02   #14
Heiroglyph
Registered User
 
Join Date: Jun 2010
Location: USA
Posts: 97
I can build 2100, but not 2200.

Is anyone else getting a slew of these with 2200?

Error 3 error LNK2001: unresolved external symbol "void __fastcall op_c108_23_ff(unsigned int)" (?op_c108_23_ff@@YIXI@Z) winuae cpustbl.obj
Heiroglyph is offline  
Old 09 July 2010, 17:16   #15
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Are you using MSVC 2010 or older? Old MSVC project files are out of date.
Toni Wilen is online now  
Old 09 July 2010, 19:49   #16
Heiroglyph
Registered User
 
Join Date: Jun 2010
Location: USA
Posts: 97
I started with my VS2008 Pro, then installed vc2010 Express with the same error.

I'd rather not use 2010 (I use 2008 for work). I'm not a fan of the per project vc directories, among other things.

Thanks,
John
Heiroglyph is offline  
Old 09 July 2010, 19:53   #17
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Quote:
Originally Posted by Heiroglyph View Post
I started with my VS2008 Pro, then installed vc2010 Express with the same error.

I'd rather not use 2010 (I use 2008 for work). I'm not a fan of the per project vc directories, among other things.

Thanks,
John
op_c108_23 is in cpuemu_21.c (68030+ "cycle exact" core), you sure you recompiled build68k and gencpu?

Delete all cpuemu*.c files and rebuild build68k and all gen* projects.

(and as usual, I don't support old versions, whatever the program )
Toni Wilen is online now  
Old 10 July 2010, 17:25   #18
Heiroglyph
Registered User
 
Join Date: Jun 2010
Location: USA
Posts: 97
Yes, I did that repeatedly after looking at the build steps for those projects and finding the build order. I even deleted and replaced the source archive multiple times to make sure I didn't unintentionally change something.

For now I'm just going to stick with 2100, it's fine for what I'm doing at the moment.

I'm mainly trying to familiarize myself with how it works, mostly turning off features to simplify the code path and stepping through it.

You probably know this, but a lot of the #defines can't be turned off without adding quite a few #ifdefs. You're welcome to my changes if you want, but I thought I read somewhere that you weren't a fan of lots of #ifdefs.

Thanks, it's awesome work.
John
Heiroglyph is offline  
Old 10 July 2010, 17:43   #19
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
Quote:
Originally Posted by Heiroglyph View Post
You probably know this, but a lot of the #defines can't be turned off without adding quite a few #ifdefs. You're welcome to my changes if you want, but I thought I read somewhere that you weren't a fan of lots of #ifdefs.
No one is maintaining those. I only build "all-in-one" versions anyway
(perhaps your problem was missing #define CPUEMU_21)
Toni Wilen is online now  
Old 10 July 2010, 19:00   #20
Heiroglyph
Registered User
 
Join Date: Jun 2010
Location: USA
Posts: 97
I double checked that just now and all the CPU defines are there, I wanted those.

What I've removed are just defines for emulated hardware I don't ever intend to use (Arcadia, Akiko, parallel and serial ports, SCSI hardware, etc). This also had the bonus of removing a lot of the dependencies.

It's a little overwhelming with everything enabled and fixing those ifdefs actually gave me a better understanding of the code.
Heiroglyph is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dr. Strangelove's guide to compiling WinUAE 1.6.1 gilgamesh support.WinUAE 65 08 July 2010 12:49
Compiling WinUAE 2.1.0 rotacak support.WinUAE 8 06 May 2010 17:09
Idiots guide to compiling WinUAE? Ian New to Emulation or Amiga scene 1 28 September 2009 14:30
Compiling WinUAE with VS 2005 Express ? girv support.WinUAE 23 04 December 2006 21:26
Compiling WinUAE 1.3.2 rotacak support.WinUAE 1 06 October 2006 20:34

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:09.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11916 seconds with 13 queries