[erlang-questions] SOLVED Re: A simple NIF so: compiles on Ubuntu, but not on MacOSX. Is something missing?

Ivan Uemlianin <>
Tue Jun 28 12:32:34 CEST 2011


Dear Lukas

Thanks very much!  Now it compiles on the Mac.

Best wishes

Ivan


On 28/06/2011 11:26, Lukas Larsson wrote:
> Hi!
>
> On OS X you want to give "-bundle -flat_namespace -undefined suppress" and remove "-shared" for the linker in order for it to link successfully.
>
> Lukas
> ----- Original Message -----
> From: "Ivan Uemlianin"<>
> To: "Erlang Questions"<>
> Sent: Tuesday, June 28, 2011 12:16:57 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
> Subject: [erlang-questions] A simple NIF so: compiles on Ubuntu, but not on MacOSX.  Is something missing?
>
> Dear All
>
> I'm writing a simple NIF.  This is what I'm using to compile it:
>
> gcc -Wall  \
>       -I/usr/local/lib/erlang/usr/include  \
>       -fPIC  \
>       -shared \
>       -o simple_nif.so  \
>       simple.c simple_nif.c
>
> This compiles on Ubuntu, but trying it on a Mac I get this error:
>
>> Undefined symbols:
>>    "_enif_make_badarg", referenced from:
>>        _get_params_nif in ccNKt95s.o
>>    "_enif_make_tuple_from_array", referenced from:
>>        _get_params_nif in ccNKt95s.o
>>    "_enif_make_int", referenced from:
>>        _get_params_nif in ccNKt95s.o
>>    "_enif_get_tuple", referenced from:
>>        _get_params_nif in ccNKt95s.o
>> ld: symbol(s) not found
>> collect2: ld returned 1 exit status
>
> Both machines are running erlang 14B, installed from source (the -I path
> is the same for both).  I don't have my Ubuntu machine with me atm, but
> this is what's in .../usr/include on the Mac:
>
>> $ l /usr/local/lib/erlang/usr/include/
>>
>> driver_int.h
>> erl_driver.h
>> erl_drv_nif.h
>> erl_fixed_size_int_types.h
>> erl_int_sizes_config.h
>> erl_memory_trace_parser.h
>> erl_nif.h
>> erl_nif_api_funcs.h
>
> Is something missing?  Does the Mac need extra arguments to compile?
>
> With thanks and best wishes
>
> Ivan
>
>


-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================



More information about the erlang-questions mailing list