Open norswap opened 12 years ago
FWIW, as an experiment I tried compiling lcc with my own compiler (Smaller C) for Widnows. After bumping up the sizes of the internal tables/arrays in Smaller C and massaging lcc's code to exclude the features currently unsupported by Smaller C, I got it to compile and seemingly work. What I did outside of Smaller C issues is roughly:
lburg
src\*.md
to produce architecture-specific .c
files (in reality I just did it for mips.md
and removed other architectures (alpha, sparc, x86*) from src\bind.c
; I also stumbled upon the missing check()
function, which I defined as empty, however that's most likely wrong as it should come from dagcheck.md
)src\*.c
That was enough to make lcc compile tiny snippets of C code like the following into MIPS assembly:
int a = 4;
int inca(void) { return ++a; }
Not terribly hard.
The limits tests fails because the VC headers became too complex for LCC to handle. In this case, VAARGS
for macros are present.
You cannot use any standard header anymore because of that, you should define standard functions and whatsover manually.
Plus, for VC2015 onwards, which uses the new Universal CRT, your ld
on etc/win32.c
should look something like:
char *ld[] = { "link", "-nologo",
"", "-subsystem:console", "-entry:mainCRTStartup",
"$2", "-OUT:$3", "$1", "/NODEFAULTLIB", LCCDIR "liblcc.lib", "oldnames.lib", "libcmt.lib", "legacy_stdio_definitions.lib", "libucrt.lib", "kernel32.lib", 0 };
Hope this helps anyone also trying to get this to build and work on Windows.
Building lcc on Windows is basically fubar. The instruction are way outdated.
outp
incpp\cpp.c
clashes with the Windows function of the same name. Renaming it the something else makes the problem go away. (It is only used in thecpp
folder, from memory this includes :cpp.h
,cpp.c
,macro.c
,include.c
and maybe some other I forgot).libc.lib
no longer ships with Visual Studio. It should be replaced withlibcmt.lib
inetc\win32.src
, which is apparently the multi-threaded version.make ... test
) described in the installation guide fails because the filelimits.s
is generated nearly empty. The triple test (make ... triple
) hangs forever.I have not really investigated, but might it not be easier to base the Windows version on MinGW, as it is much closer to how the install works on Unix ?
Also, it would be great to offer precompiled binaries. It might at least be a temporary solution until the build system is fixed.