Closed ericandrewlewis closed 3 years ago
Hey there!
Thank you for your interest in the project. Right now the project is officially Windows-only, since there are a few programs that can't (easily) be run on Mac or Linux, and some things I did in the makefile are windows-specific.
If you want to try anyway, you're more than welcome! (And I'm happy to help debug) However, this may be a lot of work, and a few of the tools the guide uses are Windows-only.
The errors you're seeing are a bit strange, as the files listed definitely exist in the repository:
One theory - this repository only works with a few versions of cc65. The guide uses 2.13.x, and newer versions changed some things that make this guide incompatible. (2.14 snapshots also work)
I'm guessing brew has a newer version available by default, and may not have the 2.13.x versions at all. If that's the case, you may have to compile manually. You might be able to steal the commands I used to build a linux cc65 docker image to build it on your mac. (Or, if you're a big docker fan, you could use the container directly)
Sorry this isn't really plug-and-play on other operating systems. I just made a change to the guide to make the warning more prominent.
If you want to keep pursuing this, we can continue debugging using this issue.
Thanks for looking! I may poke at this a bit, understanding that the project does not support non-Windows environments. Maybe these notes will be useful for the project, or someone else going down a similar path.
I hit a few include path issues along the way, which my previous comment included one of:
temp/base.asm(1): Error: Cannot open include file `tools/cc65_config/game_constants.asm': No such file or directory
These I fixed by editing the Makefile, and setting an --include-dir
for the project's root directory like so:
temp/%.s: %.c $(SOURCE_HEADERS)
- $(MAIN_COMPILER) -Oi $< --add-source --include-dir ./tools/cc65/include -o $(patsubst %.o, %.s, $@)
+ $(MAIN_COMPILER) -Oi $< --add-source --include-dir ./tools/cc65/include --include-dir ./ -o $(patsubst %.o, %.s, $@)
temp/%.s: %.c $(SOURCE_HEADERS)
- $(MAIN_COMPILER) -Oi $< --add-source --include-dir ./tools/cc65/include -o $(patsubst %.o, %.s, $@)
+ $(MAIN_COMPILER) -Oi $< --add-source --include-dir ./tools/cc65/include --include-dir ./ -o $(patsubst %.o, %.s, $@)
I then saw a lot of errors like these:
source/graphics/fade_animation.c(25): Error: Conflicting types for `fade_in'
This is because at least my version of cc65 expects a function definition that is void to include the void
keyword inside the parens like so:
void fade_in(void);
I guess if you leave them out C thinks that the method accepts any number of parameters, and somehow that doesn't jive with the actual implementations of these functions with no params.
I think this might be a good change for the repo, although if it's already working for others maybe not.
I think the Symbols definition in the repo may be cc65 2.13.x specific. You're right, brew installs cc65 v2.17. I ended up futzing with the syntax instead of running the dockerized version just yet.
SYMBOLS {
+ __STACKSIZE__: type = weak, value = $0500; # 5 pages stack
- __STACKSIZE__ = $0500; # 5 pages stack
-
# WARNING: If you change this next variable, you also need to update its sibling _contants.asm file, in the same
# folder. The value of SYS_PRG_BANKS must equal the value of NES_PRG_BANKS
- NES_PRG_BANKS = 8; # number of 16K PRG banks, change to 2 for NROM256
- NES_CHR_BANKS = 16; # number of 8K CHR banks (If using 4k, divide by 2!)
+ NES_PRG_BANKS: type = weak, value = 8; # number of 16K PRG banks, change to 2 for NROM256
+ NES_CHR_BANKS: type = weak, value = 16; # number of 8K CHR banks (If using 4k, divide by 2!)
}
Finally I can get to the ld65
step ... but for some reason the asm files end up with references to labels that don't exist... like these
Unresolved external `tossubax' referenced in:
temp/map_sprites.s(741)
temp/map_sprites.s(985)
temp/map.s(1506)
Unresolved external `zerobss' referenced in:
./source/neslib_asm/crt0.asm(205)
ld65: Error: 48 unresolved external(s) found - cannot create output file
make: *** [rom/starter.nes] Error 1
Thanks for the detail! Upgrading to a newer cc65 has been on my (very long) todo list for a while, and this helps!
On conflicting types, I agree that is a good change. I had thought I fixed most of those, but looks like a few managed to stick around. I'll try to find some time to chase those down! (PRs also welcome - will create a github issue.)
The include path and symbol notes will be helpful in the future, thanks!
The last one is a bit more mysterious - I think it likely boils down to compiler differences. I honestly am not 100% sure what zerobss is - I know it is imported by neslib, which is where most of crt0.asm came from. I don't see it in any files in my workspace that reference it. I don't have a ton of time to look into it right now but if you're really stuck, I may be able to look further a little later in the week.
Sorry if that's not super helpful, and thanks for the extra info!
First if you happen to see this, thank you for the PR! I hope it helped a bit.
This issue has been around a while with no movement, and I don't think I plan to fully support osx for now. If there is still interest, feel free to comment here and the discussion can continue, but for now I am going to close it.
This is my first time posting in this repository. Thanks for building this starter kit to make on-boarding to NES development easier!
I work on a mac and I'm attempting to build the project. Do you want to support the mac environment for this project, or want users to be in a Windows environment?
When I execute
make run
I getI can run the
rom/starter.nes
target directly though, but get an error:Since I've installed the cc65 toolchain with brew, I change the
MAIN_COMPILER
,MAIN_ASM_COMPILER
, andMAIN_LINKER
definitions in the Makefile to the path-available programs, likeMAIN_COMPILER=cc65
I then get an error