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

NXP系列交叉编译 #178

Open
simon1990842 opened this issue Jan 13, 2022 · 5 comments
Open

NXP系列交叉编译 #178

simon1990842 opened this issue Jan 13, 2022 · 5 comments

Comments

@simon1990842
Copy link

描述问题

NPX系列 IMX.8 Linux中进行交叉编译,无法完成。

期待的结果

能顺利完成tbox IMX.8交叉编译。

错误信息

image
error: ...mdir/core/sandbox/modules/import/core/base/scheduler.lua:56: cannot find known tool script for aarch64-poky-linux-gcc -mcpu=cortex-a35+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux
stack traceback:
@programdir/core/base/utils.lua:290: in function <@programdir/core/base/utils.lua:280>
[C]: in function 'error'
@programdir/core/base/os.lua:829: in function 'base/os.raiselevel'
(...tail calls...)
...mdir/core/sandbox/modules/import/core/base/scheduler.lua:56: in field 'co_start_withopt'
@programdir/modules/private/async/runjobs.lua:199: in function <@programdir/modules/private/async/runjobs.lua:159>
[C]: in function 'xpcall'
@programdir/core/base/utils.lua:280: in function 'base/utils.trycall'
@programdir/core/base/scheduler.lua:487: in function 'base/scheduler.co_group_begin'
...mdir/core/sandbox/modules/import/core/base/scheduler.lua:94: in field 'co_group_begin'
@programdir/modules/private/async/runjobs.lua:159: in function <@programdir/modules/private/async/runjobs.lua:54>
(...tail calls...)
@programdir/actions/build/build.lua:244: in function <@programdir/actions/build/build.lua:238>
(...tail calls...)
@programdir/actions/build/main.lua:101: in global '_do_build'
@programdir/actions/build/main.lua:143: in function <@programdir/actions/build/main.lua:137>
[C]: in function 'xpcall'
@programdir/core/base/utils.lua:280: in function 'base/utils.trycall'
@programdir/core/sandbox/modules/try.lua:121: in global 'try'
@programdir/actions/build/main.lua:135: in function <@programdir/actions/build/main.lua:106>
(...tail calls...)
[C]: in function 'xpcall'
@programdir/core/base/utils.lua:280: in function 'base/utils.trycall'
(...tail calls...)
@programdir/core/base/task.lua:519: in function 'base/task.run'
@programdir/core/main.lua:278: in upvalue 'cotask'
@programdir/core/base/scheduler.lua:371: in function <@programdir/core/base/scheduler.lua:368>
上述情况为按照手册,先source 了交叉编译环境进行的交叉编译;

image
上述根据教程手动设置编译选项的结果图

相关环境

ubuntu 18.04

其他信息

NXP imx.8 芯片交叉编译

@waruqi
Copy link
Member

waruqi commented Jan 13, 2022

上述情况为按照手册,先source 了交叉编译环境进行的交叉编译;

我文档里好像没说过要 source

xmake f 带下 -c -vD 看下错误详情,并贴下完整 工具链 目录结构和文件名

@waruqi
Copy link
Member

waruqi commented Jan 14, 2022

目录结构没给全,我不知道你的 aarch64-poky-linux-gcc 在哪里

export CC="aarch64-poky-linux-gcc -mcpu=cortex-a35+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export CXX="aarch64-poky-linux-g++ -mcpu=cortex-a35+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export CPP="aarch64-poky-linux-gcc -E -mcpu=cortex-a35+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$SDKTARGETSYSROOT"
export AS="aarch64-poky-linux-as "
export LD="aarch64-poky-linux-ld --sysroot=$SDKTARGETSYSROOT"
export GDB=aarch64-poky-linux-gdb
export STRIP=aarch64-poky-linux-strip
export RANLIB=aarch64-poky-linux-ranlib
export OBJCOPY=aarch64-poky-linux-objcopy
export OBJDUMP=aarch64-poky-linux-objdump
export READELF=aarch64-poky-linux-readelf
export AR=aarch64-poky-linux-ar
export NM=aarch64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=aarch64-poky-linux-
export CONFIGURE_FLAGS="--target=aarch64-poky-linux --host=aarch64-poky-linux --build=x86_64-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now"
export CPPFLAGS=""
export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"
export OECORE_DISTRO_VERSION="5.4-zeus"
export OECORE_SDK_VERSION="5.4-zeus"
export ARCH=arm64
export CROSS_COMPILE=aarch64-poky-linux-

另外,这些全删了,xmake 交叉编译不需要,只会干扰。 cflags 走 xmake.lua add_cflags 或者 --cflags=xx 设置

如果 gcc 在 /opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin

只需要,xmake f -p cross --sdk=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux -c -vD

@waruqi
Copy link
Member

waruqi commented Jan 14, 2022

2、运行xmake f -p cross --sdk=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux -c -vD

不要乱设置,文档里面有详细说明,仔细看下,--sdk 仅用于 xxx/bin xxx/include 等标准结构,--sdk=xxx

所以,我要你的工具链完整结构,你每次都不给全,include 在哪。。lib 在哪。。什么的都没给。。就不能一次给全么。。一个 tree 命令的事。。

不规则结构工具链,根据文档,适当追加配置。。

xmake f -p cross --sdk=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr  ...

你先仔细完整看下这篇文档:https://xmake.io/#/zh-cn/guide/configuration?id=%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e9%85%8d%e7%bd%ae

@simon1990842
Copy link
Author

simon1990842 commented Jan 14, 2022

2、运行xmake f -p cross --sdk=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux -c -vD

不要乱设置,文档里面有详细说明,仔细看下,--sdk 仅用于 xxx/bin xxx/include 等标准结构,--sdk=xxx

所以,我要你的工具链完整结构,你每次都不给全,include 在哪。。lib 在哪。。什么的都没给。。就不能一次给全么。。一个 tree 命令的事。。

不规则结构工具链,根据文档,适当追加配置。。

xmake f -p cross --sdk=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr  ...

你先仔细完整看下这篇文档:https://xmake.io/#/zh-cn/guide/configuration?id=%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e9%85%8d%e7%bd%ae

xmake f -p cross --bin=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --includedirs=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/include --linkdirs=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/lib:/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/lib:/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/lib:/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/lib --cross=aarch64-poky-linux-

路径都已经包含完,但是最后1%还有有几个库找不到,手动在路径中可以搜索到。

image

文件路径.log

@waruqi
Copy link
Member

waruqi commented Jan 14, 2022

你这么配,应该等价于下面这样。

xmake f -p cross --bin=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux --sdk=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr -c -vD

剩下的错误,可以尝试设置下 sysroot,--target 什么自己看下,xmake -vD 可以看完整命令,自己手动执行调下

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

2 participants