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

Error on termux #5029

Closed
lualvsil opened this issue Apr 28, 2024 · 4 comments
Closed

Error on termux #5029

lualvsil opened this issue Apr 28, 2024 · 4 comments
Labels
Milestone

Comments

@lualvsil
Copy link

Xmake Version

2.9.1

Operating System Version and Architecture

android 9, armv7a

Describe Bug

When I try to compile a C/C++ program in termux, xmake crashes with a "Segmentation Fault" error, compiling other languages ​​this does not occur

Expected Behavior

Generate the binary files

Project Configuration

The basic project generated with "xmake create "

Additional Information and Error Logs

checking for platform ... linux
checking for architecture ... armv7a
checking for gcc ... ok
checkinfo: runv(zig version) failed(255)
checking for zig ... no
checkinfo: runv(zig version) failed(255)
checking for zig ... no
checkinfo: runv(nim --version) failed(255)
checking for nim ... no
checkinfo: runv(nim --version) failed(255)
checking for nim ... no
checking for gcc ... ok
checking for the c++ compiler (cxx) ... gcc
checking for flags (-fPIC) ... ok

gcc "-fPIC"
checking for flags (-fvisibility-inlines-hidden) ... ok
gcc "-fvisibility-inlines-hidden"
checking for flags (-O3) ... ok
gcc "-O3"
checking for flags (-DNDEBUG) ... ok
gcc "-DNDEBUG"
[ 50%]: cache compiling.release src/main.cpp
gcc -c -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -o build/.objs/z/linux/armv7a/release/src/main.cpp.o src/main.cpp
checking for flags (-MMD -MF) ... ok
gcc "-MMD" "-MF" "/dev/null"
checking for flags (-fdiagnostics-color=always) ... ok
gcc "-fdiagnostics-color=always"
Segmentation fault

@lualvsil lualvsil added the bug label Apr 28, 2024
@waruqi waruqi transferred this issue from xmake-io/.github Apr 29, 2024
@waruqi
Copy link
Member

waruqi commented Apr 29, 2024

I have no termux to test it.

@waruqi
Copy link
Member

waruqi commented May 5, 2024

xxhash crash on armv7

Thread 1 "xmake" received signal SIGSEGV, Segmentation fault.
0x0042b36c in XXH_read64 (ptr=0x7fffffff)              at core/src/xmake/../xxhash/xxhash/xxhash.h:2586                                                  2586        return *((const xxh_unalign64*)ptr);   (gdb) bt                                           #0  0x0042b36c in XXH_read64 (ptr=0x7fffffff)          at core/src/xmake/../xxhash/xxhash/xxhash.h:2586
#1  0x00427fc8 in XXH_readLE64 (ptr=0x7fffffff)        at core/src/xmake/../xxhash/xxhash/xxhash.h:2655                                                  #2  0x0042c08c in XXH3_mix16B (                        input=0x7fffffff <error: Cannot access memory at address 0x7fffffff>,
    secret=0x41ba40 <XXH3_kSecret> "\270\376l9#\244K\276|\001\201,\367!\255\034\336\324m郐\227\333r@\244\244\267\263g\037\313y\346N\314\300\345x\202Z\320}\314\377r!\270\bFt\367C$\216\3405\220\346\201:&L<(R\273\221", <incomplete sequence \303>, seed64=0)      at core/src/xmake/../xxhash/xxhash/xxhash.h:3937                                                  #3  0x0042d7ac in XXH128_mix32B (acc=...,
    input_1=0x7fffffff <error: Cannot access memory at address 0x7fffffff>,
    input_2=0x8000000f <error: Cannot access memory at address 0x8000000f>,
    secret=0x41ba40 <XXH3_kSecret> "\270\376l9#\244K\276|\001\201,\367!\255\034\336\324m郐\227\333r@\244\244\267\263g\037\313y\346N\314\300\345x\202Z\320}\314\377r!\270\bFt\367C$\216\3405\220\346\201:&L<(R\273\221", <incomplete sequence \303>, seed=0)    --Type <RET> for more, q to quit, c to continue without paging--                                          at core/src/xmake/../xxhash/xxhash/xxhash.h:5611                                                  #4  0x0042cec0 in XXH3_len_129to240_128b (             input=0x7fffffff <error: Cannot access memory at address 0x7fffffff>, len=132,                        secret=0x41ba40 <XXH3_kSecret> "\270\376l9#\244K\276|\001\201,\367!\255\034\336\324m郐\227\333r@\244\244\267\263g\037\313y\346N\314\300\345x\202Z\320}\314\377r!\270\bFt\367C$\216\3405\220\346\201:&L<(R\273\221", <incomplete sequence \303>,                secretSize=192, seed=0)
    at core/src/xmake/../xxhash/xxhash/xxhash.h:5677
