Build OF as a shared library in macOS

I’m trying to build OF as a shared library (.so) in macOS.

I added the following to my app’s config.make file.


PROJECT_LDFLAGS = -rdynamic -shared -undefined dynamic_lookup


But when I build the project using make, it actually generates an Application file which is not a shared library.

How can I properly build OF as a shared library in macOS?

Removing @mv $(TARGET) bin/$(BIN_NAME).app/Contents/MacOS from OF/libs/openFrameworksCompiled/project/osx/ file prevented the shared library being renamed to an .app file.

Is it possible to do the same thing through project’s config.make file?

I would suggest just using the Xcode project located at:

You could change the library type from static library to dynamic library in the target settings ( .dylib not .so )

You would of course have to handle the linking of all the dependent libraries ( freetype, glfw etc ), but that should build OF as a dylib.

1 Like