* Statically linked win32 libcamlrun.lib? @ 2010-04-14 23:39 Lally Singh 2010-04-15 6:59 ` [Caml-list] " Dmitry Bely 0 siblings, 1 reply; 7+ messages in thread From: Lally Singh @ 2010-04-14 23:39 UTC (permalink / raw) To: caml-list Hello all, 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 in config/Makefile, and it all builds. However, I still get: libcamlrun.lib(sys.obj) : error LNK2019: unresolved external symbol __imp__system referenced in function _caml_sys_system_command libcamlrun.lib(floats.obj) : error LNK2019: unresolved external symbol __imp__frexp referenced in function _caml_frexp_float libcamlrun.lib(floats.obj) : error LNK2019: unresolved external symbol __imp__modf referenced in function _caml_modf_float libcamlrun.lib(startup.obj) : error LNK2019: unresolved external symbol __imp__sscanf referenced in function _scanmult libcamlrun.lib(startup.obj) : error LNK2019: unresolved external symbol __imp___beginthread referenced in function _caml_main Any thoughts? Sadly I have to do it this way -- we're linking a -output-obj'd .obj into our DLL (which must be statically linked to the runtime) and then linking libcamlrun.lib to that -- or at least hoping to. Thanks in advance for any help! Cheers, -Lally ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] Statically linked win32 libcamlrun.lib? 2010-04-14 23:39 Statically linked win32 libcamlrun.lib? Lally Singh @ 2010-04-15 6:59 ` Dmitry Bely 2010-04-15 19:16 ` Lally Singh 0 siblings, 1 reply; 7+ messages in thread From: Dmitry Bely @ 2010-04-15 6:59 UTC (permalink / raw) To: caml-list 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. > in config/Makefile, and it all builds. However, I still get: > > libcamlrun.lib(sys.obj) : error LNK2019: unresolved external symbol > __imp__system referenced in function _caml_sys_system_command > libcamlrun.lib(floats.obj) : error LNK2019: unresolved external symbol > __imp__frexp referenced in function _caml_frexp_float > libcamlrun.lib(floats.obj) : error LNK2019: unresolved external symbol > __imp__modf referenced in function _caml_modf_float > libcamlrun.lib(startup.obj) : error LNK2019: unresolved external > symbol __imp__sscanf referenced in function _scanmult > libcamlrun.lib(startup.obj) : error LNK2019: unresolved external > symbol __imp___beginthread referenced in function _caml_main > > Any thoughts? Ocaml expects C runtime functions exported from a DLL (they have __implib prefix). No surprise - MSVC runtime is not a link time choice and requires correct compile time flags. > Sadly I have to do it this way -- we're linking a -output-obj'd .obj > into our DLL (which must be statically linked to the runtime) and then > linking libcamlrun.lib to that -- or at least hoping to. > > Thanks in advance for any help! - Dmitry Bely ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] Statically linked win32 libcamlrun.lib? 2010-04-15 6:59 ` [Caml-list] " Dmitry Bely @ 2010-04-15 19:16 ` Lally Singh 2010-04-15 20:06 ` Dmitry Bely 2010-04-15 20:16 ` Dmitry Bely 0 siblings, 2 replies; 7+ messages in thread From: Lally Singh @ 2010-04-15 19:16 UTC (permalink / raw) To: Dmitry Bely; +Cc: caml-list 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. > >> in config/Makefile, and it all builds. However, I still get: >> >> libcamlrun.lib(sys.obj) : error LNK2019: unresolved external symbol >> __imp__system referenced in function _caml_sys_system_command >> libcamlrun.lib(floats.obj) : error LNK2019: unresolved external symbol >> __imp__frexp referenced in function _caml_frexp_float >> libcamlrun.lib(floats.obj) : error LNK2019: unresolved external symbol >> __imp__modf referenced in function _caml_modf_float >> libcamlrun.lib(startup.obj) : error LNK2019: unresolved external >> symbol __imp__sscanf referenced in function _scanmult >> libcamlrun.lib(startup.obj) : error LNK2019: unresolved external >> symbol __imp___beginthread referenced in function _caml_main >> >> Any thoughts? > > Ocaml expects C runtime functions exported from a DLL (they have > __implib prefix). No surprise - MSVC runtime is not a link time choice > and requires correct compile time flags. > >> Sadly I have to do it this way -- we're linking a -output-obj'd .obj >> into our DLL (which must be statically linked to the runtime) and then >> linking libcamlrun.lib to that -- or at least hoping to. >> >> Thanks in advance for any help! > > - Dmitry Bely > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] Statically linked win32 libcamlrun.lib? 2010-04-15 19:16 ` Lally Singh @ 2010-04-15 20:06 ` Dmitry Bely 2010-04-15 20:16 ` Dmitry Bely 1 sibling, 0 replies; 7+ messages in thread From: Dmitry Bely @ 2010-04-15 20:06 UTC (permalink / raw) To: caml-list 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. Why boostrap? Does simple "make -f Makefile.nt world" succeeds? Please use the clean distribution with minimal changes in config/Makefile; I suspect you have already broken something during your experiments. - Dmitry Bely ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] Statically linked win32 libcamlrun.lib? 2010-04-15 19:16 ` Lally Singh 2010-04-15 20:06 ` Dmitry Bely @ 2010-04-15 20:16 ` Dmitry Bely 2010-04-20 15:48 ` Lally Singh 1 sibling, 1 reply; 7+ messages in thread From: Dmitry Bely @ 2010-04-15 20:16 UTC (permalink / raw) To: caml-list 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] Statically linked win32 libcamlrun.lib? 2010-04-15 20:16 ` Dmitry Bely @ 2010-04-20 15:48 ` Lally Singh 2010-04-20 16:31 ` Dmitry Bely 0 siblings, 1 reply; 7+ messages in thread From: Lally Singh @ 2010-04-20 15:48 UTC (permalink / raw) To: Dmitry Bely; +Cc: caml-list 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] Statically linked win32 libcamlrun.lib? 2010-04-20 15:48 ` Lally Singh @ 2010-04-20 16:31 ` Dmitry Bely 0 siblings, 0 replies; 7+ messages in thread From: Dmitry Bely @ 2010-04-20 16:31 UTC (permalink / raw) To: caml-list On Tue, Apr 20, 2010 at 7:48 PM, Lally Singh <lally.singh@gmail.com> wrote: > 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: (...) /DEFAULTLIB:"MSVCRT"> 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? Nevertheless some of your files are compiled with /MD. Use /VERBOSE linker option to find which one. I believe FLEXLINK=flexlink -merge-manifest -link /VERBOSE will do the job. BTW, have you recompiled flexdll.c/flexdll_initer.c files in FlexDLL directory with /MTd? - Dmitry Bely ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-04-20 16:31 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-04-14 23:39 Statically linked win32 libcamlrun.lib? Lally Singh 2010-04-15 6:59 ` [Caml-list] " Dmitry Bely 2010-04-15 19:16 ` Lally Singh 2010-04-15 20:06 ` Dmitry Bely 2010-04-15 20:16 ` Dmitry Bely 2010-04-20 15:48 ` Lally Singh 2010-04-20 16:31 ` Dmitry Bely
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox