Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Problems With libiconv-2.dll Conflict #129

Closed
aauren opened this issue Sep 2, 2012 · 9 comments
Closed

Potential Problems With libiconv-2.dll Conflict #129

aauren opened this issue Sep 2, 2012 · 9 comments

Comments

@aauren
Copy link

aauren commented Sep 2, 2012

I'll start off by saying that I'm not sure how widespread this issue is, it may just be me, but I would guess from the solution that it has the potential to affect a lot of other people trying to install the DevKit so I decided to post an issue here.

The Problem

In some cases it seems that the gem install process favors a Windows System version of the libiconv-2.dll file instead of the version that comes with the DevKit install. This causes native gems not to build thus voiding the purpose of the DevKit.

The (Temporary) Solution

Move the delivered version of libiconv-2.dll (C:\Windows\SysWOW64\libiconv-2.dll) out of the way during native gem installs.

Background and Troubleshooting

I followed the instructions (https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) and installed the DevKit, but when it came time to test the DevKit by installing the rdiscount gem I would repeatedly get the following error:

C:\Users\user>gem install rdiscount --platform=ruby
Building native extensions.  This could take a while...
ERROR:  Error installing rdiscount:
        ERROR: Failed to build gem native extension.

        C:/Ruby192/bin/ruby.exe extconf.rb
checking for random()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby192/bin/ruby
        --with-rdiscount-dir
        --without-rdiscount-dir
        --with-rdiscount-include
        --without-rdiscount-include=${rdiscount-dir}/include
        --with-rdiscount-lib
        --without-rdiscount-lib=${rdiscount-dir}/lib
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
        from extconf.rb:5:in `<main>'


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8/ext/gem_make.out

After looking around online I came to the conclusion that most people encounter this error when they either:

  • Didn't have the DevKit installed
  • Had a space in the path to DevKit
  • Installed the wrong version of DevKit for their Ruby version

Since none of these were my problem, I kept trying other things. Eventually I tried running the gem install command in command prompt instead of PowerShell which resulted in a Windows popup directly before the aforementioned error:

as.exe - Entry Point Not Found

The procedure entry point libiconv_set_relocation_prefix could not be
located in the dynamic link library libiconv-2.dll

This caused me to start searching around for other versions of libiconv-2.dll (a DDL file that is delivered in both C:\DevKit\mingw\bin and in C:\DevKit\mingw\libexec\gcc\mingw32\4.5.2 by the DevKit installer) on my system which I eventually found in C:\Windows\SysWOW64.

After renaming the libiconv-2.dll file in C:\Windows\SysWOW64 the gem install of rdiscount worked perfectly. However, renaming this dll permanently isn't a viable solution long-term since I'm sure that the Windows system needs that DLL for other things.

So I'm guessing that this worked because in an ideal situation the DevKit's version of libiconv-2.dll should override the version that Windows provides during a native gem install? I tried moving DevKit's version to the very front of my system path, but this didn't seem to work for me.

@Azolo
Copy link
Member

Azolo commented Sep 2, 2012

I don't think that Microsoft provides a libiconv-2.dll (I don't have one in any of my Windows directories).

@luislavena
Copy link
Member

No, there isn't one.

Seems to me someone (or you) copied it to the system folder.

None of the looks like railsinstaller, rubyinstaller, devkit, msysgit or
even github for windows pollutes the system folder.

I would suggest you remove that file if you can't remember how it got
there.

Sorry for top posting. Sent from mobile.
On Sep 2, 2012 12:43 AM, "Justin Baker" [email protected] wrote:

I don't think that Microsoft provides a libiconv-2.dll (I don't have one
in any of my Windows directories).


Reply to this email directly or view it on GitHubhttps://github.com//issues/129#issuecomment-8218792.

@luislavena
Copy link
Member

One last comment: windows doesn't ship with any libiconv dll in system folder.

Closing this out as 3rd party issue.

While you found the issue with your installation, it was not caused by either rubyinstaller or devkit but a previous condition of your system.

@aauren
Copy link
Author

aauren commented Sep 3, 2012

I'm guessing that libiconv-2.dll must have been installed in my SysWOW64 directory by some GNU application that I previously installed. Unfortunately, I've not been able to track down which one.

I understand if the system configuration that I have is such a weird configuration that you don't feel that it is worth trying to mitigate it by changing something in the devkit installation process.

I'm glad that the issue exists though in case it helps anyone else down the road that somehow finds their configuration in the same state as mine.

@luislavena, if you're willing to put any more attention to this issue I think it would be helpful, for anyone that finds this later, to document if there is any way to give the devkit version of libiconv-2.dll precedence over other DLL's during the gem install process.

@jonforums
Copy link
Member

@aauren first and foremost, thank you for taking the time to document this issue.

While this behavior isn't surprising for Windows devs familiar with Win64's clever support for unmodified Win32 apps

DLL search order
WoW64 redirection

I do think an ultra-summary in Troubleshooting would be helpful for users who may stumble onto this system-specific 32-bit-app-running-under-WoW64 behavior.

Please add a short-n-sweet summary to the above wiki page and we'll refine as needed.

I'm not using Win64 yet, but curiosity is killing me...what does this snippet show on your 64bit (Win7?) OS? http://hastebin.com/forokatidu.rb

@aauren
Copy link
Author

aauren commented Sep 4, 2012

Thanks for your response @jonforums.

I'll be adding to the Troubleshooting section soon.

To answer your question, yes I do run Windows 7 64-bit. And when I ran your snippet the FFI gem didn't seem to detect the 64-bit address space. As such the output I got was:

PS C:\> ruby snippet.rb
System Directory: C:\Windows\system32
PS C:\>

@jonforums
Copy link
Member

...the FFI gem didn't seem to detect the 64-bit address space.

Thanks, I suspected as much since all the players (ruby, ffi ext, devkit) are 32bit.

When you remove if FFI::Platform::ADDRESS_SIZE == 64 does the snippet also output C:\Windows\SysWOW64, or nothing as on my 32bit system?

Anxiously awaiting your Troubleshooting mods... 😸

@aauren
Copy link
Author

aauren commented Sep 4, 2012

After I removed the if statement the output was as follows:

PS C:\> ruby snippet.rb
System Directory: C:\Windows\system32
WoW64 System Directory: C:\Windows\SysWOW64
PS C:\>

Also, I finished writing the troubleshooting section you'll have to let me know what you think.

@jonforums
Copy link
Member

Thank you, I will make a couple tweaks to the Troubleshooting entry for brevity and clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants