From c2b65bd1fb02a1f045438f0c08c02642f4cf8186 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 30 Mar 2025 15:23:27 -0400 Subject: [PATCH] Speculative fix for installing libraries on mac --- src/tomo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tomo.c b/src/tomo.c index 9e0038d..95fef94 100644 --- a/src/tomo.c +++ b/src/tomo.c @@ -438,8 +438,14 @@ void build_library(Text_t lib_dir_name) errx(WEXITSTATUS(status), "Failed to create symbol rename table with `nm` and `sed`"); } +#ifdef __APPLE__ prog = run_cmd(cc, " -O", optimization, " ", cflags, " ", ldflags, " ", ldlibs, " ", array_text(extra_ldlibs), - " -Wl,-soname='lib", lib_dir_name, ".so' -shared ", paths_str(object_files), " -o 'lib", lib_dir_name, ".so'"); + " -Wl,-install_name,@rpath/'lib", lib_dir_name, ".dylib' -shared ", paths_str(object_files), " -o 'lib", lib_dir_name, ".dylib'"); +#else + prog = run_cmd(cc, " -O", optimization, " ", cflags, " ", ldflags, " ", ldlibs, " ", array_text(extra_ldlibs), + " -Wl,-soname,'lib", lib_dir_name, ".so' -shared ", paths_str(object_files), " -o 'lib", lib_dir_name, ".so'"); +#endif + if (!prog) print_err("Failed to run C compiler: ", cc); int status = pclose(prog);