[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Compiling under MSVC
From: |
Brown Dragon |
Subject: |
Re: [Chicken-users] Compiling under MSVC |
Date: |
Mon, 17 Nov 2008 15:34:07 +0530 |
Hi Felix,
Thanks a lot! I will try the patch. Coincidentally, I also just found
a fix by patching "defaults.mak" (patch below). There is a similar
problem in Makefile.mingw (lines 193-205), which means that the exe
uploaded on the chicken site also has the problem (I checked - csc
fails with C:/chickeninclude instead of C:/chicken/include).
After patching defaults.mak the build generates all the libs etc
*almost* perfectly. However I get this warning when compiling:
link -nologo chicken.obj batch-driver.obj compiler.obj optimizer.obj
support.obj c-platform.obj c-backend.obj -out:chicken.exe \
libchicken.lib ws2_32.lib advapi32.lib
Creating library chicken.lib and object chicken.exp
chicken.obj : warning LNK4217: locally defined symbol
_C_support_toplevel imported in function _f_720
chicken.obj : warning LNK4217: locally defined symbol
_C_compiler_toplevel imported in function _f_723
chicken.obj : warning LNK4217: locally defined symbol
_C_optimizer_toplevel imported in function _f_726
chicken.obj : warning LNK4217: locally defined symbol
_C_driver_toplevel imported in function _f_729
chicken.obj : warning LNK4217: locally defined symbol
_C_platform_toplevel imported in function _f_732
chicken.obj : warning LNK4217: locally defined symbol
_C_backend_toplevel imported in function _f_735
Compiling with the static lib now works (csc -static). However,
without the -static flag, the compilation fails with:
problem.obj : error LNK2019: unresolved external symbol
_C_fromspace_limit referenced in function _C_toplevel
problem.obj : error LNK2019: unresolved external symbol
_C_fromspace_top referenced in function _C_toplevel
problem.obj : error LNK2019: unresolved external symbol
_C_temporary_stack referenced in function _C_toplevel
problem.obj : error LNK2019: unresolved external symbol _C_stack_limit
referenced in function _C_toplevel
problem.obj : error LNK2019: unresolved external symbol
_C_timer_interrupt_counter referenced in function _f_3153
problem.exe : fatal error LNK1120: 5 unresolved externals
*** Shell command terminated with exit status 1: link problem.obj
-out:problem.exe -nologo -LIBPATH:C:/chicken-3.4.0/lib libchicken.lib
ws2_32.lib advapi32.lib
I don't mind using the -static flag but I can try and fix it if you
point me in the right direction. I tried browsing the generated C-code
but got totally lost pretty quickly.
This is the defaults.mak patch:
417c417
< echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)\\lib\"" >>$@
---
> echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
420c420
< echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)\\lib\"" >>$@
---
> echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/lib\"" >>$@
423c423
< echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)\\share\"" >>$@
---
> echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@
426c426
< echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)\\include\"" >>$@
---
> echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include\"" >>$@
429c429
< echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)\\lib\"" >>$@
---
> echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
433c433
< echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)\\lib\"" >>$@
---
> echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
436c436
< echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)\\lib\"" >>$@
---
> echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/lib\"" >>$@
439c439
< echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)\\share\"" >>$@
---
> echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@
442c442
< echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)\\include\"" >>$@
---
> echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include\"" >>$@
445c445
< echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)\\lib\"" >>$@
---
> echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@
cheers,
/BD
On Mon, Nov 17, 2008 at 2:52 PM, felix winkelmann <address@hidden> wrote:
> On Fri, Nov 14, 2008 at 11:03 AM, Brown Dragon
> <address@hidden> wrote:
>> Hello,
>>
>> I am trying to compile chicken-3.4.0 under MSVC (2003) but am running
>> into problems.
>>
>
> Hi!
>
> I think this patch might fix the problem:
>
> Index: c-backend.scm
> ===================================================================
> --- c-backend.scm (revision 12494)
> +++ c-backend.scm (working copy)
> @@ -923,7 +923,7 @@
> ((null? ll)
> (gen #t "{NULL,NULL}};") )
> (let ((id (lambda-literal-id (car ll))))
> - (gen #t "{\"" id sf "\",(void*)")
> + (gen #t "{\"" id #\: (string->c-identifier sf) "\",(void*)")
> (if (eq? 'toplevel id)
> (if unit-name
> (gen "C_" unit-name "_toplevel},")
>
>
> Getting this to work will require a working chicken. You will have to
> fetch an older chicken tarball and build a "chicken" executable that
> you can the use to compile the 3.4.0 sources with the given
> patch (sorry for the hassle, but this is how it is with bootstrapped
> compilers...).
>
>
> cheers,
> felix
>