Skip to content

Commit 11c59cf

Browse files
authored
v.pref: set DYLD_FALLBACK_LIBRARY_PATH on macos, when -use-coroutines is used, so that v run can work, and the executable can find the downloaded photonwrapper shared library (#23516)
1 parent 9871050 commit 11c59cf

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎vlib/v/pref/pref.v‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,14 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
987987
}
988988
res.compile_defines << 'is_coroutine'
989989
res.compile_defines_all << 'is_coroutine'
990+
$if macos {
991+
dyld_fallback_paths := os.getenv('DYLD_FALLBACK_LIBRARY_PATH')
992+
so_dir := os.dir(so_path)
993+
if !dyld_fallback_paths.contains(so_dir) {
994+
env := [dyld_fallback_paths, so_dir].filter(it.len).join(':')
995+
os.setenv('DYLD_FALLBACK_LIBRARY_PATH', env, true)
996+
}
997+
}
990998
} $else {
991999
println('coroutines only work on macos & linux for now')
9921000
}

0 commit comments

Comments
 (0)