Skip to content

Commit

Permalink
#3049 Remove self-referencing rpath and test it
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Sep 12, 2023
1 parent 772e05c commit dbc3cbc
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions scripts/fix_casadi_rpath_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,41 @@
print("Updated shared libraries referenced by libc++.1.0.dylib:")
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)
# This is needed for the casadi python bindings to work
# # Copy libcasadi.3.7.dylib and libc++.1.0.dylib to LD_LIBRARY_PATH ($HOME/.local/lib)
# # This is needed for the casadi python bindings to work

# subprocess.run(
# ["cp",
# os.path.join(casadi_dir, libcasadi_37_name),
# os.path.join(os.getenv("HOME"),".local/lib")
# ]
# )

# subprocess.run(
# ["cp",
# os.path.join(casadi_dir, libcpp_name),
# os.path.join(os.getenv("HOME"),".local/lib")
# ]
# )

# Update self-referencing rpath in libcasadi.dylib and libcasadi.3.7.dylib

install_name_tool_args_for_self_libcasadi = [
"-id",
os.path.join(casadi_dir, libcasadi_37_name),
os.path.join(casadi_dir, libcasadi_name),
]

subprocess.run(
["cp",
install_name_tool_args_for_self_libcasadi_37 = [
"-id",
os.path.join(casadi_dir, libcasadi_37_name),
os.path.join(casadi_dir, libcasadi_37_name),
os.path.join(os.getenv("HOME"),".local/lib")
]
)
]

subprocess.run(
["cp",
os.path.join(casadi_dir, libcpp_name),
os.path.join(os.getenv("HOME"),".local/lib")
]
)
print("Removing self-referencing rpath from libcasadi.dylib")
print(" ".join(["install_name_tool"] + install_name_tool_args_for_self_libcasadi))
subprocess.run(["install_name_tool"] + install_name_tool_args_for_self_libcasadi)

print("Removing self-referencing rpath from libcasadi.3.7.dylib")
print(" ".join(["install_name_tool"] + install_name_tool_args_for_self_libcasadi_37))
subprocess.run(["install_name_tool"] + install_name_tool_args_for_self_libcasadi_37)

0 comments on commit dbc3cbc

Please sign in to comment.