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

交叉编译器获取不到check_sizeof大小 #4491

Closed
ririyeye opened this issue Dec 12, 2023 · 11 comments
Closed

交叉编译器获取不到check_sizeof大小 #4491

ririyeye opened this issue Dec 12, 2023 · 11 comments
Labels
Milestone

Comments

@ririyeye
Copy link
Contributor

Xmake 版本

v2.8.5+master

操作系统版本和架构

ubuntu22 gcc-linaro-5.4.1-2017.05-x86_64_arm-linux-gnueabihf

描述问题

交叉编译器无法获取到target:check_sizeof数据
配置阶段的编译器检查编译文件时链接了后级的库 导致链接失败 然后target:check_sizeof执行失败

期待的结果

aarch64应该是8

工程配置

target("cmd_dbg")
    on_config(function (target)
        print("sizeof(long) = %s", target:check_sizeof("long"))
        print("sizeof(string) = %s", target:check_sizeof("std::string", {includes = "string"}))
        if target:check_sizeof("long") == 8 then
            target:add("defines", "LONG64")
        end
    end)
    set_kind("binary")
    add_files("cmd_dbg.cpp")
    set_languages("c++11")
    add_deps("ar8030_client")

附加信息和错误日志

checking for flags (-fvisibility-inlines-hidden) ... ok

aarch64-linux-gnu-gcc "-fvisibility-inlines-hidden"
checking for flags (-O0) ... ok
aarch64-linux-gnu-gcc "-O0"
/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -c -g -O0 -std=c++11 -Icom -o /tmp/.xmake1000/231212/_1CB95516D9B5480081CD66A747DDE710.o /tmp/.xmake1000/231212/_0D2F185D1C554BDAA8AC5E536263DA75.cpp
checking for flags (-fdiagnostics-color=always) ... ok
aarch64-linux-gnu-gcc "-fdiagnostics-color=always"
/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ -o /tmp/.xmake1000/231212/_1CB95516D9B5480081CD66A747DDE710.b /tmp/.xmake1000/231212/_1CB95516D9B5480081CD66A747DDE710.o -Lbuild/cross/arm64/debug -lar8030_client -lcom -lpthread
/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lar8030_client
/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcom
collect2: error: ld returned 1 exit status
checking for c++ snippet(#define SIZE (si)
checkinfo: ...gramdir/core/sandbox/modules/import/core/tool/linker.lua:75: @programdir/core/sandbox/modules/os.lua:378: execv(/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ -o /tmp/.xmake1000/231212/_1CB95516D9B5480081CD66A747DDE710.b /tmp/.xmake1000/231212/_1CB95516D9B5480081CD66A747DDE710.o -Lbuild/cross/arm64/debug -lar8030_client -lcom -lpthread) failed(1)
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:949]:
[@programdir/core/sandbox/modules/os.lua:378]: in function 'execv'
[@programdir/modules/core/tools/gcc.lua:526]:
[C]: in function 'xpcall'
[@programdir/core/base/utils.lua:280]:
[@programdir/core/tool/linker.lua:224]: in function 'link'
[...gramdir/core/sandbox/modules/import/core/tool/linker.lua:73]: in function 'link'
[@programdir/modules/lib/detect/check_cxsnippets.lua:247]:
[C]: in function 'xpcall'
[@programdir/core/base/utils.lua:280]: in function 'trycall'
[@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
[@programdir/modules/lib/detect/check_cxsnippets.lua:236]:
[@programdir/modules/lib/detect/check_sizeof.lua:68]:
[./app/test/xmake.lua:12]: in function 'on_config'
[...dir/core/sandbox/modules/import/core/project/project.lua:137]: in function '_config_target'
[...dir/core/sandbox/modules/import/core/project/project.lua:156]: in function '_config_targets'
[...dir/core/sandbox/modules/import/core/project/project.lua:207]: in function 'load_targets'
[@programdir/actions/config/main.lua:402]:
[C]: in function 'xpcall'
[@programdir/core/base/utils.lua:280]:
[@programdir/core/base/task.lua:501]: in function 'run'
[@programdir/core/main.lua:307]: in function 'cotask'
[@programdir/core/base/scheduler.lua:404]:

sizeof(long) = %s

@ririyeye ririyeye added the bug label Dec 12, 2023
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: Cross compiler cannot obtain check_sizeof size

@waruqi
Copy link
Member

waruqi commented Dec 12, 2023

/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lar8030_client
/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcom

看下这两个库在哪配置的,库在哪个路径下

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../ ../aarch64-linux-gnu/bin/ld: cannot find -lar8030_client
/home/wangyang/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../. ./aarch64-linux-gnu/bin/ld: cannot find -lcom

Check where these two libraries are configured and which path they are under.

@ririyeye
Copy link
Contributor Author

这两个库是同个项目下编译生成的 没有进到编译阶段 所以这两个库还没有开始编译

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


These two libraries were compiled and generated under the same project and have not entered the compilation stage, so the compilation of these two libraries has not started yet.

@waruqi
Copy link
Member

waruqi commented Dec 12, 2023

这得需要改下内部实现,估计得等几天,你可以用描述域 check_sizeof 接口,那个是不继承 target 配置的

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This requires changing the internal implementation, which may take a few days.

@waruqi
Copy link
Member

waruqi commented Dec 12, 2023

再试试 xmake update -s github:xmake-io/xmake#check

#4492

@waruqi waruqi added this to the v2.8.6 milestone Dec 12, 2023
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Try xmake update -s github:xmake-io/xmake#check again

#4492

@ririyeye
Copy link
Contributor Author

再试试 xmake update -s github:xmake-io/xmake#check

#4492

可以了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Try again xmake update -s github:xmake-io/xmake#check

#4492

That's it

waruqi added a commit that referenced this issue Dec 12, 2023
improve to check snippets in target #4491
@waruqi waruqi closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants