gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > STL and building time

#111212 - serratemplar - Mon Dec 04, 2006 10:31 pm

I can build c code that runs on both VisualBoy Advance and real hardware with my current set up. I'm currently trying to get some STL functionality in my gba programs and that is not going so well...

Here's my make.bat:

g++ -c -O3 -mthumb -mthumb-interwork hello.cpp
g++ -mthumb -mthumb-interwork -o hello.elf hello.o
objcopy -0binary hello.elf hello.bin

I wrote a gba rom that can print very ASCII characters to the screen at a target location that I'm experimenting with; it compiles, runs, and prints my favorite words anywhere I want. When I add this line to the top

#include <vector.h>

I can compile code (the first line of my bat file goes off okay), along with any std::vector stuff i want, but when I try to link it (the second line of the bat file) I get this

"stl_algobase.h:180: internal error: unsupported relocation error"

My only reasonable google hit seemed to suggest this was a bug in the linker (I'm using v3.0.2) but my attempts to upgrade have been unsuccessful (no matter how many times I modifiy my path variables or change directory names, v3.0.2 still seems to be in control).

Any thoughts? (Sorry if this is ambiguous, but I honestly don't know where to start looking to solve this issue, so I have little idea what to put in here.)

#111223 - tepples - Mon Dec 04, 2006 11:36 pm

serratemplar wrote:
I can build c code that runs on both VisualBoy Advance and real hardware with my current set up. I'm currently trying to get some STL functionality in my gba programs and that is not going so well...

Here's my make.bat:

g++ -c -O3 -mthumb -mthumb-interwork hello.cpp
g++ -mthumb -mthumb-interwork -o hello.elf hello.o
objcopy -0binary hello.elf hello.bin

For one thing, why are you using "g++" and not "arm-eabi-g++"? Which version of devkitARM are you using, or are you using something from before devkitARM?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#111240 - serratemplar - Tue Dec 05, 2006 3:47 am

I think I've found the nature of my problems here, which is a sad answer to your question.

I initially installed a devkitadv that came packed with cygwin (this was devkitadv 3, which I got like a bit over a year ago), which worked alright up until now. The docs packed with this kit let me to use g++ as I did above, and it worked so I never thought it was weird at all.

When I tried to use STL, it threw the error I asked about in the first post. A google hit suggested this was a linker bug, so I downloaded and set up devkitadv 4, uninstalling cygwin and its packed dka. Now I've got an interesting issue.

When I enter g++ into my command line (this is in windows cmd.exe), I get this newfangled error:

Linkstub failed (g++ -> arm-agb-elf-g++) = /cygdrive/c/devkitadv/... no such file or directory.

The reason there's "no such file or directory" is that I uninstalled cygwin. However, it seems like cygwin left some sort of lasting shortcut on my system that the uninstall didn't get rid of. I ran CCleaner to no avail, searched the registry for keys with g++ in them...again no go. My google searches for "linkstubs" in windows or otherwise have come up empty, except for debugging OpenOffice (which sadly isn't applicable I've determined). Using gcc on the commandline generates the exact same error.

I don't suppose anyone's heard of such an error of even wrangled with it before?

...if I could rename this thread to What is a "Linkstub" (damn you, Cygwin), I certainly would. =)

Thanks for your time; any other info you need from me, please ask.

#111388 - tepples - Wed Dec 06, 2006 4:15 am

Please uninstall devkitadv r3 and devkitadv r4 and install devkitPro Updater from http://www.devkitpro.org/ .

You can rename a topic by editing your first post and changing its Subject line.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#111544 - serratemplar - Thu Dec 07, 2006 2:44 pm

Ok, I have done as tepples suggested; I no longer see the "linkstub" errors on the dos emu commandline. Now I've got MySys (?) which looks a lot like cygwin, and no idea how to compile with it =)

I've been going thru docs left and right and I can't seem to find the doc that would tell me how to get started with the devkitpro environment. I tried to set it up for VC6++ and Visual Studio, but both of my attempts failed; I'm not quite sure why. I did my best to follow the instructions outlined on www.devkitpro.org.

Anyway, I don't need VC working; I'm quite fine on the commandline. Could anyone point me in the direction of what docs I should start with? (Like what program I use to compile, etc)

Again, thank you all for your time.

#111546 - Sausage Boy - Thu Dec 07, 2006 4:00 pm

The easiest way is to copy a template from the devkitpro/examples/gba/ folder. Rename it to the name of your project and drop your .c/.cpp files into the source directory. Using msys, change into that directory and type 'make'.
_________________
"no offense, but this is the gayest game ever"

#111647 - serratemplar - Fri Dec 08, 2006 6:15 pm

ty SausageBoy; I'll give that a go. Thank you all for helping me to get rolling.