Skip to content

x86_64-unknown-linux-musl linker errors #129

Closed
@theoparis

Description

@theoparis

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

Activity

khvzak

khvzak commented on Feb 17, 2022

@khvzak
Member

Similar to #85
Could you try to follow the steps from the linked issue.

theoparis

theoparis commented on Apr 8, 2022

@theoparis
Author

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

theoparis commented on Apr 8, 2022

@theoparis
Author

It seems to also be occurring with lua54 actually 🤔

khvzak

khvzak commented on Apr 10, 2022

@khvzak
Member

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

theoparis

theoparis commented on Apr 20, 2022

@theoparis
Author

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.

khvzak

khvzak commented on Jul 17, 2023

@khvzak
Member

Please reopen is this stil actual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @khvzak@theoparis

        Issue actions

          x86_64-unknown-linux-musl linker errors · Issue #129 · mlua-rs/mlua