While working on #93 I figured out that on OS X we are building shared libs somewhat incorrect. If we don't specify install name while building the shared libs, so by default ld will take the name provided in -o as install_name (wtf srsly). It makes it to set whole build/bin_debug/libname.soas install_name, which limits where executable can look for libs, because executable will look into $cwd/$install_name, which in the end makes an executable which can only be started from specific cwd (facepalm).
The main problem here IMHO that buildfox currently doesn't have tools to extract filename and set install_name by it's own. Otherwise we could just fix core definitions and done :)
While working on #93 I figured out that on OS X we are building shared libs somewhat incorrect. If we don't specify install name while building the shared libs, so by default ld will take the name provided in
-o
as install_name (wtf srsly). It makes it to set wholebuild/bin_debug/libname.so
as install_name, which limits where executable can look for libs, because executable will look into$cwd/$install_name
, which in the end makes an executable which can only be started from specific cwd (facepalm).To fix it we need to set install_name with @rpath prefix, and than set rpath in executable to be something like @executable_path, so dyld will actually look in the place where executable is located regardless of cwd. See https://github.com/beardsvibe/buildfox/commit/9591e3a17add2d928430599f551936c2d714fc91
PS. On windows PE loader always look for dlls in executable folder, regardless of cwd, why OS X is that different? :(