Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我把letter shell移植到linux平台,编译报错 #164

Open
justdomyself opened this issue Aug 15, 2023 · 10 comments
Open

我把letter shell移植到linux平台,编译报错 #164

justdomyself opened this issue Aug 15, 2023 · 10 comments

Comments

@justdomyself
Copy link

  |          ^~~~~

lshell/source/shell.c:27:5: error: expected primary-expression before ‘.’ token
27 | .attr.value = SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_USER),
| ^
lshell/source/shell.c:28:5: error: expected primary-expression before ‘.’ token
28 | .data.user.name = shellCmdDefaultUser,
| ^
lshell/source/shell.c:29:5: error: expected primary-expression before ‘.’ token
29 | .data.user.password = shellPasswordDefaultUser,
| ^
lshell/source/shell.c:30:5: error: expected primary-expression before ‘.’ token
30 | .data.user.desc = shellDesDefaultUser
| ^
lshell/source/shell.c: In function ‘void shellInit(Shell*, char*, short unsigned int)’:
lshell/source/shell.c:202:71: error: cast from ‘const unsigned int*’ to ‘unsigned int’ loses precision [-fpermissive]
202 | shell->commandList.count = ((unsigned int)(&_shell_command_end)
| ^
lshell/source/shell.c:203:71: error: cast from ‘const unsigned int*’ to ‘unsigned int’ loses precision [-fpermissive]
203 | - (unsigned int)(&_shell_command_start))
| ^
lshell/source/shell.c:217:61: error: invalid conversion from ‘void*’ to ‘ShellCommand*’ {aka ‘shell_command*’} [-fpermissive]
217 | shell->commandList.base,
| ~~~~~~~~~~~~~~~~~~~^~~~
| |
| void*
lshell/source/shell.c:159:46: note: initializing argument 3 of ‘ShellCommand* shellSeekCommand(Shell*, const char*, ShellCommand*, short unsigned int)’
159 | ShellCommand base,
| ~~~~~~~~~~~~~~^~~~
lshell/source/shell.c: In function ‘short unsigned int shellWriteCommandDesc(Shell
, const char*)’:
lshell/source/shell.c:331:22: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
331 | shell->write("...", 3);
| ^~~~~
lshell/source/shell.c: In function ‘ShellCommand* shellSeekCommand(Shell*, const char*, ShellCommand*, short unsigned int)’:
lshell/source/shell.c:986:15: error: cast from ‘ShellCommand*’ {aka ‘shell_command*’} to ‘int’ loses precision [-fpermissive]
986 | ((int)base - (int)shell->commandList.base) / sizeof(ShellCommand);
| ^~~~
lshell/source/shell.c:986:46: error: cast from ‘void*’ to ‘int’ loses precision [-fpermissive]
986 | ((int)base - (int)shell->commandList.base) / sizeof(ShellCommand);

参考的是x86的那个例子

@lotoohe-space
Copy link

lotoohe-space commented Aug 15, 2023 via email

@justdomyself
Copy link
Author

怎么解决呢 ?

@justdomyself
Copy link
Author

我把x86-demo的cmake指定交叉编译器生成makefile编译,也是一堆错误。:
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/sys/select.h:67:26: error: ‘__FD_SETSIZE’ undeclared here (not in a function); did you mean ‘__FD_SET’?
__fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
^~~~~~~~~~~~
__FD_SET
In file included from /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/stdlib.h:394:0,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/shell_cfg_user.h:15,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/../../src/shell_cfg.h:16,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/../../src/shell.h:15,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/shell_port.h:15,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/main.c:11:
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/sys/types.h:185:9: error: unknown type name ‘__blksize_t’
typedef __blksize_t blksize_t;
^~~~~~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/sys/types.h:192:9: error: unknown type name ‘__blkcnt_t’
typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. /
^~~~~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/sys/types.h:196:9: error: unknown type name ‘__fsblkcnt_t’
typedef __fsblkcnt_t fsblkcnt_t; /
Type to count file system blocks. /
^~~~~~~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/sys/types.h:200:9: error: unknown type name ‘__fsfilcnt_t’
typedef __fsfilcnt_t fsfilcnt_t; /
Type to count file system inodes. /
^~~~~~~~~~~~
In file included from /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/sys/types.h:227:0,
from /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/stdlib.h:394,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/shell_cfg_user.h:15,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/../../src/shell_cfg.h:16,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/../../src/shell.h:15,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/shell_port.h:15,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/main.c:11:
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/pthreadtypes.h:23:2: error: #error "__WORDSIZE is not defined"
#error "__WORDSIZE is not defined"
^~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/pthreadtypes.h:46:2: error: #error "Unknown __WORDSIZE detected"
#error "Unknown __WORDSIZE detected"
^~~~~
In file included from /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/signal.h:57:0,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/main.c:13:
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:58:6: error: unknown type name ‘__pid_t’
__pid_t si_pid; /
Sending process ID. /
^~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:59:6: error: unknown type name ‘__uid_t’
__uid_t si_uid; /
Real user ID of sending process. /
^~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:73:6: error: unknown type name ‘__pid_t’
__pid_t si_pid; /
Sending process ID. /
^~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:74:6: error: unknown type name ‘__uid_t’
__uid_t si_uid; /
Real user ID of sending process. /
^~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:81:6: error: unknown type name ‘__pid_t’
__pid_t si_pid; /
Which child. /
^~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:82:6: error: unknown type name ‘__uid_t’
__uid_t si_uid; /
Real user ID of sending process. */
^~~~~~~
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:84:6: error: unknown type name ‘__clock_t’
__SI_CLOCK_T si_utime;
^
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/siginfo_t.h:85:6: error: unknown type name ‘__clock_t’
__SI_CLOCK_T si_stime;
^
In file included from /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/signal.h:66:0,
from /home/alientek/Desktop/alientek/letter-shell-master/demo/x86-gcc/main.c:13:
/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include/bits/types/sigevent_t.h:34:2: error: unknown type name ‘__pid_t’