#5  0x00429fa8 in XXH3_128bits_internal (              input=0x7fffffff, len=132, seed64=0,
    secret=0x41ba40 <XXH3_kSecret>,                    secretLen=192,
    f_hl128=0x429fec <XXH3_hashLong_128b_default>)     at core/src/xmake/../xxhash/xxhash/xxhash.h:5814                                                  #6  0x00429eac in XM_XXH3_128bits (                    input=0x7fffffff, len=132)                         at core/src/xmake/../xxhash/xxhash/xxhash.h:5824                                                  #7  0x0042ad1c in xm_hash_xxhash (lua=0xf5c517a4)
    at core/src/xmake/hash/xxhash.c:77             --Type <RET> for more, q to quit, c to continue without paging--                                      #8  0x00555a7c in luaD_precall (L=0xf5c517a4,
    func=0xf6686e50, nresults=2)                       at core/src/lua/lua/ldo.c:532
#9  0x0058a754 in luaV_execute (L=0xf5c517a4,          ci=0xf5a114d0) at core/src/lua/lua/lvm.c:1624
#10 0x00556850 in unroll (L=0xf5c517a4, ud=0x0)        at core/src/lua/lua/ldo.c:685
#11 0x005561cc in resume (L=0xf5c517a4,                ud=0xfffed1e8) at core/src/lua/lua/ldo.c:749   #12 0x00554814 in luaD_rawrunprotected (               L=0xf5c517a4, f=0x5560c4 <resume>,                 ud=0xfffed1e8) at core/src/lua/lua/ldo.c:144   #13 0x00555f54 in lua_resume (L=0xf5c517a4,            from=0xf6f01824, nargs=1, nresults=0xfffed208)     at core/src/lua/lua/ldo.c:788
#14 0x0055e128 in auxresume (L=0xf6f01824,             co=0xf5c517a4, narg=1)
    at core/src/lua/lua/lcorolib.c:39              #15 0x0055dd50 in luaB_coresume (L=0xf6f01824)
    at core/src/lua/lua/lcorolib.c:59              #16 0x00555a7c in luaD_precall (L=0xf6f01824,
    func=0xf6702dc0, nresults=2)                       at core/src/lua/lua/ldo.c:532
#17 0x0058a754 in luaV_execute (L=0xf6f01824,          ci=0xf6dc0a10) at core/src/lua/lua/lvm.c:1624
#18 0x00555dc8 in ccall (L=0xf6f01824,             --Type <RET> for more, q to quit, c to continue without paging--                                          func=0xf64c3100, nResults=1, inc=65537)            at core/src/lua/lua/ldo.c:577                  #19 0x00555e10 in luaD_callnoyield (L=0xf6f01824,      func=0xf64c3100, nResults=1)                       at core/src/lua/lua/ldo.c:595
#20 0x0054df24 in f_call (L=0xf6f01824,                ud=0xfffedc90) at core/src/lua/lua/lapi.c:1031
#21 0x00554814 in luaD_rawrunprotected (               L=0xf6f01824, f=0x54def0 <f_call>,
    ud=0xfffedc90) at core/src/lua/lua/ldo.c:144   #22 0x0055650c in luaD_pcall (L=0xf6f01824,
    func=0x54def0 <f_call>, u=0xfffedc90,              old_top=48, ef=32)
    at core/src/lua/lua/ldo.c:892                  #23 0x0054ddd0 in lua_pcallk (L=0xf6f01824,
    nargs=0, nresults=1, errfunc=-2, ctx=0, k=0x0)     at core/src/lua/lua/lapi.c:1057
#24 0x0041e91c in xm_engine_main (                     self=0xf6ee4214, argc=1, argv=0xfffeed54,
    taskargv=0x0) at core/src/xmake/engine.c:1326  #25 0x0041f4e4 in xm_engine_run (
    name=0x418b46 "xmake", argc=1,                     argv=0xfffeed54, taskargv=0x0,
    lni_initalizer=0x0)                                at core/src/xmake/engine.c:1355
#26 0x0041d8ac in main (argc=1, argv=0xfffeed54)   --Type <RET> for more, q to quit, c to continue without paging--

@waruqi waruqi mentioned this issue May 5, 2024
@waruqi
Copy link
Member

waruqi commented May 6, 2024

it get invalid address here.

tb_byte_t const* data = (tb_byte_t const*)(tb_size_t)(tb_long_t)lua_tonumber(lua, 2);

I know reason, but I have not know how to improve it yet.

waruqi added a commit that referenced this issue May 7, 2024
@waruqi waruqi added this to the v2.9.2 milestone May 7, 2024
@waruqi
Copy link
Member

waruqi commented May 7, 2024

I have fixed it.

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

2 participants