# C-extension problem

**URL:** <https://www.ruby-forum.com/t/c-extension-problem/63798>\
**Category:** Ruby\
**Created:** [January 21, 2006, 9:24pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798 "2006-01-21T21:24:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 21, 2006, 9:24pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/1 "2006-01-21T21:24:53Z")

</div>

Dear list.

After reading through this walkthrough (1) of compiling c-extensions on  
Windows I was finally able to build the pickaxe example on two different  
PC’s. One with Visual Studio 2003, the other with Visual C++ express  
2005.  
Both compiled, only one worked. This raises some issues.

I) Should I try to fix this? I mean, will working with C-extensions  
bring  
me down the road of never-ending versioning/library/compiler/…  
problems.

II) If yes, how to fix the technical issues at hand today?

Any suggestions would be very welcome.

Anyway, here’s what happened.

Building on VS 2003 gave a working result at first try. C++ express 2005  
however gave two distinct errors when running

irb: require ‘Test’

GUI warning-box:  
ruby.exe - Unable to Locate Component  
This application has failed to start because MSVCR80.dll was not  
found.  
Re-installing the application may fix this problem.

irb: Load error 126 …

After searching from mscvr80.dll, finding it here(2) and copying it to  
c:\windows\system32 the following error appeared:

irb: require ‘Test’

GUI warning-box  
Microsoft Visual C++ Runtime Library  
Rumtime Error!  
Program: c:\progra~1\ruby\bin\ruby.exe  
R6034  
An application has made an attempt to load the C runtime library  
incorrectly  
Please contact the application’s support team for more information.

irb: Load error 1114…

All the best  
Jon Egil S.

(1) [http://www.koontzfamily.org/david/blog/?p=230](http://www.koontzfamily.org/david/blog/?p=230)  
Note that I had to install Microsofts Platform SDK from MSDN seperately.

(2)  
C:\WINDOWS\WinSxS\x86\_Microsoft.VC80.CRT\_1fc8b3b9a1e18e3b\_8.0.50727.42\_x-ww\_0de06acd

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 21, 2006, 9:37pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/2 "2006-01-21T21:37:20Z")

</div>

Hello,  
How did you compile the example in 2003? I am tring to do it with the  
makefile not a compiler. When I create a blank c++ console project for  
the  
code it gives me linking errors.  
Thank you for any help  
Becker

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 21, 2006, 9:46pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/3 "2006-01-21T21:46:42Z")

</div>

Becker

Sorry about the lack of details. I also used the makefile approach.

I used textpad, a simple text-editor, for writing the .c-code and then  
extconf.rb and nmake.exe from VS 2003.exe. The walkthrough in footnote  
(1)  
was very helpfull, although I must agree that this i cumbersome.

Note that I had to install not only VS2003, but also the Platform SDK  
(for  
2003-server, but works for my XP-sp2) to get it all going.

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 21, 2006, 10:08pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/4 "2006-01-21T22:08:54Z")

</div>

Becker

> Sorry to bug you for more details. How do you run nmake.exe from 2003?

No problem. Actually I don’t run it from within 2003, I open a  
command-window, cd to the right directory and just run nmake.

You should really read this:  
[http://www.koontzfamily.org/david/blog/?p=230](http://www.koontzfamily.org/david/blog/?p=230)

All the best  
JE

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 21, 2006, 11:02pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/5 "2006-01-21T23:02:45Z")

</div>

hello  
A few more questions, Where was your source file? I used the one click  
installer and i do not see the scr folder. I downloaded the tar source  
from the ruby website and i am using that.

Nmake. When i type it in the command line it does not recognize it. I  
set up the variables for the system like the website said to. If I use  
the nmake in the VC7\bin i get the cl is not recognized

The echo shows what should be there and extconf.rb does what is should.

Its the damn Nmake!

Becker

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 21, 2006, 10:02pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/6 "2006-01-21T22:02:29Z")

</div>

Sorry to bug you for more details. How do you run nmake.exe from 2003?

Becker

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 22, 2006, 12:10am UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/7 "2006-01-22T00:10:53Z")

</div>

On 21/01/06, Jon Egil S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> After reading through this walkthrough (1) of compiling c-extensions on  
> Windows I was finally able to build the pickaxe example on two different  
> PC’s. One with Visual Studio 2003, the other with Visual C++ express 2005.  
> Both compiled, only one worked. This raises some issues.

Avoid compiling with Visual C++ 2005 for now. There are some …  
changes that Microsoft has made. I am working on compiling with Visual  
C++ 2005 and have a couple of patches to finish trying from Nobu that  
may help alleviate this situation.

-austin

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 22, 2006, 11:46pm UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/8 "2006-01-22T23:46:31Z")

</div>

I get this error when tring nmake.  
cl -nologo -LD -FeTest.so TcTest.obj Test.obj msvcrt-ruby18.lib  
oldname  
s.lib user32.lib advapi32.lib wsock32.lib -link -incremental:no -debug  
-opt:ref  
-opt:icf -dll -libpath:“c:/ruby/lib” -def:Test-i386-mswin32.def  
cl : Command line warning D4024 : unrecognized source file type ‘.’,  
object  
file  
assumed  
LINK : fatal error LNK1104: cannot open file ‘.’  
NMAKE : fatal error U1077: ‘F:\WINDOWS\system32\cmd.exe’ : return code  
‘0x2’  
Stop.

I dont see where in the make file that line is. also where in that  
line there just just a dot?

Becker

---

<div class="post-metadata">

**Author:** ![hotjuneshen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@hotjuneshen](https://www.ruby-forum.com/u/hotjuneshen)\
**Post date:** [January 23, 2006, 12:31am UTC](https://www.ruby-forum.com/t/c-extension-problem/63798/9 "2006-01-23T00:31:57Z")

</div>

On 22/01/06, ruby talk [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> NMAKE : fatal error U1077: ‘F:\WINDOWS\system32\cmd.exe’ : return code ‘0x2’  
> Stop.
> 
> I dont see where in the make file that line is. also where in that  
> line there just just a dot?

Again, if you’re trying this with Visual Studio 2005, please hold off.  
I am preparing a comprehensive set of instructions.

-austin
