mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-26 15:34:59 -07:00
support the rpath changes on macos
This commit is contained in:
+6
-6
@@ -549,11 +549,7 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
// local to the executable (unless the system collection is used, in which case we search
|
||||
// the system library paths for the library file).
|
||||
if (string_ends_with(lib, str_lit(".a")) || string_ends_with(lib, str_lit(".o")) || string_ends_with(lib, str_lit(".so")) || string_contains_string(lib, str_lit(".so."))) {
|
||||
// static libs and object files, absolute full path relative to the file in which the lib was imported from
|
||||
lib_str = gb_string_append_fmt(lib_str, " -l:\"%.*s\" ", LIT(lib));
|
||||
|
||||
// NOTE(laytan): If .so, I think we can check for the existence of "$OUT_DIRECTORY/$lib" here and print an error telling the user to copy over the file, or we can even do the copy for them?
|
||||
|
||||
} else {
|
||||
// dynamic or static system lib, just link regularly searching system library paths
|
||||
lib_str = gb_string_append_fmt(lib_str, " -l%.*s ", LIT(lib));
|
||||
@@ -642,9 +638,13 @@ gb_internal i32 linker_stage(LinkerData *gen) {
|
||||
}
|
||||
|
||||
if (!build_context.no_rpath) {
|
||||
// Set the rpath to the $ORIGIN (the path of the executable),
|
||||
// Set the rpath to the $ORIGIN/@loader_path (the path of the executable),
|
||||
// so that dynamic libraries are looked for at that path.
|
||||
gb_string_appendc(link_settings, "-Wl,-rpath,\\$ORIGIN ");
|
||||
if (build_context.metrics.os == TargetOs_darwin) {
|
||||
link_settings = gb_string_appendc(link_settings, "-Wl,-rpath,@loader_path ");
|
||||
} else {
|
||||
link_settings = gb_string_appendc(link_settings, "-Wl,-rpath,\\$ORIGIN ");
|
||||
}
|
||||
}
|
||||
|
||||
if (!build_context.no_crt) {
|
||||
|
||||
Reference in New Issue
Block a user