[erlang-questions] Encode and decode binary data on port driver: undefined symbol ei_decode_version
Jachym Holecek
freza@REDACTED
Thu Nov 22 20:00:15 CET 2012
# Brisa Jim?nez 2012-11-22:
> I want to send and receive binary data through Erlang port, and use ei to
> encode and decode data, but when I try to test code below the next error
> occurs:
>
> Erlang R14B03 (erts-5.8.4) [source] [rq:1] [async-threads:0]
> [kernel-poll:false]
>
> Eshell V5.8.4 (abort with ^G)
> 1> erl_drv:start().
> ** exception exit: {error,"undefined symbol: ei_decode_version"}
> in function erl_drv:start/0
>
> [...]
>
> # Makefile
>
> ERL_ROOT=/usr/local/lib/erlang
>
> all: compile_c compile
>
> compile_c:
> @mkdir -p priv
> gcc -o priv/library.so -I$(ERL_ROOT)/usr/include/
> -I$(ERL_ROOT)/lib/erl_interface-3.7.4/include/ -fpic -shared c_src/*.c
You're not linking against ei so runtime linker complains about unresolved
symbols when you attempt to load your driver.
BTW Your Makefile doesn't look completely right either, I don't see why not
use filenames as source/target names allowing make to work as intended, but
even if there were a reason you should declare your targets as .PHONY (how
exactly is that done depends on make dialect at hand).
BR,
-- Jachym
More information about the erlang-questions
mailing list