Dynamic vs static linking on OS X/macOS

20 views
Skip to first unread message

Rahul

unread,
Aug 11, 2024, 11:52:52 AM8/11/24
to MathGL
Hello,

I'm using mathgl 2.3.3 and it's been working well for my needs. Haven't felt the need to update and would prefer not to. For my OS X/macOS application that uses mathgl, I've had to statically link libmgl.a as well as dynamically link libmgl.7.4.0.dylib, which was installed in /usr/local/lib. Recently, however, I've been running into an issue where the application compiles fine but is unable to find libmgl.7.4.0.dylib in /usr/local/lib during run time. I'm able to fix it by using install_name_tool after compiling my application binary to make it look for libmgl.7.4.0.dylib in /usr/local/lib. I'm not sure why this happened as I never had to do this for the past 8-9 years. Does anyone know why this is happening?

Secondly, is there any way to avoid having to dynamically link libmgl.7.4.0.dylib? That is, is there a static library equivalent that I can use instead so that my application binary is self-contained when run on a device that doesn't have libmgl.7.4.0.dylib in /usr/local/lib?

Thanks,

Rahul



Reply all
Reply to author
Forward
0 new messages