使文件因构建 libbot2 库而错误

使文件因构建 libbot2 库而错误

让我描述一下我的问题。到目前为止,我正在构建请求库的 MPNet libbot2

我已经安装了需求库如下:

        GLib 2.0+
        CMake
        LCM       (http://lcm.googlecode.com)
        Java      (Sun JDK or OpenJDK strongly preferred)
        Python
        GTK+ 2.0+ (required by bot2-vis)
        OpenGL    (required by bot2-vis)
        GLUT
        PyGTK
    libglib2.0-dev
    cmake
    sun-java6-jdk | default-jdk | openjdk-6-jdk
    python-dev
    python-gtk2
    libgtk2.0-dev
    mesa-common-dev
    libgl1-mesa-dev
    libglu1-mesa-dev
    freeglut3-dev
    libjpeg-dev

这是我的部分环境设置。

OS: Ubuntu 18.04
    freeglut3-dev is already the newest version (2.8.1-3)
    libxi-dev is already the newest version (2:1.7.9-1)
    libxmu-dev is already the newest version (2:1.1.2-2)
    binutils is already the newest version (2.30-21ubuntu1~18.04.3)
    libglu1-mesa-dev is already the newest version (9.0.0-2.1build1)
    libgtk2.0-dev is already the newest version (2.24.32-1ubuntu1)
    libjpeg-dev is already the newest version (8c-2ubuntu8)
    freeglut3-dev is already the newest version (2.8.1-3)
    libgl1-mesa-dev is already the newest version (19.2.8-0ubuntu0~18.04.3)
    libglib2.0-dev is already the newest version (2.56.4-0ubuntu0.18.04.6)
    mesa-common-dev is already the newest version (19.2.8-0ubuntu0~18.04.3)
    LCM version 1.4.0

当我使用时sudo make,出现了这个错误。我发现我无法成功构建bot2-vis这个阶段。

-------------------------------------------
-- bot2-vis
-------------------------------------------
[  2%] Building C object src/bot_vis/CMakeFiles/bot2-vis.dir/viewer.c.o
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c: In function ‘bot_viewer_start_recording’:
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:136:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     self->movie_gzf = gzopen(self->movie_path, "w");
                     ^
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:137:17: warning: passing argument 1 of ‘gzsetparams’ from incompatible pointer type [-Wincompatible-pointer-types]
     gzsetparams(self->movie_gzf, Z_BEST_SPEED, Z_DEFAULT_STRATEGY);
                 ^~~~
In file included from /home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:9:0:
/usr/include/zlib.h:1380:21: note: expected ‘gzFile {aka struct gzFile_s *}’ but argument is of type ‘struct gzFile_s **’
 ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
                     ^~~~~~~~~~~
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c: In function ‘bot_viewer_stop_recording’:
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:173:13: warning: passing argument 1 of ‘gzclose’ from incompatible pointer type [-Wincompatible-pointer-types]
     gzclose(self->movie_gzf);
             ^~~~
In file included from /home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:9:0:
/usr/include/zlib.h:1631:24: note: expected ‘gzFile {aka struct gzFile_s *}’ but argument is of type ‘struct gzFile_s **’
 ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
                        ^~~~~~~
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c: In function ‘on_gl_expose’:
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:498:18: warning: passing argument 1 of ‘gzprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
         gzprintf(self->movie_gzf, "P6 %d %d %d\n", self->movie_width, self->movie_height, 255);
                  ^~~~
In file included from /home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:9:0:
/usr/include/zlib.h:1469:23: note: expected ‘gzFile {aka struct gzFile_s *}’ but argument is of type ‘struct gzFile_s **’
 ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
                       ^~~~~~~~
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:502:21: warning: passing argument 1 of ‘gzwrite’ from incompatible pointer type [-Wincompatible-pointer-types]
             gzwrite(self->movie_gzf, &self->movie_buffer[offset], self->movie_stride);
                     ^~~~
In file included from /home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:9:0:
/usr/include/zlib.h:1447:21: note: expected ‘gzFile {aka struct gzFile_s *}’ but argument is of type ‘struct gzFile_s **’
 ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
                     ^~~~~~~
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c: In function ‘on_button_press’:
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:600:5: error: expected ‘,’ or ‘;’ before ‘BotEventHandler’
     BotEventHandler *best_handler = NULL;
     ^~~~~~~~~~~~~~~
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:610:21: error: ‘best_handler’ undeclared (first use in this function); did you mean ‘sa_handler’?
                     best_handler = handler;
                     ^~~~~~~~~~~~
                     sa_handler
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:610:21: note: each undeclared identifier is reported only once for each function it appears in
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c: In function ‘on_motion_notify’:
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:690:2: error: expected ‘,’ or ‘;’ before ‘BotEventHandler’
  BotEventHandler *best_handler = NULL;
  ^~~~~~~~~~~~~~~
/home/chieh/github/libbot2/bot2-vis/src/bot_vis/viewer.c:701:21: error: ‘best_handler’ undeclared (first use in this function); did you mean ‘sa_handler’?
                     best_handler = handler;
                     ^~~~~~~~~~~~
                     sa_handler
src/bot_vis/CMakeFiles/bot2-vis.dir/build.make:322: recipe for target 'src/bot_vis/CMakeFiles/bot2-vis.dir/viewer.c.o' failed
make[4]: *** [src/bot_vis/CMakeFiles/bot2-vis.dir/viewer.c.o] Error 1
CMakeFiles/Makefile2:130: recipe for target 'src/bot_vis/CMakeFiles/bot2-vis.dir/all' failed
make[3]: *** [src/bot_vis/CMakeFiles/bot2-vis.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make[2]: *** [all] Error 2
Makefile:27: recipe for target 'all' failed
make[1]: *** [all] Error 2
Makefile:19: recipe for target 'all' failed
make: *** [all] Error 2

我该如何解决这个问题?谢谢

答案1

Ubuntu 18.04:构建请求 libbot2 的 MPNet:libbot2 错误

sudo apt install openjdk11-jdk

cd lcm-1.4.0/ && mkdir build && cd build/
cmake -DLCM_ENABLE_TESTS=NO -DCMAKE_INSTALL_PREFIX=/usr ..
make
.
[ 79%] Built target lcm-java
.
[ 90%] Built target lcm-python
[100%] Built target lcm-lua

注意:LCM_ENABLE_TESTS是默认选项,在 95% 时会导致错误 → test/java/hamcrest-core-1.3/org/hamcrest/core/AllOf.java 。因此-DLCM_ENABLE_TESTS=NO,即在上述构建示例中禁用测试。

*** 使用更高版本的libbot2 https://github.com/ripl-ttic/libbot2

 git clone https://github.com/ripl-ttic/libbot2.git
 cd libbot2/
 sudo make BUILD_PREFIX=/usr         ## no errors
.
[ 91%] Completed 'bot2-lcm-utils'
[100%] Built target bot2-lcm-utils

相关内容