From 33a2937598c5dd921b083aa94765ff6d2541d179 Mon Sep 17 00:00:00 2001 From: odellus Date: Sun, 2 Jan 2022 12:01:59 -0800 Subject: [PATCH] The new release of MuJoCo wants the build library to be /path/to/mujoco/lib, not bin. Also it is no longer named libmujoco210.so, but libmujoco.so. Tested on Ubuntu 20.04, Python 3.8 with GPU support. --- mujoco_py/builder.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mujoco_py/builder.py b/mujoco_py/builder.py index 5280b2c3..56ef9b73 100644 --- a/mujoco_py/builder.py +++ b/mujoco_py/builder.py @@ -213,8 +213,8 @@ def __init__(self, mujoco_path): join(mujoco_path, 'include'), np.get_include(), ], - libraries=['mujoco210'], - library_dirs=[join(mujoco_path, 'bin')], + libraries=['mujoco'], + library_dirs=[join(mujoco_path, 'lib')], extra_compile_args=[ '-fopenmp', # needed for OpenMP '-w', # suppress numpy compilation warnings @@ -272,12 +272,12 @@ def __init__(self, mujoco_path): self.extension.sources.append( join(self.CYMJ_DIR_PATH, "gl", "osmesashim.c")) self.extension.libraries.extend(['glewosmesa', 'OSMesa', 'GL']) - self.extension.runtime_library_dirs = [join(mujoco_path, 'bin')] + self.extension.runtime_library_dirs = [join(mujoco_path, 'lib')] def _build_impl(self): so_file_path = super()._build_impl() # Removes absolute paths to libraries. Allows for dynamic loading. - fix_shared_library(so_file_path, 'libmujoco210.so', 'libmujoco210.so') + fix_shared_library(so_file_path, 'libmujoco.so', 'libmujoco.so') fix_shared_library(so_file_path, 'libglewosmesa.so', 'libglewosmesa.so') return so_file_path @@ -290,13 +290,13 @@ def __init__(self, mujoco_path): self.extension.sources.append(self.CYMJ_DIR_PATH + "/gl/eglshim.c") self.extension.include_dirs.append(self.CYMJ_DIR_PATH + '/vendor/egl') self.extension.libraries.extend(['glewegl']) - self.extension.runtime_library_dirs = [join(mujoco_path, 'bin')] + self.extension.runtime_library_dirs = [join(mujoco_path, 'lib')] def _build_impl(self): so_file_path = super()._build_impl() fix_shared_library(so_file_path, 'libOpenGL.so', 'libOpenGL.so.0') fix_shared_library(so_file_path, 'libEGL.so', 'libEGL.so.1') - fix_shared_library(so_file_path, 'libmujoco210.so', 'libmujoco210.so') + fix_shared_library(so_file_path, 'libmujoco.so', 'libmujoco.so') fix_shared_library(so_file_path, 'libglewegl.so', 'libglewegl.so') return so_file_path @@ -309,7 +309,7 @@ def __init__(self, mujoco_path): self.extension.sources.append(self.CYMJ_DIR_PATH + "/gl/dummyshim.c") self.extension.libraries.extend(['glfw.3']) self.extension.define_macros = [('ONMAC', None)] - self.extension.runtime_library_dirs = [join(mujoco_path, 'bin')] + self.extension.runtime_library_dirs = [join(mujoco_path, 'lib')] def _build_impl(self): if not os.environ.get('CC'): @@ -482,8 +482,8 @@ def build_callback_fn(function_string, userdata_names=[]): # Link against mujoco so we can call mujoco functions from within callback ffibuilder.set_source(name, source_string, include_dirs=[join(mujoco_path, 'include')], - library_dirs=[join(mujoco_path, 'bin')], - libraries=['mujoco210']) + library_dirs=[join(mujoco_path, 'lib')], + libraries=['mujoco']) # Catch compilation exceptions so we can cleanup partial files in that case try: library_path = ffibuilder.compile(verbose=True)