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

Luau fails to pass tests with extern_c = true #5989

Open
raxracks opened this issue Dec 16, 2024 · 0 comments
Open

Luau fails to pass tests with extern_c = true #5989

raxracks opened this issue Dec 16, 2024 · 0 comments
Labels

Comments

@raxracks
Copy link

Xmake Version

2.9.6

Operating System Version and Architecture

Linux laptop 6.11.0-1001-asahi-arm #1-Ubuntu SMP PREEMPT_DYNAMIC Sat Sep 28 14:42:09 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Describe Bug

The test in the Luau package fails to link because the extern_c config flag adds extern "C" to all the functions meaning they don't have mangled names and can't be found when linking unless the test also has extern "C", I would submit my own pull request but I don't know how to change the test based on config flags.

/usr/bin/ld: /tmp/.xmake1000/241216/_30972899FDE349008EBF238727CE0510.o: in function `test()': _9B8070A7849241B0B487B0797A8791EE.cpp:(.text+0x8): undefined reference to `luaL_newstate()' /usr/bin/ld: _9B8070A7849241B0B487B0797A8791EE.cpp:(.text+0x14): undefined reference to `luaL_openlibs(lua_State*)' /usr/bin/ld: _9B8070A7849241B0B487B0797A8791EE.cpp:(.text+0x1c): undefined reference to `lua_close(lua_State*)'

Expected Behavior

The test should pass, as it does with the extern_c flag disabled

Project Configuration

add_rules("mode.debug", "mode.release")

add_requires("luau", { configs = { extern_c = true } })

target("luau-test")
    set_kind("binary")
    add_files("src/*.c")
    add_packages("luau")

Additional Information and Error Logs

> /usr/bin/g++ -o /tmp/.xmake1000/241216/_E19865D3ADAD483080527B34368CEB50.b /tmp/.xmake1000/241216/_E19865D3ADAD483080527B34368CEB50.o -L/home/sam/.xmake/packages/l/luau/0.643/c73bc7e59e274cd6b9cc974db0c13fcd/lib -lLuau.VM -lLuau.CodeGen -lLuau.EqSat -lLuau.Analysis -lLuau.Config -lLuau.Compiler -lLuau.Ast
/usr/bin/ld: /tmp/.xmake1000/241216/_E19865D3ADAD483080527B34368CEB50.o: in function `test()':
_9B8070A7849241B0B487B0797A8791EE.cpp:(.text+0x8): undefined reference to `luaL_newstate()'
/usr/bin/ld: _9B8070A7849241B0B487B0797A8791EE.cpp:(.text+0x14): undefined reference to `luaL_openlibs(lua_State*)'
/usr/bin/ld: _9B8070A7849241B0B487B0797A8791EE.cpp:(.text+0x1c): undefined reference to `lua_close(lua_State*)'
collect2: error: ld returned 1 exit status
> checking for c++ links(Luau.VM, Luau.CodeGen, Luau.EqSat, Luau.Analysis, Luau.Config, Luau.Compiler, Luau.Ast)
> checking for c++ snippet(test)
checkinfo: ...gramdir/core/sandbox/modules/import/core/tool/linker.lua:75: @programdir/core/sandbox/modules/os.lua:378: execv(/usr/bin/g++ -o /tmp/.xmake1000/241216/_E19865D3ADAD483080527B34368CEB50.b /tmp/.xmake1000/241216/_E19865D3ADAD483080527B34368CEB50.o -L/home/sam/.xmake/packages/l/luau/0.643/c73bc7e59e274cd6b9cc974db0c13fcd/lib -lLuau.VM -lLuau.CodeGen -lLuau.EqSat -lLuau.Analysis -lLuau.Config -lLuau.Compiler -lLuau.Ast) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:1004]:
    [@programdir/core/sandbox/modules/os.lua:378]: in function 'execv'
    [@programdir/modules/core/tools/gcc.lua:599]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]:
    [@programdir/core/tool/linker.lua:232]: in function 'link'
    [...gramdir/core/sandbox/modules/import/core/tool/linker.lua:73]: in function 'link'
    [@programdir/modules/lib/detect/check_cxsnippets.lua:249]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/lib/detect/check_cxsnippets.lua:236]:
    [....xmake/repositories/xmake-repo/packages/l/luau/xmake.lua:81]: in function 'script'
    [...dir/modules/private/action/require/impl/utils/filter.lua:114]: in function 'call'
    [...dir/modules/private/action/require/impl/actions/test.lua:41]:
    [.../modules/private/action/require/impl/actions/install.lua:432]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [.../modules/private/action/require/impl/actions/install.lua:361]:
    [...modules/private/action/require/impl/install_packages.lua:496]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:241]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/async/runjobs.lua:223]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:406]:

error: ....xmake/repositories/xmake-repo/packages/l/luau/xmake.lua:81: ...gramdir/core/sandbox/modules/import/core/tool/linker.lua:75: @programdir/core/sandbox/modules/os.lua:378: execv(/usr/bin/g++ -o /tmp/.xmake1000/241216/_E19865D3ADAD483080527B34368CEB50.b /tmp/.xmake1000/241216/_E19865D3ADAD483080527B34368CEB50.o -L/home/sam/.xmake/packages/l/luau/0.643/c73bc7e59e274cd6b9cc974db0c13fcd/lib -lLuau.VM -lLuau.CodeGen -lLuau.EqSat -lLuau.Analysis -lLuau.Config -lLuau.Compiler -lLuau.Ast) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:1004]:
    [@programdir/core/sandbox/modules/os.lua:378]: in function 'execv'
    [@programdir/modules/core/tools/gcc.lua:599]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]:
    [@programdir/core/tool/linker.lua:232]: in function 'link'
    [...gramdir/core/sandbox/modules/import/core/tool/linker.lua:73]: in function 'link'
    [@programdir/modules/lib/detect/check_cxsnippets.lua:249]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/lib/detect/check_cxsnippets.lua:236]:
    [....xmake/repositories/xmake-repo/packages/l/luau/xmake.lua:81]: in function 'script'
    [...dir/modules/private/action/require/impl/utils/filter.lua:114]: in function 'call'
    [...dir/modules/private/action/require/impl/actions/test.lua:41]:
    [.../modules/private/action/require/impl/actions/install.lua:432]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [.../modules/private/action/require/impl/actions/install.lua:361]:
    [...modules/private/action/require/impl/install_packages.lua:496]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:241]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:244]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/async/runjobs.lua:223]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:406]:

  => install luau 0.643 .. failed
error: @programdir/core/main.lua:329: @programdir/core/sandbox/modules/import/core/base/task.lua:65: @programdir/modules/async/runjobs.lua:325: .../modules/private/action/require/impl/actions/install.lua:494: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:1004]:
    [.../modules/private/action/require/impl/actions/install.lua:494]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
    [.../modules/private/action/require/impl/actions/install.lua:361]:
    [...modules/private/action/require/impl/install_packages.lua:496]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:241]:

stack traceback:
	[C]: in function 'error'
	@programdir/core/base/os.lua:1004: in function 'os.raiselevel'
	(...tail calls...)
	@programdir/core/main.lua:329: in upvalue 'cotask'
	@programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
@raxracks raxracks added the bug label Dec 16, 2024
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

1 participant