PVSnesLib - impossible to make (solved)

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
gaaaaast
Posts: 3
Joined: Fri Feb 12, 2021 1:02 pm

PVSnesLib - impossible to make (solved)

Post by gaaaaast »

Hello guys,
I have a quick question for PVSNesLib
I'm following the wiki to install it, but with Programmer's notepad, I cannot compile.
Clean is working perfectly, but not make:

Code: Select all

> "make" 
...
Doing obj files ...
Building: wla-65816 -s -o hdr.obj hdr.asm
/usr/bin/ls: cannot access 'c:\\c\snesdev\pvsneslib\lib': No such file or directory
Creating linkfile ...
Linking ... template.sfc
wlalink -d -D -s -v -L /c/snesdev/pvsneslib/lib linkfile template.sfc
DISCARD: template.obj: template.asm: Section ".text_0x0" was discarded.
DISCARD: template.obj: template.asm: Section "ram.data" was discarded.
DISCARD: template.obj: template.asm: Section ".data" was discarded.
DISCARD: template.obj: template.asm: Section ".rodata" was discarded.
DISCARD: template.obj: template.asm: Section ".bss" was discarded.
template.obj: hdr.asm:33: FIX_REFERENCES: Reference to an unknown label "EmptyHandler".
"make": *** [template.sfc] Error 1
rm template.asm template.ps data.obj hdr.obj template.obj

> Process Exit Code: 2
> Time Taken: 00:01
Is there anybody to help?
Last edited by gaaaaast on Sat Feb 13, 2021 1:41 pm, edited 1 time in total.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: PVSnesLib - impossible to make

Post by dougeff »

It looks like it couldn't find "EmptyHandler" which is referenced by the unused vectors in the header file (hdr.asm). And the label itself is in crt0_snes.asm and just as an RTI below it.

Make sure you included crt0_snes.asm and that the label EmptyHandler exists there.

Oh, it's probably because it couldn't find the object folder called "lib" which would have held the crt0_snes.obj file.
nesdoug.com -- blog/tutorial on programming for the NES
gaaaaast
Posts: 3
Joined: Fri Feb 12, 2021 1:02 pm

Re: PVSnesLib - impossible to make

Post by gaaaaast »

thanks for the reply.

I agree, this line is so weird to me

Code: Select all

cannot access 'c:\\c\snesdev\pvsneslib\lib':
but I don't know how to fix that
I'm looking into different files (Makefile, snes_rules, crt0_snes.asm...), but for now, nothing popped...

I'm totally newbie to this world, pretty difficult to understand where to check actually ^^
gaaaaast
Posts: 3
Joined: Fri Feb 12, 2021 1:02 pm

Re: PVSnesLib - impossible to make

Post by gaaaaast »

ok, I finally changed the line 14 in snes_rules by

Code: Select all

REPDIROBJSW1 := $$(echo "$(REPDIROBJSW)" | cut -c 3-64)
it's completely disgusting fix, but it's working for now :)

and thanks @dougeff for the insight ;)
lillapojkenpåön
Posts: 30
Joined: Sat Jul 04, 2020 5:27 pm

Re: PVSnesLib - impossible to make (solved)

Post by lillapojkenpåön »

I have a similar problem, what should I do?

Code: Select all

The debug mode is NOT enabled, you can do it by executing "export PVSNESLIB_DEBUG=1"
ls: cannot access 'C::\snesdev\pvsneslib\lib': No such file or directory
Creating linkfile ...
Linking ... hello_world.sfc
C:/snesdev/devkitsnes/bin/wlalink -d -s -v -A -c -L C:/snesdev/pvsneslib/lib linkfile hello_world.sfc
DISCARD: data.obj: data.asm: Section ".rodata1" was discarded.
DISCARD: src/hello_world.obj: src/hello_world.asm: Section ".maintext_0x0" was discarded.
DISCARD: src/hello_world.obj: src/hello_world.asm: Section ".rodata" was discarded.      
data.obj: hdr.asm:33: FIX_REFERENCES: Reference to an unknown label "EmptyHandler".      
make: *** [C:/snesdev/devkitsnes/snes_rules:118: hello_world.sfc] Error 1
User avatar
segaloco
Posts: 278
Joined: Fri Aug 25, 2023 11:56 am
Contact:

Re: PVSnesLib - impossible to make (solved)

Post by segaloco »

Not to encourage bumping a two year old thread...dunno what sentiments on that are around here, but that looks like a collision on path formats between a Windows environment and a UNIX shell. Got a copy of the Makefile you're running handy? If you post that (or PM, however) I can see if anything looks amiss.

Looks like they provide Docker images too. If you have the time, I'd recommend getting familiar with setting up the Docker image, because that'll be a much more tightly controlled environment. You'll have a lot less guesswork regarding whether a given Makefile, script, etc. will work right and even better, you could then pull it into a Docker compose file and create a nice little "network" of machines, one to be your build server, one to be your development box, VSCode (as they suggest using) has excellent support for containerized development environments like this.

Finally, these days, if you are going for a UNIX-like environment on Windows, give WSL(2) a spin, I've found that when you really want stuff to run like it's on a UNIX-like, WSL is oodles better than stuff like MinGW and Cygwin.
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: PVSnesLib - impossible to make (solved)

Post by Fiskbit »

Bumping threads here is perfectly fine if you're contributing meaningful new information or asking a meaningful question that is related to the discussion, so this post looks fine to me. It can be useful to keep a lot of related material in the same thread. (Just please don't bump old threads for trivial reasons, because it makes people have to reread the old posts, and sometimes people reply to the old posts thinking they are new.)
lillapojkenpåön
Posts: 30
Joined: Sat Jul 04, 2020 5:27 pm

Re: PVSnesLib - impossible to make (solved)

Post by lillapojkenpåön »

segaloco wrote: Wed Oct 11, 2023 6:29 pm that looks like a collision on path formats between a Windows environment and a UNIX shell. Got a copy of the Makefile you're running handy?

Code: Select all

ifeq ($(strip $(PVSNESLIB_HOME)),)
$(error "Please create an environment variable PVSNESLIB_HOME with path to its folder and restart application. (you can do it on windows with <setx PVSNESLIB_HOME "/c/snesdev">)")
endif

include ${PVSNESLIB_HOME}/devkitsnes/snes_rules

.PHONY: bitmaps all

#---------------------------------------------------------------------------------
# ROMNAME is used in snes_rules file
export ROMNAME := hello_world

all: bitmaps $(ROMNAME).sfc

clean: cleanBuildRes cleanRom cleanGfx
	
#---------------------------------------------------------------------------------
pvsneslibfont.pic: pvsneslibfont.png
	@echo convert font with no tile reduction ... $(notdir $@)
	$(GFXCONV) -n -gs8 -po16 -pc16 -pe0 -mR! -m! -fpng $<

bitmaps : pvsneslibfont.pic
and snes_rules

Code: Select all

# folder containing sources :
SRC := src

LIBDIRSOBJS := $(PVSNESLIB_HOME)/pvsneslib/lib

# to avoid some bugs if the PVSNESLIB_HOME is not well defined, we let a small check here
ifeq ($(findstring \,$(PVSNESLIB_HOME)),\)
$(error "PVSNESLIB_HOME environment variable is not defined correctly: the path must be in Unix style (on Windows operating system too!). For example, use /c/snesdev instead of c:\snesdev")
endif

ifeq ($(PVSNESLIB_DEBUG),1)
DEBUG = 1
$(info The debug mode is enabled)
else
DEBUG = 0
$(info The debug mode is NOT enabled, you can do it by executing "export PVSNESLIB_DEBUG=1")
endif

#---------------------------------------------------------------------------------
# on windows, linkfile can only manage path like E:\pvsneslib\lib\crt0_snes.obj
# this one doesn't work /e/pvsneslib/lib/crt0_snes.obj
#---------------------------------------------------------------------------------
ifeq ($(OS),Windows_NT)
DRIDIROBJW   := $(wordlist 1,1,$(subst /, ,${LIBDIRSOBJS}))
REPDIROBJSW  := $(subst /,\\,${LIBDIRSOBJS})
REPDIROBJSW1 := $$(echo "$(REPDIROBJSW)" | sed 's/^.\{3\}//')
LIBDIRSOBJSW := ${DRIDIROBJW}:\\${REPDIROBJSW1}
else
LIBDIRSOBJSW := ${LIBDIRSOBJS}
endif

#---------------------------------------------------------------------------------
# the compiler executables
#---------------------------------------------------------------------------------

export CC	:=	$(PVSNESLIB_HOME)/devkitsnes/bin/816-tcc
export AS	:=	$(PVSNESLIB_HOME)/devkitsnes/bin/wla-65816
export LD	:=	$(PVSNESLIB_HOME)/devkitsnes/bin/wlalink

export GFXCONV	:=	$(PVSNESLIB_HOME)/devkitsnes/tools/gfx2snes
export SMCONV	:=	$(PVSNESLIB_HOME)/devkitsnes/tools/smconv
export BRCONV	:=	$(PVSNESLIB_HOME)/devkitsnes/tools/snesbrr
export TXCONV	:=	$(PVSNESLIB_HOME)/devkitsnes/tools/bin2txt
export SNTOOLS	:=	$(PVSNESLIB_HOME)/devkitsnes/tools/snestools
export TMXCONV	:=	$(PVSNESLIB_HOME)/devkitsnes/tools/tmx2snes
export OPT		:=	$(PVSNESLIB_HOME)/devkitsnes/tools/816-opt
export CTF		:=	$(PVSNESLIB_HOME)/devkitsnes/tools/constify

#---------------------------------------------------------------------------------
# Add default flag for compiling
#---------------------------------------------------------------------------------
CFLAGS += -I$(PVSNESLIB_HOME)/pvsneslib/include -I$(PVSNESLIB_HOME)/devkitsnes/include -I$(CURDIR)


SFILES=
# if we found any .it file, we will need to build soundbank.asm first (generated by smconv tool)
# (strip function remove leading and trailing whitespaces to avoid issues...)
ifneq ($(strip $(AUDIOFILES)),)
	SFILES := $(SOUNDBANK).asm
endif

#---------------------------------------------------------------------------------
# Search all .asm and .c files until 3rd level in the tree
#---------------------------------------------------------------------------------
CFILES = $(wildcard *.c)
CFILES+= $(wildcard $(SRC)/*.c)
CFILES+= $(wildcard $(SRC)/*/*.c)
CFILES+= $(wildcard $(SRC)/*/*/*.c)

SFILES := $(SFILES) $(wildcard *.asm)
SFILES := $(SFILES) $(wildcard $(SRC)/*.asm)
SFILES := $(SFILES) $(wildcard $(SRC)/*/*.asm)
SFILES := $(SFILES) $(wildcard $(SRC)/*/*/*.asm)

export OFILES	:=	$(BINFILES:.bin=.obj) $(CFILES:.c=.obj) $(SFILES:.asm=.obj)

# The first rule available in makefile become the default one
# We want "all" as default rule, but we will declare it later !
.DEFAULT_GOAL := all

#---------------------------------------------------------------------------------
%.ps: %.c
	@echo Compiling to .ps ... $(notdir $<)
	$(CC) $(CFLAGS) -Wall -c $< -o $@
ifeq ($(DEBUG),1)
	cp $@ $@.01.dbg
endif

#---------------------------------------------------------------------------------
%.asm: %.ps
	@echo Assembling ... $(notdir $<)
	$(OPT) $< >$*.asp
ifeq ($(DEBUG),1)
	cp $*.asp $*.opt.02.dbg
endif
	@echo Moving constants ... $(notdir $<)
	$(CTF) $*.c $*.asp $@
ifeq ($(DEBUG),1)
	cp $*.asp $*.ctf.03.dbg
endif
	@rm $*.asp

%.obj: %.asm
	@echo Doing obj files ... $(fname)
	@echo "Building with -x flag: $(AS) -s -x -o $@ $<"
# -d switch disable WLA's ability to calculate A-B where A and B are labels.
# if you remove it, you will have some updates to do at least in crt0_snes.asm
	$(AS) -d -s -x -o $@ $<

#---------------------------------------------------------------------------------
%.sfc: $(OFILES)
	@echo Creating linkfile ...
	@echo [objects] > linkfile
	@for i in $(OFILES); do \
		echo $$i >> linkfile; \
	done

	@for i in $(shell ls $(LIBDIRSOBJSW)); do \
		echo $(LIBDIRSOBJSW)/$$i >> linkfile; \
	done

	@echo Linking ... $(notdir $@)
	@rm -f $(ROMNAME).sym
# -c should be removed ASAP ! It allow duplicate labels and definitions
	$(LD) -d -s -v -A -c -L ${LIBDIRSOBJS} linkfile $@

	@sed -i 's/://' $(ROMNAME).sym

	@echo
	@echo Build finished successfully !
	@echo

#---------------------------------------------------------------------------------
%.pic: %.bmp
	@echo convert bitmap ... $(notdir $<)
	$(GFXCONV) -pr -pc16 -n -gs8 -pe0 -fbmp -m $<

#---------------------------------------------------------------------------------
%.brr: %.wav
	@echo convert wav file ... $(notdir $<)
	$(BRCONV) -e $< $@

$(SOUNDBANK).asm : $(AUDIOFILES)
	@echo Compiling Soundbank ...
	$(SMCONV) $(SMCONVFLAGS) $^

.PHONY: cleanBuildRes cleanRom cleanGfx cleanAudio

cleanBuildRes: cleanDebug
	@echo clean build resources
	@rm -f $(OFILES) linkfile

cleanRom:
	@echo clean rom
	@rm -f $(ROMNAME).sfc $(ROMNAME).sym

cleanGfx:
	@echo clean graphics data
	@rm -f *.pic *.map *.pal *.pc7 *.mp7 *.til *.m16 *.b16 *.o16 *.t16

cleanAudio:
	@echo clean audio data
	@rm -f $(SOUNDBANK).asm $(SOUNDBANK).h $(SOUNDBANK).bnk

cleanDebug:
ifeq ($(DEBUG),1)
	@echo clean debug files
	@find . -type f -name "*.dbg" -delete
endif
segaloco wrote: Wed Oct 11, 2023 6:29 pm Finally, these days, if you are going for a UNIX-like environment on Windows, give WSL(2) a spin, I've found that when you really want stuff to run like it's on a UNIX-like, WSL is oodles better than stuff like MinGW and Cygwin.
I'll keep that in mind, but I'm not trying to do anything other than follow the instructions on github :lol:
User avatar
segaloco
Posts: 278
Joined: Fri Aug 25, 2023 11:56 am
Contact:

Re: PVSnesLib - impossible to make (solved)

Post by segaloco »

Fiskbit wrote: Wed Oct 11, 2023 6:57 pm Bumping threads here is perfectly fine if you're contributing meaningful new information or asking a meaningful question that is related to the discussion, so this post looks fine to me.
A-OK, just wanted to be sure.

@OP: PVSNESLIB_HOME probably needs to be defined differently, that's what your paths are being concatenated from. What does "echo $PVSNESLIB_HOME" yield in the CLI you run make from?
lillapojkenpåön
Posts: 30
Joined: Sat Jul 04, 2020 5:27 pm

Re: PVSnesLib - impossible to make (solved)

Post by lillapojkenpåön »

segaloco wrote: Thu Oct 12, 2023 10:19 am What does "echo $PVSNESLIB_HOME" yield in the CLI you run make from?
C:/snesdev
User avatar
segaloco
Posts: 278
Joined: Fri Aug 25, 2023 11:56 am
Contact:

Re: PVSnesLib - impossible to make (solved)

Post by segaloco »

Open the shell you land in for the build environment and issue "pwd" to print the working (current) directory. It may look something like /c/Users/... or maybe something else. Either way, this'll give you a clue as to the pathing your shell might be looking for.
lillapojkenpåön
Posts: 30
Joined: Sat Jul 04, 2020 5:27 pm

Re: PVSnesLib - impossible to make (solved)

Post by lillapojkenpåön »

segaloco wrote: Thu Oct 12, 2023 7:24 pm this'll give you a clue as to the pathing your shell might be looking for.
/home/J
What do I do with that clue?
User avatar
segaloco
Posts: 278
Joined: Fri Aug 25, 2023 11:56 am
Contact:

Re: PVSnesLib - impossible to make (solved)

Post by segaloco »

Windows uses paths in the form of <Letter>:\<route0>\<route1>\<route2>

UNIX uses paths in the form of /<route0>/<route1>/<route2>

I won't be guiding you to the answer you seek this time though, this is the part where your critical thinking comes in. The skills you'll learn in the process now that I've lead you to the important variables in the problem will serve you for a lifetime.

Edit: Windows is backslash path separators...not forward, whoops. Good old Microsoft...
lillapojkenpåön
Posts: 30
Joined: Sat Jul 04, 2020 5:27 pm

Re: PVSnesLib - impossible to make (solved)

Post by lillapojkenpåön »

Well, I've allready tried changing the environment variables between back and forward slash, I never tried complete UNIX style though, will try, otherwise I'll learn docker
creaothceann
Posts: 611
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: PVSnesLib - impossible to make (solved)

Post by creaothceann »

segaloco wrote: Fri Oct 13, 2023 4:36 pm Edit: Windows is backslash path separators
Modern Windows accepts both, afaik.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
Post Reply