MIT Cheetah-Software在ubuntu20、ubuntu21和ubuntu22中编译通过的方法

 MIT Cheetah-Software在Ubuntu20、Ubuntu21和ubuntu22中的环境搭建请参考CSDN,但在编译时会报错,需要修改两处内容:

1、修改MIT Cheetah-Software项目中的顶级CMakeList.txt

if(MINI_CHEETAH_BUILD)
    SET (THIS_COM "../" )
    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
        ${CMAKE_BINARY_DIR}/Configuration.h)
    set(CMAKE_CXX_FLAGS "-O3 -no-pie -ggdb -Wall \
        -Wextra -Wcast-align -Wdisabled-optimization -Wformat=2 \
        -Winit-self -Wmissing-include-dirs -Woverloaded-virtual \
        -Wshadow -Wsign-promo -Werror -Wno-error=stringop-truncation")
    set(CMAKE_C_FLAGS "-O3  -ggdb -std=gnu99 -I.")
    message("**** Mini-Cheetah build enabled ****")
else(MINI_CHEETAH_BUILD)
    SET (THIS_COM "${PROJECT_SOURCE_DIR}/" )
    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
        ${CMAKE_BINARY_DIR}/Configuration.h)

    if(CMAKE_SYSTEM_NAME MATCHES Linux)
        set(CMAKE_CXX_FLAGS "-O3 -no-pie -march=native -ggdb -Wall \
            -Wextra -Wcast-align -Wdisabled-optimization -Wformat=2 \
            -Winit-self -Wmissing-include-dirs -Woverloaded-virtual \
            -Wshadow -Wsign-promo -Werror -Wno-error=stringop-truncation")
    elseif(APPLE)
        set(CMAKE_CXX_FLAGS "-O3 -march=native -ggdb -Wall \
            -Wextra -Wcast-align -Wdisabled-optimization -Wformat=2 \
            -Winit-self -Wmissing-include-dirs -Woverloaded-virtual \
            -Wshadow -Wsign-promo")
        include_directories("/usr/local/include/")   # lcm includes
    endif()

    set(CMAKE_C_FLAGS "-O3  -ggdb  -march=native -std=gnu99 -I.")
    message("**** Mini-Cheetah build disabled ****")
endif(MINI_CHEETAH_BUILD)

上面代码中添加了两处-Wno-error=stringop-truncation

2、修改robot/src/rt/rt_serial.cpp

#ifdef linux

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define termios asmtermios
#include <asm/termios.h>
#undef termios

#include <termios.h>
#include <math.h>
#include <pthread.h>
#if 0
#include <stropts.h>
#else
//#include <sys/ioctl.h>
extern "C"
{
    extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
}
#endif

在ubuntu20、ubuntu21和ubuntu22中不存在头文件stropts.h。因此需要将#include <stropts.h>替换成extern "C" int ioctl (int __fd, unsigned long int __request, ...) __THROW;

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值