l'essentiel est invisible pour les yeux

Saturday, June 28, 2008

Compile Erlang linked-in driver on Mac OSX (Darwin)

In order to compile the Erlang linked-in driver on Darwin, we must specify some options when it will be linked. If you don't specify these options, you might see errors is as follows:

% gcc -o my_drv.dymlib my_drv.c -dynamiclib -fpic

/usr/bin/ld: Undefined symbols:

That's invalid, so it must specify some options below in order to create the shared object.

% gcc -o my_drv.so my_drv.c -bundle -flat_namespace -udefined suppress

see README in source code of Erlang/OTP for more details.