Blizarre / pocketgo-docker-rust

Pocketgo buildroot Docker image with Rust
GNU General Public License v3.0
1 stars 0 forks source link

Linker Errors! #1

Open aprowe opened 2 years ago

aprowe commented 2 years ago

Hey, I am so stoked to find this repo! I have been trying to learn buildroot all weekend because I really wanted to write Rust code for my pocketgo, then I found this! I built the image successfully, then tried to build your mountain example and got some linker errors:

       SDL_error.c:(.text+0x2c): undefined reference to `strlcpy'                                                                                                                                                                                  arm-linux-ld: SDL_error.c:(.text+0x168): undefined reference to `strlcpy'                                                                                                                                                                   arm-linux-ld: /root/buildroot/output/host/bin/../arm-buildroot-linux-musleabi/sysroot/usr/lib/libSDL.a(SDL_audio.o): in function `SDL_AudioDriverName':                                                                                     SDL_audio.c:(.text+0x1f4): undefined reference to `strlcpy'                                                                                                                                                                                 arm-linux-ld: /root/buildroot/output/host/bin/../arm-buildroot-linux-musleabi/sysroot/usr/lib/libSDL.a(SDL_audio.o): in function `SDL_AudioInit':                                                                                           SDL_audio.c:(.text+0x3c0): undefined reference to `strcasecmp'                                                                                                                                                                              arm-linux-ld: /root/buildroot/output/host/bin/../arm-buildroot-linux-musleabi/sysroot/usr/lib/libSDL.a(SDL_audio.o): in function `SDL_OpenAudio':                                                                                           SDL_audio.c:(.text+0x5e8): undefined reference to `atoi'                                                                                                                                                                                    arm-linux-ld: SDL_audio.c:(.text+0x668): undefined reference to `atoi'                                                                                                                                                                      arm-linux-ld: SDL_audio.c:(.text+0x6b4): undefined reference to `atoi'                                                                                                                                                                      arm-linux-ld: SDL_audio.c:(.text+0x708): undefined reference to `atoi'                                                                                                                                                                      arm-linux-ld: /root/buildroot/output/host/bin/../arm-buildroot-linux-musleabi/sysroot/usr/lib/libSDL.a(SDL_keyboard.o): in function `SDL_KeyboardInit':                                                                                     SDL_keyboard.c:(.text+0x528): undefined reference to `atoi'                                                                                                                                                                                 arm-linux-ld: /root/buildroot/output/host/bin/../arm-buildroot-linux-musleabi/sysroot/usr/lib/libSDL.a(SDL_rwops.o): in function `stdio_seek':                                                                                              SDL_rwops.c:(.text+0x138): undefined reference to `fseek'                                                                                                                                                                                   arm-linux-ld: SDL_rwops.c:(.text+0x14c): undefined reference to `ftell'                            

Was there some steps I needed to do to set up the linker path?

aprowe commented 2 years ago

ok I added

export RUSTFLAGS='-L /root/buildroot/output/staging/usr/lib -lc -lasound '

Which fixed most linker errors, but now i get
conf.c:(.text+0x1e8c): undefined reference to__aeabi_l2d'`

Which seems to be for libgcc?

aprowe commented 2 years ago

ok I got it to build! Looks like I just had to build it in release mode? It fails to start on my pocketgo, but have yet to get the logs from that

Blizarre commented 2 years ago

Hum, It would build fine at the time, I did not set explicit version pinning because I was still very much tinkering with it. For the pocketgo, the code generated was not always100% compatible (probably some compiler optimization that wasn't triggered all the time), so changing the rust code would sometimes make the binary unable to start (invalid assemble instruction). You can find the logs in the pocketgo system tab I think?

In the end I focused on improving mountain code independently from the pocketgo. You will want to change the default resolution for mountain to the pocketgo standard resolution (320x240). In the end I focused on improving mountain code independently from the pocketgo. You will want to change the default resolution for mountain to the pocketgo standard resolution (320x240).