brson / rust-sdl

SDL bindings for Rust
MIT License
179 stars 52 forks source link

Linking sdl-demo/sdl_main.rs fails #126

Open albertofem opened 10 years ago

albertofem commented 10 years ago

Hi, I'm trying to run the demo using the sdl_main.rs approach, but it does not seems to be working. This is the linking error I got:

error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64' '-L/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-o' 'sdl_main' 'sdl_main.o' '-lmorestack' '-nodefaultlibs' '-Wl,--as-needed' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib' '/home/.../sdl/libsdl-e351513a-0.3.2.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-dd29dab1-0.11-pre.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-aad93cea-0.11-pre.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3574b280-0.11-pre.rlib' '-L.' '-L/home/.../sdl/.rust' '-L/home/.../sdl' '-Wl,-Bdynamic' '-lSDL' '-ldl' '-lpthread' '-lgcc_s' '-lc' '-lm' '-Wl,-rpath,$ORIGIN/../../../../../../../usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-Wl,-rpath,/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lcompiler-rt'
note: /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

error: aborting due to previous error

This is the Rust version I'm using:

rustc 0.11-pre-nightly (a5cd502 2014-04-22 02:06:35 -0700)
host: x86_64-unknown-linux-gnu

Running the main.rs demo worked fine. Any ideas?

lifthrasiir commented 10 years ago

I'm not sure about the current state of sdl_main.rs, especially because I don't have a Mac machine at my disposal. libSDLmain.a is primarily a means to get the consistent SDL_main entry point across different platforms anyway, so you can just use main.rs to build it on Linux anyway. I'll keep this issue open as the whole SDL_main business should be reconsidered at some point.