Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring in sync with deepmind/mujoco commit a499b381: #664

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion mujoco_py/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ def __init__(self, mujoco_path):
self.extension.libraries.extend(['glfw.3'])
self.extension.define_macros = [('ONMAC', None)]
self.extension.runtime_library_dirs = [join(mujoco_path, 'bin')]
self.extension.include_dirs.extend([join(self.mujoco_path, 'MuJoCo.framework/Headers')])

def _build_impl(self):
if not os.environ.get('CC'):
Expand All @@ -323,6 +324,7 @@ def _build_impl(self):
'/opt/local/bin/gcc-mp-8',
'/opt/local/bin/gcc-mp-7',
'/opt/local/bin/gcc-mp-6',
'/usr/bin/clang',
]
available_c_compiler = None
for c_compiler in c_compilers:
Expand All @@ -332,10 +334,31 @@ def _build_impl(self):
if available_c_compiler is None:
raise RuntimeError(
'Could not find supported GCC executable.\n\n'
'HINT: On OS X, install GCC 9.x with '
'HINT: On OS X, install Xcode and libomp (brew install libomp), or\n'
'GCC 9.x with: '
'`brew install gcc@9`. or '
'`port install gcc9`.')
os.environ['CC'] = available_c_compiler
if available_c_compiler == '/usr/bin/clang':
# Use standard Apple Xcode (with libomp for OpenMP): clang -Xpreprocessor -fopenmp -lomp
# Need to ensure libomp is in LIBRARY_PATH somewhere (e.g. /usr/local/lib or /opt/homebrew/lib)
self.extension.extra_compile_args=[
'-Xpreprocessor',
'-fopenmp',
'-w'
]
self.extension.extra_link_args=[
'-lomp',
'-framework',
'MuJoCo',
'-F',
self.mujoco_path,
'-rpath',
self.mujoco_path
]
self.extension.libraries=['omp', 'glfw.3']
self.extension.library_dirs.extend(['/usr/local/lib', '/opt/homebrew/lib'])
self.extension.include_dirs.extend(['/usr/local/include', '/opt/homebrew/include'])

so_file_path = super()._build_impl()
del os.environ['CC']
Expand Down