Issue #13903 has been updated by rocifier (Ryan O'Connor).


Hmm I've come back in a full-circle now and I'm getting the original error with bigdecimal.so

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

* 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>