[ruby-core:82837] [Ruby trunk Bug#13903] cant compile ruby with /MT on windows

From: Greg.mpls@...
Date: 2017-09-17 04:20:27 UTC
List: ruby-core #82837
Issue #13903 has been updated by MSP-Greg (Greg L).


rocifier (Ryan O'Connor) wrote:
> Do you know how to configure the project to build with /MTd? I am getting "unexpected ucrtbased.dll" when trying to link miniruby.exe

Sorry, I don't.  I assume you've built other projects with /MTd?  I'm not much of a C type...

just noticed from prev:

> If I link to vcruntime140-ruby250.lib then I get just these two:
LNK2005 _getenv already defined in vcruntime140-ruby240.lib(vcruntime140-ruby240.dll) Engine.App C:\Repositories\ags\Solutions\Engine.App\libucrtd.lib(getenv.obj)
LNK2005 _fclose already defined in vcruntime140-ruby240.lib(vcruntime140-ruby240.dll) Engine.App C:\Repositories\ags\Solutions\Engine.App\libucrtd.lib(fclose.obj)

Maybe a typo, but both ruby250 and ruby240 are listed.  It should be one or the other, but not both?

----------------------------------------
Bug #13903: cant compile ruby with /MT on windows
https://bugs.ruby-lang.org/issues/13903#change-66726

* Author: rocifier (Ryan O'Connor)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-09-13 trunk 59863) [i386-mswin32_140]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
steps:

1. open VS2015 x86 Native Tools Command Prompt
2. follow instructions in https://github.com/ruby/ruby/blob/trunk/win32/README.win32

most of the compilation completes including producing .lib files, but nmake finally errors out at this stage and the whole process doesn't complete:

```
compiling c:/Repositories/ruby/ext/bigdecimal/bigdecimal.c
bigdecimal.c
linking shared-object bigdecimal.so
   Creating library bigdecimal-i386-mswin32_140.lib and object bigdecimal-i386-mswin32_140.exp
bigdecimal.obj : error LNK2001: unresolved external symbol _rb_cNumeric
bigdecimal.obj : error LNK2001: unresolved external symbol _rb_eArgError
bigdecimal.obj : error LNK2001: unresolved external symbol _rb_eTypeError
bigdecimal.obj : error LNK2001: unresolved external symbol _rb_eZeroDivError
bigdecimal.obj : error LNK2001: unresolved external symbol _rb_eFloatDomainError
bigdecimal.obj : error LNK2001: unresolved external symbol _rb_eMathDomainError
../../.ext/i386-mswin32_140/bigdecimal.so : fatal error LNK1120: 6 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
```

Trying other configure options such as `--with-static-linked-extension` cause different errors such as `NMAKE : fatal error U1073: don't know how to make 'enc/libenc.lib'`.

When I link to the static lib produced in a C++ project, I get many linking errors:

```
1>vcruntime140-ruby250-static.lib(random.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(marshal.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(util.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(rational.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(complex.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(math.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(numeric.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(vm.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(sprintf.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(bignum.obj) : error LNK2001: unresolved external symbol __imp___dclass
1>vcruntime140-ruby250-static.lib(numeric.obj) : error LNK2001: unresolved external symbol __imp___dsign
1>vcruntime140-ruby250-static.lib(complex.obj) : error LNK2001: unresolved external symbol __imp___dsign
1>vcruntime140-ruby250-static.lib(math.obj) : error LNK2001: unresolved external symbol __imp___dsign
1>vcruntime140-ruby250-static.lib(lgamma_r.obj) : error LNK2001: unresolved external symbol __imp___dsign
1>vcruntime140-ruby250-static.lib(marshal.obj) : error LNK2001: unresolved external symbol __imp__frexp
1>vcruntime140-ruby250-static.lib(numeric.obj) : error LNK2001: unresolved external symbol __imp__frexp
1>vcruntime140-ruby250-static.lib(bignum.obj) : error LNK2001: unresolved external symbol __imp__frexp
1>vcruntime140-ruby250-static.lib(rational.obj) : error LNK2001: unresolved external symbol __imp__frexp
1>vcruntime140-ruby250-static.lib(math.obj) : error LNK2001: unresolved external symbol __imp__frexp
1>vcruntime140-ruby250-static.lib(numeric.obj) : error LNK2001: unresolved external symbol __imp__round
1>vcruntime140-ruby250-static.lib(bignum.obj) : error LNK2001: unresolved external symbol __imp__round
1>vcruntime140-ruby250-static.lib(numeric.obj) : error LNK2001: unresolved external symbol __imp___wassert
1>vcruntime140-ruby250-static.lib(thread.obj) : error LNK2001: unresolved external symbol __imp___wassert
1>vcruntime140-ruby250-static.lib(enum.obj) : error LNK2001: unresolved external symbol __imp___wassert
1>vcruntime140-ruby250-static.lib(compile.obj) : error LNK2001: unresolved external symbol __imp___wassert
1>vcruntime140-ruby250-static.lib(marshal.obj) : error LNK2001: unresolved external symbol __imp__modf
1>vcruntime140-ruby250-static.lib(lgamma_r.obj) : error LNK2001: unresolved external symbol __imp__modf
1>vcruntime140-ruby250-static.lib(vm.obj) : error LNK2001: unresolved external symbol __imp__modf
1>vcruntime140-ruby250-static.lib(bignum.obj) : error LNK2001: unresolved external symbol __imp__modf
1>vcruntime140-ruby250-static.lib(compile.obj) : error LNK2001: unresolved external symbol __imp__modf
1>vcruntime140-ruby250-static.lib(time.obj) : error LNK2001: unresolved external symbol __imp__modf
1>vcruntime140-ruby250-static.lib(file.obj) : error LNK2001: unresolved external symbol __imp__umask
1>vcruntime140-ruby250-static.lib(process.obj) : error LNK2001: unresolved external symbol __imp__umask
1>OLDNAMES.lib(umask.obi) : error LNK2001: unresolved external symbol __imp__umask
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next