@NevermindZZT
Copy link
Owner

有部分是强制转换的错,你是不是使用的 clang,原先代码里面很多会报警告的强转,这个得花点时间处理下

@justdomyself
Copy link
Author

有部分是强制转换的错,你是不是使用的 clang,原先代码里面很多会报警告的强转,这个得花点时间处理下

什么时候出一个可以在嵌入式linux平台交叉编译通过的版本啊? 还有那个ld文件是必须得么?

@NevermindZZT
Copy link
Owner

有部分是强制转换的错,你是不是使用的 clang,原先代码里面很多会报警告的强转,这个得花点时间处理下

什么时候出一个可以在嵌入式linux平台交叉编译通过的版本啊? 还有那个ld文件是必须得么?

你的目标平台是什么,使用命令导出必须修改ld

@justdomyself
Copy link
Author

有部分是强制转换的错,你是不是使用的 clang,原先代码里面很多会报警告的强转,这个得花点时间处理下

什么时候出一个可以在嵌入式linux平台交叉编译通过的版本啊? 还有那个ld文件是必须得么?

你的目标平台是什么,使用命令导出必须修改ld

目标平台是imx6ull或者imx8m。

关键是这个ld我不知道该怎么改,能各个demo 么?

@NevermindZZT
Copy link
Owner

有部分是强制转换的错,你是不是使用的 clang,原先代码里面很多会报警告的强转,这个得花点时间处理下

什么时候出一个可以在嵌入式linux平台交叉编译通过的版本啊? 还有那个ld文件是必须得么?

你的目标平台是什么,使用命令导出必须修改ld

目标平台是imx6ull或者imx8m。

关键是这个ld我不知道该怎么改,能各个demo 么?

这个和工具链关联太大了,有些工具链会修改,x86 的 demo 里面有一个改了的,针对 gcc

@justdomyself
Copy link
Author

有部分是强制转换的错,你是不是使用的 clang,原先代码里面很多会报警告的强转,这个得花点时间处理下

什么时候出一个可以在嵌入式linux平台交叉编译通过的版本啊? 还有那个ld文件是必须得么?

你的目标平台是什么,使用命令导出必须修改ld

目标平台是imx6ull或者imx8m。
关键是这个ld我不知道该怎么改,能各个demo 么?

这个和工具链关联太大了,有些工具链会修改,x86 的 demo 里面有一个改了的,针对 gcc

你手头有交叉工具链么,改一个出来参考下

@justdomyself
Copy link
Author

有部分是强制转换的错,你是不是使用的 clang,原先代码里面很多会报警告的强转,这个得花点时间处理下

什么时候出一个可以在嵌入式linux平台交叉编译通过的版本啊? 还有那个ld文件是必须得么?

你的目标平台是什么,使用命令导出必须修改ld

目标平台是imx6ull或者imx8m。
关键是这个ld我不知道该怎么改,能各个demo 么?

这个和工具链关联太大了,有些工具链会修改,x86 的 demo 里面有一个改了的,针对 gcc

gcc编译是通过,运行没毛病。 我用imx6ull的交叉编译工具链就通过不了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants