Giter Site home page Giter Site logo

Compiling in Mac with Mujoco about gps HOT 19 CLOSED

cbfinn avatar cbfinn commented on July 16, 2024
Compiling in Mac with Mujoco

from gps.

Comments (19)

eaa3 avatar eaa3 commented on July 16, 2024 5

There appears to be a problem with line 64 in the file /usr/local/Cellar/cmake/3.5.2/share/cmake/Modules/FindPythonLibs.cmake.
I have temporarily commented this line in order to build gps on OSX Mavericks. After that, it generates fine with cmake 3.5.1. My guess is that there was a change in the behaviour of the function get_filename_component on more recent versions of cmake that made the statement in line 64 syntactically incorrect.

Editing to mention that cmake 3.5.1 presented similar issue

from gps.

jangirrishabh avatar jangirrishabh commented on July 16, 2024 1

@mjm522 @cbfinn I found an easier solution, just comment out Line number 14 in gps/src/3rdparty/Boost.NumPy/CMakeLists.txt
Where it is trying to look for PythonLibs 2.7 REQUIRED, because the requirement is already satisfied and thus conflicting with 3rdparty/CMakeLists.txt

I am in a Anaconda virtual environment on a Linux GPU machine, so my guess is that there was a conflict between the root python libs and the conda python libs

screenshot from 2018-02-06 12 23 39

from gps.

cbfinn avatar cbfinn commented on July 16, 2024

I would recommend trying to upgrade your cmake version. (e.g. found this on
a quick google search: openMVG/openMVG#348)

Chelesa

On Fri, Jun 10, 2016 at 7:56 PM, mjm522 [email protected] wrote:

I was successfully able to run ./compile_proto.sh, It did created all
necessary directories.

After to install the integration with MuJoCo, I tried the following and
gets following log for cmake and make -j.

$ cmake ../src/3rdparty
-- The C compiler identification is AppleClang 7.3.0.7030031
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Boost version: 1.60.0
-- Found the following Boost libraries:
-- python
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.10", minimum required is "2.7")
CMake Error at /usr/local/Cellar/cmake/3.5.2/share/cmake/Modules/FindPythonLibs.cmake:64 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
Boost.NumPy/CMakeLists.txt:14 (find_package)

-- Found PythonInterp: python (found version "2.7.11")
-- Found NumPy: version "1.11.0" /usr/local/lib/python2.7/site-packages/numpy/core/include
-- Boost version: 1.60.0
-- Found the following Boost libraries:
-- python
-- found boost:
INCLUDE: /usr/local/include
LIB: /usr/local/lib/libboost_python-mt.dylib
osg includes:
-- Configuring incomplete, errors occurred!
See also "/Users/michaelmathew/gps/build/CMakeFiles/CMakeOutput.log".
Michaels-MacBook-Pro:build michaelmathew$ make -j
make: *** No targets specified and no makefile found. Stop.

Is there anything else that needs to done while installing on mac? I am
using OSX El Capitan


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#28, or mute the thread
https://github.com/notifications/unsubscribe/ABMlAYGOn2PfshdOFr_z6Td2J2Sv9QC1ks5qKiPagaJpZM4IzdIW
.

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

I am already using Cmake 3.5.2..

from gps.

cbfinn avatar cbfinn commented on July 16, 2024

@zhangmarvin , @svlevine Do you know who has experience compiling mujoco on mac?

from gps.

svlevine avatar svlevine commented on July 16, 2024

Compiling MuJoCo, or compiling mjcpy? MuJoCo is closed source, so we do not compile it. I believe there are mac binaries (you can check on the Roboti website), and then we have to figure out how to compile mjcpy for Mac, which I think shouldn't be too hard.

The error above is

CMake Error at /usr/local/Cellar/cmake/3.5.2/share/cmake/Modules/FindPythonLibs.cmake:64 (get_filename_component):
get_filename_component called with incorrect number of arguments

It doesn't look like this has anything to do with us. Probably a mismatch between the cmake version and the FindPythonLibs.cmake module.

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

I solved this issue by downgrading to Cmake 3.3.2 and then rebuilding.
However now I have a new error.
when I try to run the example
python python/gps/gps_main.py mjc_example
It says: No module named mjcpy

from gps.

cbfinn avatar cbfinn commented on July 16, 2024

That error usually means that your python path isn't set up properly. Make sure that mjcpy is on your python path and ld library path, as explained in the set-up instructions.

Also, .bashrc files aren't always executed on start-up for macs, so you may want to source it in your .bash_profile.

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

I have edited the .bash_profile. and it does give out the path on echoing.
I have doubt:

The setup says to add

export DLD_LIBRARY_PATH=$DLD_LIBRARY_PATH:/path/to/gps/build/lib
export PYTHONPATH=$PYTHONPATH:/path/to/gps/build/lib

The make -jhas produced only one file in the above path. libboost_numpy.dylib
There are no files by the name mjcpy in the above path or is it within the above library?.
How many files do the make -j generate? I didn't get a single error while doing cmake or make!!!

With the above path given a python terminal also fails to find the file mjcpy.

Can you please suggest what might have went wrong other than the path problem.?

I have another doubt(suggestion) as well. The Cmakelist.txt inside /gps_path/src/mjcpy2/ the final line is

target_link_libraries(mjcpy "${CMAKE_SOURCE_DIR}/mjpro/libmujoco.so" ${OSG_LIBRARIES} boost_numpy)

But .so is a runtime library for linux. In mac it should be a .dylib file. So I edited the above line to be

target_link_libraries(mjcpy "${CMAKE_SOURCE_DIR}/mjpro131/bin/libmujoco131.dylib" ${OSG_LIBRARIES} boost_numpy)
So I guess your Cmake file should be added with the above line; though you have an if-endif instruction for detecting Apple inside Cmakelist.txt, you have only specified a single type of dynamic library integration which may not work in mac.

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

I saw there were some changes . I too edited the files as mentioned in the post. And finally I successfully compiled mjcpy.so!!!

That led to the new error in python terminal:

>>> import mjcpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/michaelmathew/gps/build/lib/mjcpy.so, 2): Library not loaded: @executable_path/libmujoco131.dylib
  Referenced from: /Users/michaelmathew/gps/build/lib/mjcpy.so
  Reason: image not found

I solved it by providing a sym link to the folder to /usr/lib

But now error is not there, but the moment I import, python terminal quits with following error.

"Python quit unexpectedly" with Segmentation fault: 11

Could you please suggest anything.. if it rings a bell? I almost did it.. but.... -_-

Note: Google search shows that this error is persistent with OSx python. But In all these years, I have never faced it with any of my python codes.

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

Could you please tell me on which version of python you got it working?

from gps.

cbfinn avatar cbfinn commented on July 16, 2024

We assume python 2.7, as mentioned on the docs:
http://rll.berkeley.edu/gps/

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

I finally compiled everything and it works fine now.

Here are a set of instructions to follow to install gps on Mac. It is tested on OSX El-Capitan and OSX Maverics :)

from gps.

cbfinn avatar cbfinn commented on July 16, 2024

Great, thanks!

from gps.

cbfinn avatar cbfinn commented on July 16, 2024

Can you make a pull request that adds a link to your instructions to the gps docs?

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

I put them up as a text file.
and Submitted :)

from gps.

cbfinn avatar cbfinn commented on July 16, 2024

I don't see the pull request...

from gps.

mjm522 avatar mjm522 commented on July 16, 2024

Could you please check now?

from gps.

robotsorcerer avatar robotsorcerer commented on July 16, 2024

Did you guys merge the pull request? I spent a number of hours trying to get this fixed.

from gps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.