BehaviorTree / Groot

Graphical Editor to create BehaviorTrees. Compliant with BehaviorTree.CPP
736 stars 239 forks source link

Installing Groot and BehaviorTree.CPP in docker #156

Open AmitNativ1984 opened 2 years ago

AmitNativ1984 commented 2 years ago

Hello, I had a problem building Groot with BehaviorTree.CPP inside docker. To solve it, I had to follow the specific instructions for building BehaviorTree.CPP. So if anyone might benefit from this... Here is the part from my Dockerfile to install both Groot and BehaviorTree.CPP

RUN git clone https://github.com/BehaviorTree/Groot.git &&\
    cd Groot &&\
    git submodule update --init --recursive &&\
    cd depend/BehaviorTree.CPP &&\
    mkdir build ; cd build &&\
    cmake .. &&\
    make &&\
    sudo make install &&\
    cd /root/Groot &&\
    mkdir build; cd build &&\
    cmake .. &&\
    make &&\
    # add alias for Groot GUI (simply type "Groot" in terminal)
    echo 'alias Groot="cd /root/Groot/build && ./Groot"' >> ~/.bashrc
igricart commented 2 years ago

Which error did you have? I also couldn't build from master so I checked out the branch that reverts https://github.com/BehaviorTree/Groot/pull/157 and it works

MrBlenny commented 2 years ago

What worked for me was:

Dockerfile:

FROM ubuntu:focal

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y -q git build-essential cmake python3 libzmq3-dev qt5-default libqt5svg5-dev

RUN git clone https://github.com/BehaviorTree/Groot.git &&\
    cd Groot &&\
    git submodule update --init --recursive &&\
    cd depend/BehaviorTree.CPP &&\
    mkdir build ; cd build &&\
    cmake .. &&\
    make &&\
    make install &&\
    cd /Groot &&\
    mkdir build; cd build &&\
    cmake .. &&\
    make &&\
    # add alias for Groot GUI (simply type "Groot" in terminal)
    echo 'alias Groot="cd /Groot/build && ./Groot"' >> ~/.bashrc

# fixes: "error while loading shared libraries: libbehaviortree_cpp_v3.so: cannot open shared object"
RUN ldconfig

CMD cd /Groot/build && ./Groot

Compose

Of course requires mounting x11 as a volume:

  groot:
    container_name: groot
    build:
      context: ./path_to_folder_with_dockerfile
    environment:
      - DISPLAY
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix:rw
AmitNativ1984 commented 2 years ago

Thank you. It works!