[erlang-questions] OpenCL.framework cause my NIF library to crash

Bob Ippolito <>
Tue Mar 13 17:54:19 CET 2012


Do you also have the -framework OpenCL flag? Static libraries don't
automatically link in their dynamic dependencies.

On Tuesday, March 13, 2012, CharlesStain <> wrote:
> Hi everyone,
> I'm developing an Erlang binding to a C++ library of mine, which relies on
> OpenCL.
> I set up a basic environment, with proper extern "C", as well as linker
> flags. In my case the magic words are:
>
> -undefined dynamic_lookup -dynamiclib
>
> Without these additional flags my NIF shared library won't compile.
> Everything work well until I try to link OpenCL within my NIF library.
Bear
> in mind that I'm on Mac OS and OpenCL comes as a dynamic library (a Cocoa
> Framework to be more specific) and going to another platform like Linux or
> Windows is not feasible.
> When I try to load my "new" NIF library (with OpenCL linked with it), this
> is the result:
>
> laetus alfredodinapoli$ rebar eunit
> ==> elaetus (eunit)
> Compiled src/elaetus_app.erl
> Compiled src/elaetus_sup.erl
> Compiled src/elaetus.erl
> Trace/BPT trap: 5
>
> Which is not very informative about what's going wrong. But I suspect it
may
> be related to the dynamic nature of the OpenCL library. In fact, linking
my
> framework, which is a static library, doesn't cause any issue.
> I would like to know:
>
> a) If anyone has had any contact with the NIF + MacOs + C++ world
> b) If anyone know a workaround for this annoying situation.
>
> Thanks in advance,
> Alfredo Di Napoli
>
> --
> View this message in context:
http://erlang.2086793.n4.nabble.com/OpenCL-framework-cause-my-NIF-library-to-crash-tp4469412p4469412.html
> Sent from the Erlang Questions mailing list archive at Nabble.com.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120313/225d19f5/attachment.html>


More information about the erlang-questions mailing list