?

Log in

Compiling Semagic - 'Twas brillig, and the slithy toves did gyre and gimble in the wabe [entries|archive|friends|userinfo]
Thomas

[ website | Beware the Jabberwock... ]
[ deviantArt | the-boggyb ]
[ FanFiction | Torkell ]
[ Tumblr | torkellr ]

Links
[Random links| BBC news | Vulture Central | Slashdot | Dangerous Prototypes | LWN | Raspberry Pi]
[Fellow blogs| a Half Empty Glass | the Broken Cube | The Music Jungle | Please remove your feet | A letter from home]
[Other haunts| Un4seen Developments | Jazz 2 Online | EmuTalk.net | Feng's shui]

Compiling Semagic [Friday 7th October 2016 at 11:40 pm]
Thomas

boggyb
[Tags|]
[Feeling |accomplishedaccomplished]

So I've been trying off and on for a week now to get Semagic to compile, because I want to try and fix a couple of minor annoyances in it and official development seems to have stalled. Unfortunately the build process doesn't appear to be documented, nor are the required dependencies, and it's turning into a game of throwing random dependencies together in the hope that it compiles. For added fun the source tarball contains project files for Visual C++ 6, Visual C++ 2003 and Visual C++ 2005... but it's not clear which one is actually used.

There was plenty of fail which I'm not detailing here because I wasn't writing it up on the first few days (I foolishly thought this would be a simple job). What doesn't work is Visual Studio 2005 Express (because that doesn't have MFC), the Windows 2003 SDK (fails to link using VC6 as the debug information has changed), or any of the more recent SDKs like the Windows 7 one (also fails to link using VC6). I didn't try the latest Visual Studio Community edition.

Anyway, lets go back to the beginning and see if a slightly less random approach pans out better. Just for laughs I'll throw it at the (ancient) VC6 SDK and see how far we get with the Win32 Unicode Release flavour...

Compiling...
StdAfx.cpp
E:\Data\Source\Semagic\stdafx.h(42) : fatal error C1083: Cannot open include file: 'mshtmlc.h': No such file or directory
Error executing cl.exe.


...not very far would be the answer. Let's try something a bit more recent, like the February 2003 SDK which should still be compatible with VC6 (unlike the Server 2003 SDK which isn't, despite what the Internets think). Installing that is tricky on 64-bit Windows 7 as setup.exe insists on running the Itanium setup64.exe, so you have to run all the *-x86.msi files in the setup folder.

Compiling...
link.cpp
E:\Data\Source\Semagic\link.h(3) : fatal error C1083: Cannot open include file: 'atlapp.h': No such file or directory
MainFrm.cpp
E:\Data\Source\Semagic\MainFrm.cpp(13589) : fatal error C1083: Cannot open include file: 'tidy/tidy.h': No such file or directory
Error executing cl.exe.


That's a bit more promising. And even better, link.h contains "#include <atlapp.h> //WTL /http://wtl.sourceforge.net/" so there's one clue there - I need WTL, which is the Windows Template Library. For tidy.h, I'm guessing that this is HTML Tidy (Semagic has an option to use it). The latest version has a slightly different naming structure so after changing the includes and updating the header/library paths this happens:

Compiling...
new_lj.cpp
E:\Data\Visual C++ Projects\3rd party\Windows Template Library 9.1.5321 Final\Include\atlgdi.h(3441) : error C2664: 'CreateCompatibleDC' : cannot convert parameter 1 from 'struct HDC__ *' to 'class CDC *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\Data\Visual C++ Projects\3rd party\Windows Template Library 9.1.5321 Final\Include\atlgdi.h(3445) : error C2065: 'SelectBitmap' : undeclared identifier
E:\Data\Visual C++ Projects\3rd party\Windows Template Library 9.1.5321 Final\Include\atlgdi.h(3445) : error C2440: '=' : cannot convert from 'int' to 'struct HBITMAP__ *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
E:\Data\Source\Semagic\new_lj.cpp(4704) : fatal error C1083: Cannot open include file: 'iTunesCOMInterface.h': No such file or directory
Error executing cl.exe.


The iTunes one is easy enough to sort out - since I don't use iTunes and can't be bothered with getting a developer account, I'll just comment out the "#define ITUNES_COM" in New_lj.h. The other errors appear to be some weird conflict between WTL and MFC - I've no idea how what the correct fix is, but I've bodged one by editing atlgdi.h and changing "class CMemoryDC : public CDC" to "class CMemoryDC : public WTL::CDC". And finally it all compiles! It even links, once I remember to add tidy.lib to the include libraries!

Compiling...
Linking...
Creating library new_lj___Win32_Unicode_Release/LiveJournalU.lib and object new_lj___Win32_Unicode_Release/LiveJournalU.exp


But does it blend run? Amazingly, yes (once I drop tidy.dll next to LiveJournalU.exe)!

Next up: bugfixing.
Link | Previous Entry | Share | Next Entry[ Penny for your thoughts? ]