Gcc linker error on a crate


#1

Hi, everyone, new to rust here.
Spent my Christmas holidays playing with Rust :smile:

Haven’t done anything that geeky since highschool, haha.

I gotta say, this borrowing business is hard.

Anyway, I have decided to try interfacing with lua and I was trying out

J.C. Moyer’s lua crate, unfortunately I just couldn’t get lua 5.3 to build on my windows machine so I decided to create a 5.2.4 version and try it on my computer instead.

Now that I managed to get the crate built, I still can’t seem to be able to use it in a project.

Here’s the linker error I get when I executed cargo build

[quote] error: linking withgcc` failed: exit code: 1

note: “gcc” “-Wl,–enable-long-section-names” “-fno-use-linker-plugin” “-Wl,–nxcompat” “-static-libgcc” “-m64” “-L”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib”
“C:\users\swu\Documents\rust\lua-test\target\debug\lua_test.0.o” “-o”
“C:\users\swu\Documents\rust\lua-test\target\debug\lua_test.exe”
"-Wl,–gc-sections" “-L” “C:\users\swu\Documents\rust\lua-test\target\debug” “-L”
“C:\users\swu\Documents\rust\lua-test\target\debug\deps” “-L”
“C:\users\swu\documents\rust\lua-test\target\debug\build\lua-7a33874f268c5b07\out/lua-5.2.4/src” “-L”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib” “-L”
“C:\users\swu\Documents\rust\lua-test\.rust\bin\x86_64-pc-windows-gnu” “-L”
“C:\users\swu\Documents\rust\lua-test\bin\x86_64-pc-windows-gnu” “-Wl,-Bstatic” “-Wl,-Bdynamic”
“C:\Users\swu\Documents\rust\lua-test\target\debug\deps\liblua-7a33874f268c5b07.rlib”
“C:\Users\swu\Documents\rust\lua-test\target\debug\deps\liblibc-29adb837ec836726.rlib”
“C:\Users\swu\Documents\rust\lua-test\target\debug\deps\libbitflags-dd68b8369bcd8ff0.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\libstd-35c36e89.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\libcollections-35c36e89.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\librustc_unicode-35c36e89.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\librand-35c36e89.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\liballoc-35c36e89.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\liballoc_jemalloc-35c36e89.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\liblibc-35c36e89.rlib”
“C:\Program Files\Rust stable 1.5\bin\rustlib\x86_64-pc-windows-gnu\lib\libcore-35c36e89.rlib”
"-l" “ws2_32” “-l” “userenv” “-l” “advapi32” “-l” “compiler-rt”[/quote]

Should I not see -l lua somewhere?

Anyway, here’s the error I got from rust

I’ve never really done too much with gcc, so I’m not sure if linking was done correctly here, it looked like when I built the interface package, it did have -l static=lua at the end.

So I’m wondering, how do I know if I built the crate properly? Is this something I need to fix in the test-project?

EDIT (UPDATE)
So I finally managed to build the jcmoyer version using the git url in dependency, it still gives me the same linker error.
Does this mean I didn’t set up lua correctly instead of a lua thing?

Thank you