From 8388ac6e640d5959ff1c559ba0af26235355a6a2 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:40:32 +0530 Subject: [PATCH] #3049 Refactor casadi lib rpaths --- scripts/fix_casadi_rpath_mac.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/scripts/fix_casadi_rpath_mac.py b/scripts/fix_casadi_rpath_mac.py index 9779c88ab3..fb275e339a 100644 --- a/scripts/fix_casadi_rpath_mac.py +++ b/scripts/fix_casadi_rpath_mac.py @@ -1,6 +1,6 @@ """ -Removes the rpath from libcasadi.dylib in the casadi python install -and uses a fixed path +Removes the rpath from libcasadi.dylib and libcasadi.3.7.dylib in the casadi python +install and uses a fixed path Used when building the wheels for macos """ @@ -15,16 +15,28 @@ libcppabi_name = "libc++abi.dylib" libcasadi_name = "libcasadi.dylib" libcasadi_37_name = "libcasadi.3.7.dylib" -install_name_tool_args = [ +install_name_tool_args_for_libcasadi_name = [ "-change", os.path.join("@rpath", libcpp_name), os.path.join(casadi_dir, libcpp_name), os.path.join(casadi_dir, libcasadi_name), ] +install_name_tool_args_for_libcasadi_37_name = [ + "-change", + os.path.join("@rpath", libcpp_name), + os.path.join(casadi_dir, libcpp_name), + os.path.join(casadi_dir, libcasadi_37_name), +] subprocess.run(["otool"] + ["-L", os.path.join(casadi_dir, libcasadi_name)]) -print(" ".join(["install_name_tool"] + install_name_tool_args)) -subprocess.run(["install_name_tool"] + install_name_tool_args) + +print(" ".join(["install_name_tool"] + install_name_tool_args_for_libcasadi_name)) +subprocess.run(["install_name_tool"] + install_name_tool_args_for_libcasadi_name) + +print(" ".join(["install_name_tool"] + install_name_tool_args_for_libcasadi_37_name)) +subprocess.run(["install_name_tool"] + install_name_tool_args_for_libcasadi_37_name) + subprocess.run(["otool"] + ["-L", os.path.join(casadi_dir, libcasadi_name)]) + install_name_tool_args = [ "-change", os.path.join("@rpath", libcppabi_name), @@ -32,8 +44,10 @@ os.path.join(casadi_dir, libcpp_name), ] subprocess.run(["otool"] + ["-L", os.path.join(casadi_dir, libcpp_name)]) + print(" ".join(["install_name_tool"] + install_name_tool_args)) subprocess.run(["install_name_tool"] + install_name_tool_args) + subprocess.run(["otool"] + ["-L", os.path.join(casadi_dir, libcpp_name)]) # Copy libcasadi.3.7.dylib and libc++.1.0.dylib to LD_LIBRARY_PATH ($HOME/.local/lib)