HashNuke / mail-to-json

A MailGun.com clone in under 300 lines of Elixir
MIT License
45 stars 5 forks source link

issue with eiconv #1

Open jschoch opened 9 years ago

jschoch commented 9 years ago

not sure if this is somehow related to hex

14:31:43.337 [error] The on_load function for module eiconv returned {{:badmatch,
  {:error,
   {:load_failed,
    'Failed to load NIF library: \'/home/bitnami/tmp/mail-to-json/_build/dev/lib/eiconv/priv/eiconv_nif.so: undefined symbol: libiconv\''}}},
 [{:eiconv, :init, 0, [file: 'src/eiconv.erl', line: 18]},
  {:code_server, :"-handle_on_load/4-fun-0-", 1,
   [file: 'code_server.erl', line: 1659]}]}
HashNuke commented 9 years ago

Hi @jschoch, Do you have libiconv installed?

HashNuke commented 9 years ago

@jschoch B/w love your blog, done in exdoc :) Sweet idea ~!

jschoch commented 9 years ago

ya, just playing around a bit, not much of a blogger.

anyway, ya i have libiconv installed, and i can run iconv. It seems someone put a lot of work into libiconv detection here, but that also doesn't work: processone/eiconv

here is the test output from that.


[]$ make test
./rebar skip_deps=true eunit
==> eiconv (eunit)

=ERROR REPORT==== 19-Jun-2015::14:55:35 ===
unable to load iconv NIF: {error,
                              {load_failed,
                                  "Failed to load NIF library: '../priv/lib/iconv.so: undefined symbol: libiconv'"}}
iconv: load_nif_test...*failed*
in function iconv:'-load_nif_test/0-fun-0-'/1 (src/iconv.erl, line 72)
**error:{assertEqual_failed,
    [{module,iconv},
     {line,72},
     {expression,
         "load_nif ( filename : join ( [ \"..\" , \"priv\" , \"lib\" ] ) )"},
     {expected,ok},
     {value,
         {error,
             {load_failed,
                 "Failed to load NIF library: '../priv/lib/iconv.so: undefined symbol: libiconv'"}}}]}

iconv: utf8_to_koi8r_test...*failed*
in function erlang:nif_error/1
  called as nif_error(nif_not_loaded)
in call from iconv:convert/3 (src/iconv.erl, line 56)
in call from iconv:'-utf8_to_koi8r_test/0-fun-0-'/1 (src/iconv.erl, line 77)
**error:nif_not_loaded

iconv: koi8r_to_cp1251_test...*failed*
in function erlang:nif_error/1
  called as nif_error(nif_not_loaded)
in call from iconv:convert/3 (src/iconv.erl, line 56)
in call from iconv:'-koi8r_to_cp1251_test/0-fun-0-'/1 (src/iconv.erl, line 82)
**error:nif_not_loaded

iconv: wrong_encoding_test...*failed*
in function erlang:nif_error/1
  called as nif_error(nif_not_loaded)
in call from iconv:convert/3 (src/iconv.erl, line 56)
in call from iconv:'-wrong_encoding_test/0-fun-0-'/1 (src/iconv.erl, line 87)
**error:nif_not_loaded

=======================================================
  Failed: 4.  Skipped: 0.  Passed: 0.
ERROR: One or more eunit tests failed.
make: *** [test] Error 1

some env tests, i'm going to try on another box to see if i can reproduce

 sudo ldconfig -v |grep iconv
libiconv.so.2 -> libiconv.so.2.5.1

ldd $(which iconv)
        linux-vdso.so.1 =>  (0x00007fff5ebac000)
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x00007f310d1a5000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f310cde6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f310d495000)
HashNuke commented 9 years ago

@jschoch by tomorrow's end I'll have an Ansible playbook to setup an Elixir stack on Ubuntu. I have a project with gen_smtp, so if iconv is a problem, I'll hit it too and fix it.

jschoch commented 9 years ago

what does iconv actually do in mail-to-json?

HashNuke commented 9 years ago

@jschoch encoding/decoding. Actually used by gen_smtp - https://github.com/Vagabond/gen_smtp/blob/fb667c6ed875be1ae8d5ea0fa74eb9043fd7ecc7/src/mimemail.erl

I think I included it because I was using an updated version.