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.

C/C++ > Newest devkitadv has a problem?

#12952 - MumblyJoe - Tue Dec 02, 2003 6:17 am

Hey, i recently started using the latest devkitadv (used to use a version i cant remember) and now my make.bat file (yeah i know makefiles are better, gimme the source for one if you want) wont work anymore:

Code:
c:\devkitadv\bin\as -o crt0.o crt0.s

c:\devkitadv\bin\g++ -c -O3 -mthumb -mthumb-interwork -fno-rtti -fno-exceptions Frogger.cpp
c:\devkitadv\bin\g++ -mthumb -mthumb-interwork -nostartfiles -T lnkscript -o Frogger.elf crt0.o crtbegin.o crtend.o Frogger.o

c:\devkitadv\bin\objcopy -O binary Frogger.elf Frogger.gba


See, very simple thing, but when I try to compile with the new version I get the following errors:


Code:
C:\Programming\GBA Projects\TileFrogger>c:\devkitadv\bin\as -o crt0.o crt0.s

C:\Programming\GBA Projects\TileFrogger>c:\devkitadv\bin\g++ -c -O3 -mthumb -mthumb-interwork -fno-rtti -fno-exceptions Frogger.cpp

C:\Programming\GBA Projects\TileFrogger>c:\devkitadv\bin\g++ -mthumb -mthumb-interwork -nostartfiles -T lnkscript -o Frogger.elf crt0.o crtbegin.o crtend.o Frogger.o
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\bin\ld.exe: crt0.o(_start): warning: interworking not enabled.
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\bin\ld.exe:   first occurrence: c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-exit.o): thumb call to arm
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-exit.o): In function `_exit':
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-exit.c:5: internal error: dangerous error
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-sbrk.o): In function `_sbrk':
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-sbrk.c:28: undefined reference to `__appended_end'
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-sbrk.c:28: undefined reference to `__heap_limit'
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-sbrk.c:28: undefined reference to `__appended_start'
collect2: ld returned 1 exit status
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\bin\ld.exe: crt0.o(_start): warning: interworking not enabled.
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\bin\ld.exe:   first occurrence: c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-exit.o): thumb call to arm
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-exit.o): In function `_exit':
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-exit.c:5: internal error: dangerous error
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-sbrk.o): In function `_sbrk':
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-sbrk.c:28: undefined reference to `__appended_end'
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-sbrk.c:28: undefined reference to `__heap_limit'
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-sbrk.c:28: undefined reference to `__appended_start'

C:\Programming\GBA Projects\TileFrogger>c:\devkitadv\bin\objcopy -O binary Frogger.elf Frogger.gba
c:\devkitadv\bin\objcopy: Frogger.elf: No such file or directory

Tool completed with exit code 1


Any ideas? some changes I cant find out about anywhere?
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#12959 - tepples - Tue Dec 02, 2003 6:06 pm

MumblyJoe wrote:
Hey, i recently started using the latest devkitadv (used to use a version i cant remember) and now my make.bat file (yeah i know makefiles are better, gimme the source for one if you want) wont work anymore

I looked through your error messages. It appears that DevKit Advance R5's new support for appended data means that you have to use its crt0 and lnkscript. If you must use a modplayer that requires its own lnkscript, try merging its changes into a copy of DKA5's lnkscript.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#12965 - Quirky - Tue Dec 02, 2003 8:44 pm

There was a post on the AAS dev list with the same problem (and later a work around in this case - see http://groups.yahoo.com/group/aas-dev/message/47 )

James Daniels wrote:
The libraries that come with r5b3 expect a different lnkscript.Specifically, they need different names for the the memory addresses than were used in earlier versions of devkitadv. I'm not sure why they were changed in r5b3 as doing so just introduces incompatibilities between libraries written for different versions of devkitadv.

#12974 - jd - Tue Dec 02, 2003 10:35 pm

Quirky wrote:
There was a post on the AAS dev list with the same problem (and later a work around in this case - see http://groups.yahoo.com/group/aas-dev/message/47 )


I should point out that that work around was to allow non-r5b3 libraries to work with r5b3 - there's nothing specific to AAS about the problem or the solution.

However, judging from the make.bat above, the original poster isn't using any non-r5b3 libraries, so just using r5b3's lnkscript should fix the problem.

James Daniels wrote:
The libraries that come with r5b3 expect a different lnkscript. Specifically, they need different names for the the memory addresses than were used in earlier versions of devkitadv. I'm not sure why they were changed in r5b3 as doing so just introduces incompatibilities between libraries written for different versions of devkitadv.


I've since spoken to Jason Wilkins about this and apparently this incompatibility will be fixed in future versions of devkitadv. (After all, r5b3 is only a beta.)

By the way, if anyone knows how to make a library that will work with all versions of devkitadv in the mean time then please let me know.

#12980 - MumblyJoe - Tue Dec 02, 2003 11:13 pm

Thanks for the info, I will try playing around with my lnkscript. As a side note, I cant get into the yahoo group you listed, could you post any of the relevant info here or can someone get dirkownsyou@yahoo.com.au into the group (I have no idea how yahoo groups work, I only got the login just for this).


Edit:Never mind, I just managed to join the group, I hate yahoo.

Using the lnkscript they provide I get this error:

Code:
C:\Programming\GBA Projects\TileFrogger>as -o crt0.o crt0.s

C:\Programming\GBA Projects\TileFrogger>g++ -c -O3 -mthumb -mthumb-interwork -fno-rtti -fno-exceptions Frogger.cpp

C:\Programming\GBA Projects\TileFrogger>g++ -mthumb -mthumb-interwork -nostartfiles -T lnkscript -o Frogger.elf crt0.o crtbegin.o crtend.o Frogger.o
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\bin\ld.exe: crt0.o(_start): warning: interworking not enabled.
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\bin\ld.exe:   first occurrence: c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-exit.o): thumb call to arm
c:\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\thumb/interwork\libc.a(agb-exit.o): In function `_exit':
../../../../../../../../gcc-3.2.2/newlib/libc/sys/agb/agb-exit.c:5: internal error: dangerous error

C:\Programming\GBA Projects\TileFrogger>objcopy -O binary Frogger.elf Frogger.gba

Tool completed successfully


Any ideas?
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#12984 - jd - Tue Dec 02, 2003 11:56 pm

MumblyJoe wrote:

Using the lnkscript they provide I get this error:


From the .bat file you provided, it doesn't look like you need this lnkscript since you're not trying to use libraries from different versions of devkitadv. I'd recommend using r5b3's default crt0.s and lnkscript instead. I've never done this myself but I believe you can do this by changing this line:

Code:

c:\devkitadv\bin\g++ -mthumb -mthumb-interwork -nostartfiles -T lnkscript -o Frogger.elf crt0.o crtbegin.o crtend.o Frogger.o


To this:

Code:

c:\devkitadv\bin\g++ -mthumb -mthumb-interwork Frogger.elf Frogger.o


(You can also skip the bit that assembles crt0.s)

#12985 - MumblyJoe - Wed Dec 03, 2003 12:07 am

OK, the line you suggested I edit in my batch file works to a degree, I dont get the same errors :)

Now I get lots of errors about multiple definitions (impossible, I'm very stringent with inclusion guards).

Maybe I should finally get off my ass and write a damn makefile, although of course this wouldnt fix my problem it would keep me busy...

Anyone wanna post what they use to compile nowadays?
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#12986 - jd - Wed Dec 03, 2003 12:12 am

MumblyJoe wrote:
OK, the line you suggested I edit in my batch file works to a degree, I dont get the same errors :)

Now I get lots of errors about multiple definitions (impossible, I'm very stringent with inclusion guards).


If you're comfortable emailing me your project then I'll have a go at tracking down the problem for you. My address is: james.daniels@apex-designs.net

#12996 - evil saltine - Wed Dec 03, 2003 6:40 am

jd wrote:
To this:

Code:

c:\devkitadv\bin\g++ -mthumb -mthumb-interwork Frogger.elf Frogger.o


(You can also skip the bit that assembles crt0.s)


Er... wouldn't it be
Code:

c:\devkitadv\bin\g++ -mthumb -mthumb-interwork -o Frogger.elf Frogger.o


I was missing the -o before and it gave tons of multiple definition errors, so that may be MumblyJoe's problem.

#12997 - MumblyJoe - Wed Dec 03, 2003 7:19 am

Thanks everyone, the missing -o was the cause of the problem. I'm up and running again, I cant thank you all enough.
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!