MacOS Catalina command line tools and gcc errors during installation

catalinacommand lineinstall

Command Line tools are giving a multitude of errors when trying to install MuJoCo. I suspect with high confidence that this is an issue from the command line tools on my macOS Catalina since I have installed mujoco previously on Mojave and multiple ubuntu machines.

First I perform:

xcode-select --install

Further information:

(base) ryanr@RRMBP ~ % /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I install using pip3 install 'mujoco-py<2.1,>=2.0'

I am greeted with errors as the following:

> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:34:
> error: expected declaration specifiers before
> '__OSX_AVAILABLE_STARTING'    int     getiopolicy_np(int, int)
> __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~

and

  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:144:1: error: expected declaration specifiers before 'div_t'
   div_t  div(int, int) __pure2;
   ^~~~~

and

In file included from /Users/ryanr/.mujoco/mujoco200/include/mujoco.h:34:0,
                   from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-4_wykvnc/mujoco-py/mujoco_py/gl/glshim.h:4,
                   from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-4_wykvnc/mujoco-py/mujoco_py/gl/dummyshim.c:1:
  /usr/local/Cellar/gcc@6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:59:19: error: storage class specified for parameter 'float_t'
       typedef float float_t;
                     ^~~~~~~
  /usr/local/Cellar/gcc@6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:60:20: error: storage class specified for parameter 'double_t'
       typedef double double_t;
                      ^~~~~~~~
  /usr/local/Cellar/gcc@6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:126:12: error: storage class specified for parameter '__math_errhandling'
   extern int __math_errhandling(void);
              ^~~~~~~~~~~~~~~~~~
  /usr/local/Cellar/gcc@6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:146:12: error: storage class specified for parameter '__fpclassifyf'
   extern int __fpclassifyf(float);
              ^~~~~~~~~~~~~
  /usr/local/Cellar/gcc@6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:147:12: error: storage class specified for parameter '__fpclassifyd'
   extern int __fpclassifyd(double);
              ^~~~~~~~~~~~~
  /usr/local/Cellar/gcc@6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:148:12: error: storage class specified for parameter '__fpclassifyl'
   extern int __fpclassifyl(long double);
              ^~~~~~~~~~~~~

and

                                                  ^
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/wait.h:110:0,
                   from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:66,
                   from /Users/ryanr/.mujoco/mujoco200/include/mujoco.h:33,
                   from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-jye6hn52/mujoco-py/mujoco_py/gl/glshim.h:4,
                   from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-jye6hn52/mujoco-py/mujoco_py/gl/dummyshim.c:1:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:9: error: old-style parameter declarations in prototyped function definition
   int     getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
           ^~~~~~~~~~~~~~
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:1: error: parameter name omitted
   int     getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
   ^~~
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:1: error: parameter name omitted
  /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-jye6hn52/mujoco-py/mujoco_py/gl/dummyshim.c:37:1: error: expected '{' at end of input
   }
   ^
  error: command '/usr/local/bin/gcc-6' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mujoco-py

Any suggestions as to why my command-line tools are failing on macOS Catalina? What steps should one take to ensure that the command-line tools and gcc on Catalina are working as expected?


A ticket was open on the MuJoCo-py project here.

Best Answer

It is not your command line tools which are failing. Quite obvious, this is a compiler error and it seems like the python library was developed against a different set of headers - the compiler merely states a mismatch.

So gcc is working as expected - the python library‘s C extension is outdated. I fear there is little you can do aside from what you presumably already have done, namely opening a ticket in the MuJoCo-py project.

P.S. It would be nice if you added the information that you already opened a ticket in your question. Even if you did so after you asked here, you can always edit your question.