Bug #3006
closedCompiling ext/etc problems (windows)
Description
=begin
This is while compiling ruby for windows (i386 & x86_64) using Visual Studio 8 (2005).
I get the following error in x86_64:
LIBCMT.lib(getenv.obj) : error LNK2005: getenv already defined in msvcr80-ruby19
1.lib(msvcr80-ruby191.dll)
I fixed this by adding -nodfeaultlib:libcmt to DLDFLAGS in extconf.rb
I then get:
LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
I fixed that by adding /noentry. Which I assume is the correct behavior.
In i386, I only get the LNK2001 error.
So I just patched ext/etc/extconf.rb to add this line after the 'require 'mkmf'' at the top:
$DLDFLAGS = "#{$DLDFLAGS} -nodefaultlib:libcmt /noentry"
With the resulting binary, I can run the following ruby without problems:
require 'etc'
puts "" * 40
puts "Login: #{Etc.getlogin}"
puts "Group: #{Etc.group}"
puts "" * 40
...so I assume that it works.
=end
Updated by nobu (Nobuyoshi Nakada) about 14 years ago
- Status changed from Open to Feedback
=begin
CFLAGS doesn't contain -MD option, but -MT instead?
=end
Updated by docwhat (Christian Höltje) almost 14 years ago
=begin
Okay, it looks like this isn't an issue anymore.
I'm guessing that either:
a) p378 fixed it.
b) I wasn't compiling with vcvars.bat before (which would have been stupid, but it's not like it's obvious when you forget).
=end
Updated by naruse (Yui NARUSE) almost 14 years ago
- Status changed from Feedback to Closed
=begin
=end