mlua icon indicating copy to clipboard operation
mlua copied to clipboard

x86_64-unknown-linux-musl linker errors

Open theoparis opened this issue 3 years ago • 5 comments

I am using the following features and I recieved a ton of linker errors when using the linux musl target. Any ideas how I can get this to build statically without linker errors? This seemed to be the easiest lua engine in rust that is up to date that I've found, yet it doesn't seem to build statically 😕

mlua = { git = "https://github.com/khvzak/mlua", default-features = false, features = [
    "luajit",
    "vendored",
    "module",
    "async",
    "send",
    "serialize",
    "macros",
] }
::ptr::drop_in_place<core::result::Result<mlua::table::Table,mlua::error::Error>>':
          packa.46f14847-cgu.0:(.text._ZN4core3ptr88drop_in_place$LT$core..result..Result$LT$mlua..table..Table$C$mlua..error..Error$GT$$GT$17hafc083c1789007b0E+0x32): undefined reference to `lua_pushnil'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4core3ptr88drop_in_place$LT$core..result..Result$LT$mlua..table..Table$C$mlua..error..Error$GT$$GT$17hafc083c1789007b0E+0x41): undefined reference to `lua_replace'
          /usr/bin/ld: /mnt/data/projects/theos/core/target/x86_64-unknown-linux-musl/release/deps/packa-e94598e29a96bb64.packa.46f14847-cgu.0.rcgu.o: in function `mlua::table::Table::get':
          packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0xf5): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0x110): undefined reference to `lua_checkstack'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0x12c): undefined reference to `lua_pushvalue'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0x142): undefined reference to `lua_xmove'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0x1f4): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0x210): undefined reference to `lua_settop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0x3be): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17ha575e4fb41f2dd36E+0x3d1): undefined reference to `lua_settop'
          /usr/bin/ld: /mnt/data/projects/theos/core/target/x86_64-unknown-linux-musl/release/deps/packa-e94598e29a96bb64.packa.46f14847-cgu.0.rcgu.o: in function `mlua::table::Table::get':
          packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0xf6): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x111): undefined reference to `lua_checkstack'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x12e): undefined reference to `lua_pushvalue'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x144): undefined reference to `lua_xmove'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x201): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x21d): undefined reference to `lua_settop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x54c): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x563): undefined reference to `lua_settop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x5da): undefined reference to `lua_pushnil'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua5table5Table3get17h882d8968726157eeE+0x5ea): undefined reference to `lua_replace'
          /usr/bin/ld: /mnt/data/projects/theos/core/target/x86_64-unknown-linux-musl/release/deps/packa-e94598e29a96bb64.packa.46f14847-cgu.0.rcgu.o: in function `mlua::conversion::<impl mlua::value::ToLua for &str>::to_lua':
          packa.46f14847-cgu.0:(.text._ZN4mlua10conversion56_$LT$impl$u20$mlua..value..ToLua$u20$for$u20$$RF$str$GT$6to_lua17hfad88570daaae71cE+0x25): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua10conversion56_$LT$impl$u20$mlua..value..ToLua$u20$for$u20$$RF$str$GT$6to_lua17hfad88570daaae71cE+0x3a): undefined reference to `lua_checkstack'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua10conversion56_$LT$impl$u20$mlua..value..ToLua$u20$for$u20$$RF$str$GT$6to_lua17hfad88570daaae71cE+0x5b): undefined reference to `lua_gettop'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua10conversion56_$LT$impl$u20$mlua..value..ToLua$u20$for$u20$$RF$str$GT$6to_lua17hfad88570daaae71cE+0x70): undefined reference to `lua_pushcclosure'
          /usr/bin/ld: packa.46f14847-cgu.0:(.text._ZN4mlua

theoparis avatar Feb 17 '22 09:02 theoparis

Similar to https://github.com/khvzak/mlua/issues/85 Could you try to follow the steps from the linked issue.

khvzak avatar Feb 17 '22 10:02 khvzak

Not sure if this should be a new issue but I have a new project that does NOT use musl but that gives undefined reference errors along with luau...


          /usr/bin/ld: /home/theo/dev/dyadikos/target/debug/deps/libmlua-bb5fc77f94b52466.rlib(mlua-bb5fc77f94b52466.mlua.adb252e2-cgu.7.rcgu.o): in function `mlua::string::String::as_bytes_with_nul':
          /home/theo/.cargo/git/checkouts/mlua-4fd10c345875f70c/d607039/src/string.rs:102: undefined reference to `lua_type'
          /usr/bin/ld: /home/theo/.cargo/git/checkouts/mlua-4fd10c345875f70c/d607039/src/string.rs:109: undefined reference to `lua_tolstring'
          /usr/bin/ld: /home/theo/dev/dyadikos/target/debug/deps/libmlua-bb5fc77f94b52466.rlib(mlua-bb5fc77f94b52466.mlua.adb252e2-cgu.7.rcgu.o): in function `mlua::serde::de::check_value_if_skip::{{closure}}':
          /home/theo/.cargo/git/checkouts/mlua-4fd10c345875f70c/d607039/src/serde/de.rs:583: undefined reference to `lua_topointer'

I'm using the following dependency configuration:

mlua = { git = "https://github.com/khvzak/mlua", features = [
    "luau",
    "serialize",
    "module",
    "send",
    "async",
] }

theoparis avatar Apr 08 '22 23:04 theoparis

It seems to also be occurring with lua54 actually 🤔

theoparis avatar Apr 08 '22 23:04 theoparis

I'm afraid Luau does not support binary modules at all. What is your os? Could you try to add "vendored" feature?

khvzak avatar Apr 10 '22 22:04 khvzak

I'm on Arch Linux and I tried to use the vendored feature with the lua54 feature again, however it continues to complain about undefined references to lua libraries. If I don't have the vendored feature it will complain about pkgconfig.

theoparis avatar Apr 20 '22 05:04 theoparis

Please reopen is this stil actual

khvzak avatar Jul 17 '23 23:07 khvzak