brson / brson/rust-sdl

Linking sdl-demo/sdl_main.rs fails

Open
#126 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
180
Forks
48
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the sdl-demo/sdl_main.rs approach with the working main.rs demo and inspect the reported linker command, especially the undefined reference to main. Reproduce the build with rustc 0.11-pre-nightly on x86_64-unknown-linux-gnu; done means sdl_main.rs links successfully and the demo runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.