Beginner Setup

Post Reply
User avatar
Pavel5750cz
Posts: 12
Joined: Tue Feb 14, 2023 9:34 pm

Beginner Setup

Post by Pavel5750cz » Tue Dec 26, 2023 6:30 pm

Hello. I am trying to make devkit work. I got the environment variables and paths are working, tried to solve wioth gpt, sometimes build work and when neeed most they dont, if it builds dol, it works on wii only(not have Wii U and dolphin says ,,Failed to init core,,).

The Problem::
It cant find libogc, giving it the path via envis(Environment Variables) or telling it absolute path and if it manages to find em, it pastes error i pasted under this MakeFile(Also its my first post so i try best to describe helpfull stuff for better help):

Code: Select all

# Compiler
CXX = powerpc-eabi-g++

# Compiler flags
CXXFLAGS = -std=gnu++11 -Wall
CFLAGS   = -Wall

# Linker flags
LDFLAGS = -LC:\devkitPro\libogc\lib\wii -logc -lwiiuse -lbte -mogc

# Include paths
INCLUDES = -IC:\devkitPro\libogc\include

# Target executable
TARGET = boot.dol

# Source files
SRCS = Hlavnoste.cpp

# Object files
OBJS = $(SRCS:.cpp=.o)

# Rule to build the executable
$(TARGET): $(OBJS)
	$(CXX) $^ -o $@ $(LDFLAGS)

# Rule to build object files from source files
%.o: %.cpp
	$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@

# Rule to clean up the project
.PHONY: clean
clean:
	rm -f $(OBJS) $(TARGET)

Here is the messy error:

powerpc-eabi-g++ Hlavnoste.o -o boot.dol -LC:\devkitPro\libogc\lib\wii -logc -lwiiuse -lbte -mogc
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:\devkitPro\libogc\lib\wii\libogc.a(system.o): in function `SYS_SetArena2Lo':
/home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:1342:(.text.SYS_Init+0x15e): undefined reference to `__Arena2Lo'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:1342:(.text.SYS_Init+0x166): undefined reference to `__Arena2Lo'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:\devkitPro\libogc\lib\wii\libogc.a(system.o): in function `SYS_SetArena2Hi':
/home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:1363:(.text.SYS_Init+0x19a): undefined reference to `__Arena2Hi'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:1363:(.text.SYS_Init+0x1a2): undefined reference to `__Arena2Hi'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:\devkitPro\libogc\lib\wii\libogc.a(system.o): in function `__ipcbuffer_init':
/home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:526:(.text.SYS_Init+0x1be): undefined
reference to `__ipcbufferLo'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:527:(.text.SYS_Init+0x1c2): undefined reference to `__ipcbufferHi'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:526:(.text.SYS_Init+0x1c6): undefined reference to `__ipcbufferLo'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/libogc/src/libogc-2.4.1/libogc/system.c:527:(.text.SYS_Init+0x1ca): undefined reference to `__ipcbufferHi'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:25: boot.dol] Error 1


I have newest version, even reinstalled devkit, path are like here: edit: removed random youtube video.

Using Visual Studio Code and i hope i wrote this problem(first post here) understandably enough and I will be happy to try your answer that might help me and others who have the same problem.

The Problem(Again for better reading/solving experience)::
It cant find libogc, giving it the path via envis(Environment Variables) or telling it absolute path and if it manages to find em, it pastes error i pasted under this MakeFile.
® Pavel5750cz

DacoTaco
Posts: 16
Joined: Tue Sep 22, 2009 5:37 pm

Re: Beginner Setup

Post by DacoTaco » Wed Dec 27, 2023 10:28 am

Hi!

thanks for reaching out to use. thanks for being so detailed on the issue, and providing your makefile & error log.
From what you posted, your makefile seems to contain some issues. this is why we generally tell people to use our template Makefile to make it easier for them as it includes all the rules, dependency and library stuff that is needed to make an application. What i linked to, for example, is the Makefile template for wii development. gamecube and wiiu (not vwii) are a bit different.

anyway,
in your LDFLAGS, you are adding -mogc, in which you are telling it to compile for gamecube (this is what our gamecube_rules would add). this is probably the problem of all the linking errors, as the functions it is looking for are all wii functions (and you are adding the wii libogc too).

i'd either use our template for ease, and to prevent any future issues you might come across, or replace the -mogc with -mrvl, which tells the linker we are linking for wii instead of gamecube :)

Have fun!

User avatar
Pavel5750cz
Posts: 12
Joined: Tue Feb 14, 2023 9:34 pm

Re: Beginner Setup

Post by Pavel5750cz » Wed Dec 27, 2023 11:13 am

Thank you. I dont have much experience with Makefile as i have with Gradle on android so i blindly pasted your makefile and it errors too(i will post once i get on pc today). Then i pasted from gpt and sometimes it worked, and that working makefile not sure if i have but if i find and works, i paste it for you to ease your help to others. I know wildcard, -L -I and src. I have 1 cpp and wanna compile for more platforns at once, no idea to compile with no errors, will paste em when i can. Also i would like to make it work on dolphin too. If managed to do dol, dolphin says Failed to init core and when i pet others try it works on their. Well i will paste error when i get to pc
® Pavel5750cz

DacoTaco
Posts: 16
Joined: Tue Sep 22, 2009 5:37 pm

Re: Beginner Setup

Post by DacoTaco » Wed Dec 27, 2023 11:54 am

Pavel5750cz wrote: Wed Dec 27, 2023 11:13 am Thank you. I dont have much experience with Makefile as i have with Gradle on android so i blindly pasted your makefile and it errors too(i will post once i get on pc today). Then i pasted from gpt and sometimes it worked, and that working makefile not sure if i have but if i find and works, i paste it for you to ease your help to others. I know wildcard, -L -I and src. I have 1 cpp and wanna compile for more platforns at once, no idea to compile with no errors, will paste em when i can. Also i would like to make it work on dolphin too. If managed to do dol, dolphin says Failed to init core and when i pet others try it works on their. Well i will paste error when i get to pc
to me it sounds like we need to first work on getting the code compiled with the template makefile. the mix-match of gamecube & wii targetting is probably what is confusing dolphin i think.

but im looking forward in seeing the error log of compiling with the template makefile

User avatar
Pavel5750cz
Posts: 12
Joined: Tue Feb 14, 2023 9:34 pm

Re: Begginner Setup

Post by Pavel5750cz » Wed Dec 27, 2023 4:12 pm

When i get more experienced, i would like to also help others. Now here is error your makefile in template for wii gives from devkitpro/examples/template/wii.

(Some time later i got on pc and then i finish message):

Surprisingly it works but it gotta in specific folder i tried to just use the single cpp(not entire folder) which gave issues. I am ok now, later i try connect just one file, gona be in folder, when i get experienced then i edit maybe but I rately do this even with Gradle so maybe no. God knows.


Message for those whose Makefile from devkitPro is not working:
1. Check Envis(Environment Variables): DEVKITARM has /opt/devkitPro/devkitARM
DEVKITPPC has /opt/devkitPro/devkitPPC
DEVKITPRO has /opt/devkitPro
/opt/ is same as C: but it tells windows, its not part of system(found on a reddit post when googling because i was interested in diference also)

2. If you use ChatGPT to paste path, check :
A ) that devkitPro has big P in it(i had such experience)
B ) libogc path does not have portlibs because it does not exist anymore.
3. Correct libogc path is /devkitPro/libogc/include for -I(Big i not small L)and
/devkitPro/libogc/lib/(wii or cube) for -L

And set the /devkitPro/libogc/include path in Envis called Path and restart Windows after pressing OK. It allows you use gccore, wiiuse and lot in <> intead of "" and no need for absolute paths like <C:/somewhere/for/PPC.h>

Thank you for response. I hope answer did also some help to others. I will start makong my cross platform game to wii and then release. I will donate when i get coins but not small amount.
® Pavel5750cz

DacoTaco
Posts: 16
Joined: Tue Sep 22, 2009 5:37 pm

Re: Begginner Setup

Post by DacoTaco » Sun Dec 31, 2023 12:26 pm

Pavel5750cz wrote: Wed Dec 27, 2023 4:12 pm When i get more experienced, i would like to also help others. Now here is error your makefile in template for wii gives from devkitpro/examples/template/wii.

(Some time later i got on pc and then i finish message):

Surprisingly it works but it gotta in specific folder i tried to just use the single cpp(not entire folder) which gave issues. I am ok now, later i try connect just one file, gona be in folder, when i get experienced then i edit maybe but I rately do this even with Gradle so maybe no. God knows.


Message for those whose Makefile from devkitPro is not working:
1. Check Envis(Environment Variables): DEVKITARM has /opt/devkitPro/devkitARM
DEVKITPPC has /opt/devkitPro/devkitPPC
DEVKITPRO has /opt/devkitPro
/opt/ is same as C: but it tells windows, its not part of system(found on a reddit post when googling because i was interested in diference also)

2. If you use ChatGPT to paste path, check :
A ) that devkitPro has big P in it(i had such experience)
B ) libogc path does not have portlibs because it does not exist anymore.
3. Correct libogc path is /devkitPro/libogc/include for -I(Big i not small L)and
/devkitPro/libogc/lib/(wii or cube) for -L

And set the /devkitPro/libogc/include path in Envis called Path and restart Windows after pressing OK. It allows you use gccore, wiiuse and lot in <> intead of "" and no need for absolute paths like <C:/somewhere/for/PPC.h>

Thank you for response. I hope answer did also some help to others. I will start makong my cross platform game to wii and then release. I will donate when i get coins but not small amount.
Hey, any updates on your errorlog that you were going to post?
meanwhile Wintermute made an example of how you could build for multiple platforms using a single Makefile and/or cmake.
when you run make, it will build the gamecube version, and if you run make with the parameters PLATFORM=WII it will build the wii version

please use this template to make a first draft of your program to target the wii and gamecube
Attachments
dual_template.zip
(2.49 KiB) Downloaded 248 times

User avatar
Pavel5750cz
Posts: 12
Joined: Tue Feb 14, 2023 9:34 pm

Re: Beginner Setup

Post by Pavel5750cz » Sun Mar 24, 2024 10:57 am

After long time i am back here. previous makefile was minimal from chatGPT and now makefile that works looks like this from windows:

#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

include $(DEVKITPPC)/wii_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := zdroje
DATA := data
INCLUDES :=

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------

CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS)

LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lwiiuse -lbte -lmad -lasnd -logc -lm -lwiikeyboard -lfat

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS :=

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR := $(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif

export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)

export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) \
-I$(LIBOGC_INC)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
#export OUTPUT := $(CURDIR)/boot #for dolphin
export OUTPUT := F:\apps\Wiihra\boot #for wii


.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol

#---------------------------------------------------------------------------------
run:
wiiload $(TARGET).dol


#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

$(OFILES_SOURCES) : $(HFILES)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o %_jpg.h : %.jpg
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------








When i am now gonna work from linux after doing game for other platforms too, makefile may change and i am not sure if i post here. orry it took long time, i had limited pc and phone access and then i was workin and forgot. This makefile i use, may help other windows developers too. for linux and mac you may need configuration.

I may post linux makefile later.
® Pavel5750cz

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest