[SGDK] limit on the number of files?

Talk about development tools here

Moderator: BigEvilCorporation

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

[SGDK] limit on the number of files?

Post by djcouchycouch » Wed Jun 20, 2012 1:40 am

Hi,

I think I'm hitting some kind of file-related limit when trying to build with SGDK. Compiling about 80 files (.c and .h) is fine but adding any more pops up a dialog to debug a sh.exe crash. I don't know if it's the number of files the problem or simply the length of the command line.

It's happening during this line in makefile.gen:

Code: Select all

out/rom.out: out/sega.o $(OBJS) $(LIB)/libmd.a
	$(MKDIR) -p out
	$(CC) -T $(GDK)/md.ld -nostdlib out/sega.o $(OBJS) $(LIB)/libmd.a $(LIB)/libgcc.a -o out/rom.out
And I'm running this command line. Yes, it's long:

Code: Select all

C:/Dropbox/SegaGenesisDevelopment/sgdk091/bin/gcc -T C:/Dropbox/SegaGenesisDevelopment/sgdk091/md.ld -nostdlib out/sega.o out/resource.o out/AfterburnerChargeUp.o out/BreakableRock4x4.o out/Bullet.o out/Coin.o out/CoinSparkle.o out/Collisions.o out/Debug.o out/Door.o out/EnemyBullet.o out/EnemyPlane.o out/Explosion.o out/Fireball.o out/FireballPickup.o out/FunctionStubs.o out/Game.o out/GameFont.o out/GrassTileSetData.o out/HUD.o out/LargeExplosion.o out/Level.o out/Level001Section001.o out/Level001Section002.o out/Level001Section002Spawns.o out/Level001Section003.o out/LevelDefinitions.o out/MathUtils.o out/Objects.o out/Physics.o out/Player.o out/PlayerPhysics.o out/Poof.o out/SimpleEffect.o out/SpritesAndMaps.o out/VDP_Extra.o out/long128x64map.o out/main.o out/smallmap2.o out/smallmap_background.o out/smallmap_objects.o C:/Dropbox/SegaGenesisDevelopment/sgdk091/lib/libmd.a C:/Dropbox/SegaGenesisDevelopment/sgdk091/lib/libgcc.a -o out/rom.out
However, running the above command line manually outside of makefile.gen works. So could it be the makefile system?

I imagine if I consolidated the code into fewer files it'll work but it'll offend my one-file-per-object sensibilities :) And I might hit the limit again anyway.

Any idea how I can make this work?

Thanks!
DJCC

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Wed Jun 20, 2012 1:47 am

To me it sounds like you are running out of ram I have had issues similar to this closing all programs except the ide fixed it in my case try building your program and watch the ram usage in task manager.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Jun 20, 2012 1:59 am

Try putting the sdk in the drive root instead of a dozen directories deep and see if it's a line length problem.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Jun 20, 2012 8:39 am

Maybe this is related to the sh.exe shell which has strictly limited command line... Unfortunately i think the bundled version of sh.exe is not that outdated and a more recent version won't necessary fix the problem.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Wed Jun 20, 2012 2:02 pm

Chilly Willy wrote:Try putting the sdk in the drive root instead of a dozen directories deep and see if it's a line length problem.
I'll test that tonight. And it's only a half dozen directories deep :) It'll mitigate the problem but I might hit it again later.
sega16 wrote:To me it sounds like you are running out of ram I have had issues similar to this closing all programs except the ide fixed it in my case try building your program and watch the ram usage in task manager.
I checked and there wasn't anything out of the ordinary for ram usage.
Stef wrote:Maybe this is related to the sh.exe shell which has strictly limited command line... Unfortunately i think the bundled version of sh.exe is not that outdated and a more recent version won't necessary fix the problem.
I forget the name for it but I seem to remember gcc having a feature where instead of passing a list of files in the command line, you could put that list in a text file and have gcc load that instead, shortening the command line length. Did I imagine that?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Jun 20, 2012 5:32 pm

djcouchycouch wrote: I forget the name for it but I seem to remember gcc having a feature where instead of passing a list of files in the command line, you could put that list in a text file and have gcc load that instead, shortening the command line length. Did I imagine that?
Hmm that might help indeed but i can't find any reference to that option... i'm afraid you just dream it :-/
You could try different version of sh.exe file, with luck you may find a better than current one.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Wed Jun 20, 2012 5:43 pm

Found it. They're called response files.

http://gcc.gnu.org/wiki/Response_Files

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Jun 20, 2012 8:04 pm

Most of my tools work off such files :P
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Jun 20, 2012 8:09 pm

djcouchycouch wrote:Found it. They're called response files.

http://gcc.gnu.org/wiki/Response_Files
Never heard about that but i just added it in SGDK and it works perfectly ! Thanks =)

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Wed Jun 20, 2012 9:02 pm

Stef wrote:
djcouchycouch wrote:Found it. They're called response files.

http://gcc.gnu.org/wiki/Response_Files
Never heard about that but i just added it in SGDK and it works perfectly ! Thanks =)
Great! You're going to have to share your fix :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Thu Jun 21, 2012 7:58 am

djcouchycouch wrote:
Stef wrote:
djcouchycouch wrote:Found it. They're called response files.

http://gcc.gnu.org/wiki/Response_Files
Never heard about that but i just added it in SGDK and it works perfectly ! Thanks =)
Great! You're going to have to share your fix :)
Very simple, i use an intermediate build step to build the command file with "echo" command :) I will put the listening when I will be back to home (currently at job).

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Sat Jun 23, 2012 1:56 pm

Stef wrote:Very simple, i use an intermediate build step to build the command file with "echo" command :) I will put the listening when I will be back to home (currently at job).
Will you be posting it soon? Between your fix and something I'd come up with on my own, I'd prefer yours as it'll be the one released in the SGDK.

EDIT:

I convinced my lazy butt to actually look at the potential solution, and yeah, it was pretty simple. I switched the original code (as shown in my original post) to this:

Code: Select all

out/rom.out: out/sega.o $(OBJS) $(LIB)/libmd.a
	$(MKDIR) -p out
	@echo "$(OBJS)" > out/objects.txt
	$(CC) -T $(GDK)/md.ld -nostdlib out/sega.o @out/objects.txt $(LIB)/libmd.a $(LIB)/libgcc.a -o out/rom.out
Works like a charm.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Jun 23, 2012 2:42 pm

djcouchycouch wrote:
Stef wrote:Very simple, i use an intermediate build step to build the command file with "echo" command :) I will put the listening when I will be back to home (currently at job).
Will you be posting it soon? Between your fix and something I'd come up with on my own, I'd prefer yours as it'll be the one released in the SGDK.

EDIT:

I convinced my lazy butt to actually look at the potential solution, and yeah, it was pretty simple. I switched the original code (as shown in my original post) to this:

Code: Select all

out/rom.out: out/sega.o $(OBJS) $(LIB)/libmd.a
	$(MKDIR) -p out
	@echo "$(OBJS)" > out/objects.txt
	$(CC) -T $(GDK)/md.ld -nostdlib out/sega.o @out/objects.txt $(LIB)/libmd.a $(LIB)/libgcc.a -o out/rom.out
Works like a charm.
Err sorry i did know i was forgetting something :p

Here's what i used but the solution is similar :

Code: Select all

out/rom.out: out/cmd_
	$(CC) @out/cmd_
	$(RM) out/cmd_

out/cmd_: out/sega.o $(OBJS) $(LIB)/libmd.a
	$(ECHO) -n -T $(GDK)/md.ld -nostdlib out/sega.o $(OBJS) $(LIB)/libmd.a $(LIB)/libgcc.a -o out/rom.out > out/cmd_

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Jun 23, 2012 2:43 pm

i actually even prefer your version as only objs file take place ;)

Moon-Watcher
Very interested
Posts: 117
Joined: Sun Jan 02, 2011 9:14 pm
Contact:

Post by Moon-Watcher » Wed Oct 02, 2013 3:13 pm

I recently found this problem in my actual project in last SGDK</unuseful_reply> :P

- Edit:
Somebody move to the SGDK subforum, please

Post Reply