Project

General

Profile

Bug #3006

Compiling ext/etc problems (windows)

Added by docwhat (Christian Höltje) over 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
ruby -v:
1.9.1-p376
[ruby-core:28927]

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

History

#1

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Open to Feedback

=begin
CFLAGS doesn't contain -MD option, but -MT instead?
=end

#2

Updated by docwhat (Christian Höltje) about 9 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

#3

Updated by naruse (Yui NARUSE) about 9 years ago

  • Status changed from Feedback to Closed

=begin

=end

Also available in: Atom PDF