You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the documentation at https://github.com/stan-dev/math#installation I have been able to successfully compile the test program.
The issue is that in my use case I would like to call some stan::math functions from another language relying on a dynamic library with C ABI.
To make things more concrete suppose that the test_fun.cpp file looks like this:
Basically I would need something like: make -f path/to/stan-math/make/standalone-dyn-lib test_fun that compiles a dynamic library instead of an executable.
As I am not familiar with makefiles, I have been relying on inspecting the output of make --debug=v -f path/to/stan-math/make/standalone test_fun to figure out the clang++ (I am on OSX right now) command, and appending the -fPIC -shared flags.
This seems to work but I am getting a segmentation fault when the software using this dynamic library terminates, so I am not too confident about whether this approach is appropriate.
Would what I am asking for be easily achievable by modifying the standalone makefile?
Is the flag combination responsible for the segmentation fault I am getting?
For completeness the whole clang++ command is:
Run it with make -f standalone-shared-lib.make test_fun.so and it will produce the shared library that you can later link to other programs.
I think OSX supports both -shared that produces .so files and -dynamiclib flags that produce .dylib. If you want .dylib extension try adding to the makefile
Description
Following the documentation at https://github.com/stan-dev/math#installation I have been able to successfully compile the test program.
The issue is that in my use case I would like to call some stan::math functions from another language relying on a dynamic library with C ABI.
To make things more concrete suppose that the
test_fun.cpp
file looks like this:Basically I would need something like:
make -f path/to/stan-math/make/standalone-dyn-lib test_fun
that compiles a dynamic library instead of an executable.As I am not familiar with makefiles, I have been relying on inspecting the output of
make --debug=v -f path/to/stan-math/make/standalone test_fun
to figure out theclang++
(I am on OSX right now) command, and appending the-fPIC -shared
flags.This seems to work but I am getting a segmentation fault when the software using this dynamic library terminates, so I am not too confident about whether this approach is appropriate.
Would what I am asking for be easily achievable by modifying the
standalone
makefile?Is the flag combination responsible for the segmentation fault I am getting?
For completeness the whole
clang++
command is:Thank you in advance for any help!
Current Version:
HEAD as of this issue submission time.
The text was updated successfully, but these errors were encountered: