Project

General

Profile

Actions

Bug #3006

closed

Compiling ext/etc problems (windows)

Added by docwhat (Christian Höltje) about 14 years ago. Updated almost 13 years ago.

Status:
Closed
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

Actions #1

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

Actions #2

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

Actions #3

Updated by naruse (Yui NARUSE) almost 14 years ago

  • Status changed from Feedback to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0