[erlang-questions] How to build Erlang with libcmt (/MT) under windows?

Michael Regen michael.regen@REDACTED
Mon Oct 6 21:41:46 CEST 2008


Hi,

I think I found a solution. My very limited tests showed no problems so far.
Question remains whether I should expect something bad to happen. Is it
possible for someone with more insight into the code (shy glance to the
Erlang emulator coders :) ) to give a rough estimation whether static
binding of the C runtime library might lead to problems?

I understand it is difficult by various aspects to publish the test suite
used by Ericsson to test the Erlang distributions. And probably difficult to
use. But here I ran into a situation where it would be quite usefull...

My approach is attached to this mail. The small diffs simply make sure that
the /MT switch is used by the compiler/linker. Probably they overshoot the
mark. You need to run 'otp_build configure' after applying the patches.

And my initial assumption about the error message below was wrong.
_dosmaperr is a function which is contained in the static libcmt but not in
msvcr??.dll. I have no clue why. However you do not want it when statically
linking to libcmt.

Regards,
Michael

On Sun, Oct 5, 2008 at 7:04 PM, Michael Regen <michael.regen@REDACTED>wrote:

> Hi,
>
> Does anyone a little bit more experienced with the Erlang build mechanism
> know how to compile and link Erlang with libcmt instead of msvcrt?
> The default mechanism builds Erlang with the /MD switch which means the C
> standard libraries are accessed as threaded dll MSVCR??.DLL. This also means
> you cannot simply copy Erlang to another computer as long as the correct C
> runtime is not installed there.
>
> I am trying to figure out how to statically bind the libcmt library.
> Normally you do this by using the /MT switch.
>
> So far I tried to change the erts\etc\win32\cygwin_tools\vc\cc.sh and ld.sh
> scripts but with no good effects. I always get the usual error messages like
> if you mix libraries compiled with different switches.
>
> In cc.sh setting
>   MD_FORCED=true
>   MD=-MT
> and in ld.sh
>   STDLIB=LIBCMT.LIB
>
> just leads me to:
>
> LIBCMT.LIB(dosmap.obj) : error LNK2005: __dosmaperr already defined in
> dosmap.o
>    Creating library
> c:/dev/erlang/ErlangOTP/otp_src_R12B-4/bin/win32/erl_dll.lib and object
> c:/dev/erlang/ErlangOTP/otp_src_R12B-4/bin/win32/erl_dll.exp
> c:/dev/erlang/ErlangOTP/otp_src_R12B-4/bin/win32/beam.smp.dll : fatal error
> LNK1169: one or more multiply defined symbols found
>
> Thank you!
>
> Regards,
> Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081006/4e918bdb/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cc.sh.patch
Type: application/octet-stream
Size: 1218 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081006/4e918bdb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld.sh.patch
Type: application/octet-stream
Size: 375 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081006/4e918bdb/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.in.patch
Type: application/octet-stream
Size: 309 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081006/4e918bdb/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.patch
Type: application/octet-stream
Size: 315 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081006/4e918bdb/attachment-0003.obj>


More information about the erlang-questions mailing list