dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: AW: AW: [DotGNU]Windows specifica


From: Tobias Oberstein
Subject: AW: AW: AW: [DotGNU]Windows specifica
Date: Sun, 16 Feb 2003 16:10:09 +0100

It's rolling! I've finally managed to build ilrun.exe using VC++.
That is, I use MingW/Cygwin to build all the pnet libs and statically
link them in.

You may get VC++ Workspace/Project stuff for ilrun.exe here:
http://www.brainthat.com/files/ilrun.zip

Portable.NET _is_ portable.

Greets,
Tobias


DETAILS
=======

Deleting intermediate files and output files for project 'ilrun - Win32
Release'.
--------------------Configuration: ilrun - Win32 Release--------------------
Compiling...
ilrun.c
Linking...

ilrun.exe - 0 error(s), 0 warning(s)


address@hidden ~/sandbox/embpnet/win/ilrun/Release
$ ls -la
total 15849
drwxrwxrwx+   2 Administ Kein            0 Feb 16 15:39 .
drwxrwxrwx+   4 Administ Kein         4096 Feb 16 15:16 ..
-rwxrwxrwx    1 Administ Kein         2560 Feb 15 15:41 hello.exe
-rwxrwxrwx    1 Administ Kein     15740928 Feb 16 15:39 ilrun.exe
-rwxrwxrwx    1 Administ Kein        13116 Feb 16 15:39 ilrun.obj
-rwx------+   1 Administ Kein       433464 Feb 16 15:39 ilrun.pch
-rwxrwxrwx    1 Administ Kein        33792 Feb 16 15:39 vc60.idb

address@hidden ~/sandbox/embpnet/win/ilrun/Release
$ ilrun.exe hello.exe
Hello World!

address@hidden ~/sandbox/embpnet/win/ilrun/Release
$ ilrun.exe evenodd.exe
5 is odd
2 is even
100 is even
1000001 is odd



This is what must be done:

1. Add the following directories under VC++
===========================================

Includes:
C:\CYGWIN\HOME\ADMINISTRATOR\LOCAL\INCLUDE\PNET

Libs:
C:\CYGWIN\HOME\ADMINISTRATOR\LOCAL\LIB
C:\CYGWIN\HOME\ADMINISTRATOR\LOCAL\LIB\PNET
C:\MINGW\LIB
C:\MINGW\LIB\GCC-LIB\MINGW32\3.2


2. Link with
============

libgcc.a libmingwex.a libmsvcrt.a
libILEngine.a libILDumpAsm.a libILImage.a libILSupport.a libffi.a libgc.a
wsock32.lib
kernel32.lib user32.lib

The secret was to link against "libgcc.a libmingwex.a libmsvcrt.a". This
resolves the following errors.


libILEngine.a(lib_math.o) : error LNK2001: unresolved external symbol
_remainder

resolved by => C:\MinGW\lib\libmingwex.a


libILSupport.a(ansi.o) : error LNK2001: unresolved external symbol __alloca
libILSupport.a(file.o) : error LNK2001: unresolved external symbol __alloca
libILSupport.a(regex.o) : error LNK2001: unresolved external symbol __alloca
libILSupport.a(getcwd.o) : error LNK2001: unresolved external symbol
__alloca

resolved by => C:\MinGW\lib\gcc-lib\mingw32\3.2\libgcc.a


LINK : warning LNK4049: locally defined symbol "__iob" imported
LINK : warning LNK4049: locally defined symbol "___mb_cur_max" imported
LINK : warning LNK4049: locally defined symbol "__pctype" imported
LINK : warning LNK4049: locally defined symbol "__timezone" imported
libILEngine.a(lib_task.o) : error LNK2001: unresolved external symbol
___p__environ
libILSupport.a(time.o) : error LNK2001: unresolved external symbol
__imp__timezone
OLDNAMES.lib(timezone.obi) : error LNK2001: unresolved external symbol
__imp__timezone

resolved by => C:\MinGW\lib\libmsvcrt.a

Note: a footprint of 15 megs is rather huge, especially when compared
to the 4.8 megs under Unix/pure MingW. I guess in the future we could
try to reduce/isolate above dependencies to get this down.


3. Hack the ilrun.c source
==========================

#if (defined(HAVE_UNISTD_H) && !defined(_MSC_VER))
#include <unistd.h>
#endif


"unistd.h" must only be included when not compiling under VC++


4. Hack pnet/libffi/src/x86/win32.S
===================================

replace

.globl ffi_prep_args

by

.globl _ffi_prep_args


Yes, that's one "_" more! Ridiculous as it seems, this was
the hardest part to figure out. My guess is the following:

The hacked file is an assembler file which gets translated
by the standard Cygwin stuff. But this doesn't fit the object
file where "ffi_prep_args" is defined, which is a C file
compiled using MingW. This is because MingW exports symbols
like VC++, which includes a prefix "_".

Now, the strange thing is, that with the above hack, building
ilrun.exe using MingW is still working. Also VC++ works.

Without the hack, building ilrun.exe with MingW works, but
not with VC++.

It's all magic and maybe I'm plainly wrong, but anyway -
hack it and be happy.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]