Project

General

Profile

Actions

Bug #3006

closed

Compiling ext/etc problems (windows)

Added by docwhat (Christian Höltje) about 14 years ago. Updated about 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

Also available in: Atom PDF

Like0
Like0Like0Like0