I am using Ububtu 12 . In my rails application while running rake db:migrate . I am getting this error can't load such file iconv. I checked which Iconv and output is usr/bin/iconv. I am using rvm . Any guesses?
-
possible duplicate of [Ruby 2.0 iconv replacement](http://stackoverflow.com/questions/16032241/ruby-2-0-iconv-replacement) – phoet Jul 31 '13 at 19:55
-
@phoet Did you read title of question ? It is how to add iconv directory to ruby path.The question which you suggested is for replacing iconv with string#encode . They are completely different and it is not a duplicate. – Deepender Singla Aug 01 '13 at 03:10
-
i read it, but i think that this won't solve your problem. another thing: add the full stacktrace or at least the full error-message you get. – phoet Aug 01 '13 at 09:00
1 Answers
which iconv
gives you the location of the binary, not of the library it uses. Even if you find it on your filesystem, you can't use a C library from within a ruby script without wrapping it in a compatibility layer (e.g. by using FFI or by writing a plain ruby extension). The wrapping is some work so I assume you don't want to do it yourself. However, this is the only way to have what you want, here you find the ffi library: https://github.com/ffi/ffi
Iconv has been removed from ruby as was stated before.
If Iconv is a dependency of your own code, I would try to solve the problem by looking into the appropriate replacement for ruby 2.0 as phoet suggests.
In case you are using some library that depends on Iconv, I would try to update the library in the hopes that it drops that dependency.

- 25,477
- 3
- 41
- 36