ART-Pi SDK在Linux环境下编译不通过问题

发布于 2020-11-08 21:46:01    浏览:559

本人对于RT-Thread算是新手一枚,平时用的最多的是Linux开发环境,Windows下RT-Studio开发是方便,但编译速度相对比较慢,想尝试在linux下编译ART-Pi SDK。

Linux环境如下:

  • Win10 WSL
  • Ubuntu 20.0.4
  • gcc version 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]

注:RT-Thread的相关配置是在Windows下已经配置好生成rtconfig.h,及确保新引入的模块已经加入到SConscript,没有使用env配置.

遇到的问题如下3个问题:

1、在SDK下的工程目录下执行scons --target=makefile,编译过程正常,但无文件生成;

$ scons --target=makefile
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/applications/main.o
CC build/board/CubeMX_Config/Core/Src/stm32h7xx_hal_msp.o
CC build/board/board.o
CC build/board/drv_mpu.o
... ...
CC build/packages/webnet-v2.0.2/src/wn_utils.o
AS libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/startup_stm32h750xx.o
LINK rt-thread.elf
arm-none-eabi-objcopy -O binary rt-thread.elf rtthread.bin
arm-none-eabi-size rt-thread.elf
scons: done building targets.

**2、执行scons命令,出错**
 scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/applications/main.o
In file included from rt-thread/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h:14,
                 from /usr/include/newlib/sys/types.h:50,
                 from /usr/include/newlib/time.h:28,
                 from /usr/include/newlib/sys/stat.h:9,
                 from rt-thread/include/libc/libc_stat.h:14,
                 from rt-thread/include/rtlibc.h:15,
                 from rt-thread/include/rtdef.h:1090,
                 from rt-thread/include/rtthread.h:24,
                 from applications/main.c:11:
rt-thread/components/dfs/include/dfs_select.h:19:22: error: unknown type name 'fd_set'
   19 | int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
      |                      ^~~~~~
rt-thread/components/dfs/include/dfs_select.h:19:39: error: unknown type name 'fd_set'
   19 | int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
      |                                       ^~~~~~
rt-thread/components/dfs/include/dfs_select.h:19:57: error: unknown type name 'fd_set'
   19 | int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
      |                                                         ^~~~~~
In file included from /usr/include/newlib/signal.h:6,
                 from rt-thread/include/libc/libc_signal.h:71,
                 from rt-thread/include/rtlibc.h:21,
                 from rt-thread/include/rtdef.h:1090,
                 from rt-thread/include/rtthread.h:24,
                 from applications/main.c:11:
/usr/include/newlib/sys/signal.h:42:7: error: redefinition of 'union sigval'
   42 | union sigval {
      |       ^~~~~~
In file included from rt-thread/include/rtlibc.h:21,
                 from rt-thread/include/rtdef.h:1090,
                 from rt-thread/include/rtthread.h:24,
                 from applications/main.c:11:
rt-thread/include/libc/libc_signal.h:27:7: note: originally defined here
   27 | union sigval
      |       ^~~~~~
In file included from /usr/include/newlib/signal.h:6,
                 from rt-thread/include/libc/libc_signal.h:71,
                 from rt-thread/include/rtlibc.h:21,
                 from rt-thread/include/rtdef.h:1090,
                 from rt-thread/include/rtthread.h:24,
                 from applications/main.c:11:
/usr/include/newlib/sys/signal.h:47:8: error: redefinition of 'struct sigevent'
   47 | struct sigevent {
      |        ^~~~~~~~
In file included from rt-thread/include/rtlibc.h:21,
                 from rt-thread/include/rtdef.h:1090,
                 from rt-thread/include/rtthread.h:24,
                 from applications/main.c:11:
rt-thread/include/libc/libc_signal.h:35:8: note: originally defined here
   35 | struct sigevent
      |        ^~~~~~~~
In file included from /usr/include/newlib/signal.h:6,
                 from rt-thread/include/libc/libc_signal.h:71,
                 from rt-thread/include/rtlibc.h:21,
                 from rt-thread/include/rtdef.h:1090,
                 from rt-thread/include/rtthread.h:24,
                 from applications/main.c:11:
/usr/include/newlib/sys/signal.h:72:3: error: conflicting types for 'siginfo_t'
   72 | } siginfo_t;
      |   ^~~~~~~~~
In file included from rt-thread/include/rtlibc.h:21,
                 from rt-thread/include/rtdef.h:1090,
                 from rt-thread/include/rtthread.h:24,
                 from applications/main.c:11:
rt-thread/include/libc/libc_signal.h:54:24: note: previous declaration of 'siginfo_t' was here
   54 | typedef struct siginfo siginfo_t;
      |                        ^~~~~~~~~
In file included from packages/webnet-v2.0.2/inc/wn_module.h:33,
                 from modules/web/web.h:21,
                 from applications/main.c:17:
packages/webnet-v2.0.2/inc/wn_session.h:100:29: error: unknown type name 'fd_set'
  100 | int webnet_sessions_set_fds(fd_set *readset, fd_set *writeset);
      |                             ^~~~~~
packages/webnet-v2.0.2/inc/wn_session.h:100:46: error: unknown type name 'fd_set'
  100 | int webnet_sessions_set_fds(fd_set *readset, fd_set *writeset);
      |                                              ^~~~~~
packages/webnet-v2.0.2/inc/wn_session.h:101:33: error: unknown type name 'fd_set'
  101 | void webnet_sessions_handle_fds(fd_set *readset, fd_set *writeset);
      |                                 ^~~~~~
packages/webnet-v2.0.2/inc/wn_session.h:101:50: error: unknown type name 'fd_set'
  101 | void webnet_sessions_handle_fds(fd_set *readset, fd_set *writeset);
      |                                                  ^~~~~~
scons: *** [build/applications/main.o] Error 1
scons: building terminated because of errors.

3、scons --menuconfig执行出错

$ scons --menuconfig
scons: Reading SConscript files ...
AttributeError: 'str' object has no attribute 'load_config':
  File "/mnt/e/STM32/STM32H750XB_ART_Pi/SConstruct", line 44:
    objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  File "/mnt/e/STM32/STM32H750XB_ART_Pi/rt-thread/tools/building.py", line 374:
    menuconfig(Rtt_Root)
  File "/home/algo/.local/lib/python3.8/site-packages/menuconfig.py", line 685:
    _conf_changed = _load_config()
  File "/home/algo/.local/lib/python3.8/site-packages/menuconfig.py", line 741:
    print(_kconf.load_config())

主要遇到以上3个问题,不确定是WSL编译环境导致,还是本身ART-Pi的SDK对Linux下的支持不是很完善。

查看更多

3 个回答
chenyaxing
chenyaxing 2020-11-10
This guy hasn't written anything yet

使用python2 的scons 试一下,这里的一些问题看起来像是python2 和python3 的差异原因

whj467467222
whj467467222 认证专家 2020-12-02
This guy hasn't written anything yet

在 RTT Studio 中使用了 cconfig.h 来指定了编译器和lib 库,你看看你这个在 linux 怎么设置

jhb
jhb 2021-06-18
This guy hasn't written anything yet

翻一下旧帖子,希望遇到同样问题的人可以看到

环境: Ubuntu 下开发,使用 scons --menuconfig 命令出现问题
报错信息:

AttributeError: 'str' object has no attribute 'load_config':
  File "/home/jhb/phytium_work/ft2004/rtos/rt-thread/bsp/phytium/ft2004/SConstruct", line 31:
    objs = PrepareBuilding(env, RTT_ROOT)
  File "/home/jhb/phytium_work/ft2004/rtos/rt-thread/tools/building.py", line 398:
    menuconfig(Rtt_Root)
  File "/usr/local/lib/python2.7/dist-packages/menuconfig.py", line 685:
    _conf_changed = _load_config()
  File "/usr/local/lib/python2.7/dist-packages/menuconfig.py", line 741:
    print(_kconf.load_config())

1、观察发现是调用menuconfig.py文件内出来问题,在排查过程中发现在rtt的tools目录下也有这个文件,故怀疑是俩个文件的名字重复了,导致调用了错误的文件
2、/usr/local/lib/python2.7/dist-packages/menuconfig.py 这个文件是之前安装kconfiglib包时安装的文件,使用pip uninstall kconfiglib命令卸载该包

3、再次执行 scons --menuconfig 恢复正常。

该调用来自tools/building.py文件内,但是对于python不是很熟悉,不清楚如何引用本目录下的文件
是否可以实现类似C语言的 #include<> #include" 这个效果
目前只能使用删除kconfiglib包解决这个问题

撰写答案

请登录后再发布答案,点击登录
关注者
0
被浏览
559

发布
问题

分享
好友

手机
浏览

扫码手机浏览