Version française
Home     About     Download     Resources     Contact us    
Browse thread
Statically linked win32 libcamlrun.lib?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lally Singh <lally.singh@g...>
Subject: Re: [Caml-list] Statically linked win32 libcamlrun.lib?
On Thu, Apr 15, 2010 at 4:16 PM, Dmitry Bely <dmitry.bely@gmail.com> wrote:
> On Thu, Apr 15, 2010 at 11:16 PM, Lally Singh <lally.singh@gmail.com> wrote:
>> On Thu, Apr 15, 2010 at 2:59 AM, Dmitry Bely <dmitry.bely@gmail.com> wrote:
>>> On Thu, Apr 15, 2010 at 3:39 AM, Lally Singh <lally.singh@gmail.com> wrote:
>>>
>>>>  Is it possible to statically link libcamlrun.lib, so it'll work with
>>>> libcmtd.lib instead of msvcrt.dll?  I've tried:
>>>>
>>>> FLEXLINK=flexlink -merge-manifest -link /nodefaultlib:msvcrt.lib -link
>>>> libcmtd.lib
>>>
>>> Please don't use "brute force" methods. If you need statically linked
>>> MSVC runtime, just replace /MD with /MT (or /MTd) in config/Makefile.
>>
>> Thanks, I've tried this instead, and I can't get through make -f
>> Makefile.nt bootstrap without:
>> ../../boot/ocamlrun ../../ocamlc -nostdlib -I ../../stdlib -w s -c
>> -warn-error A -g -I ../win32unix bigarray.mli
>> File "bigarray.mli", line 384, characters 4-19:
>> Error: Unbound type constructor Unix.file_descr
>> make[2]: *** [bigarray.cmi] Error 2
>>
>> I guess using the flexlink hack just moved whatever underlying problem
>> I'm having to a later stage.
>
> And you have to recompile flexdll_msvc.obj/flexdll_initer_msvc.obj
> with /MT option.
>
> - Dmitry Bely
Thanks, I've flushed my copy of ocaml and untarred fresh.  Replaced
all /MDs with /MTds, and rebuilt flexlink with the same procedure.

Everything seems to run now, until this:

../../boot/ocamlrun ../../tools/ocamlmklib -oc unix accept.obj
bind.obj channels.obj close.obj close_on.obj connect.obj
createprocess.obj du
p.obj dup2.obj errmsg.obj getpeername.obj getpid.obj getsockname.obj
gettimeofday.obj link.obj listen.obj lockf.obj lseek.obj nonblock.obj
m
kdir.obj open.obj pipe.obj read.obj rename.obj select.obj sendrecv.obj
shutdown.obj sleep.obj socket.obj sockopt.obj startup.obj stat.obj sy
stem.obj unixsupport.obj windir.obj winwait.obj write.obj winlist.obj
winworker.obj windbug.obj access.obj addrofstr.obj chdir.obj chmod.obj
 cst2constr.obj cstringv.obj envir.obj execv.obj execve.obj execvp.obj
exit.obj getcwd.obj gethost.obj gethostname.obj getproto.obj getserv.
obj gmtime.obj putenv.obj rmdir.obj socketaddr.obj strofaddr.obj
time.obj unlink.obj utimes.obj -ldopt ws2_32.lib
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined
in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined
in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
msvcrt.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
msvcrt.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
msvcrt.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
msvcrt.lib(cinitexe.obj)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter already
defined in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already
defined in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encoded_null already
defined in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already
defined in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already
defined in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(typname.obj) : error LNK2005:
___clean_type_info_names_internal already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already
defined in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already
defined in msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func already defined in
msvcrt.lib(MSVCR90.dll)
LIBCMTD.lib(fflush.obj) : error LNK2005: __flushall already defined in
msvcrt.lib(MSVCR90.dll)
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall
type_info::type_info(class type_info const &)"
(??0type_info@@AAE@ABV0@@Z) alr
eady defined in LIBCMTD.lib(typinfo.obj)
msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info &
__thiscall type_info::operator=(class type_info const &)"
(??4type_info
@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
   Creating library
C:\DOCUME~1\lsingh9\LOCALS~1\Temp\dyndll_implib3ca81d.lib and object
C:\DOCUME~1\lsingh9\LOCALS~1\Temp\dyndll_implib3ca8
1d.exp
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of
other libs; use /NODEFAULTLIB:library
LIBCMTD.lib(crt0.obj) : error LNK2019: unresolved external symbol
_main referenced in function ___tmainCRTStartup
.\dllunix.dll : fatal error LNK1120: 1 unresolved externals

I verified that every object file in that directory was compiled with
/MTd.  Is there something else I need to feed into the Makefile to
make ocamlmklib do the right thing?

Thanks for all the help!

-Lally