Missing standard symbols

support for the powerpc toolchain
Post Reply
litghost
Posts: 3
Joined: Fri Oct 24, 2008 8:05 pm

Missing standard symbols

Post by litghost » Fri Oct 24, 2008 8:12 pm

I was compiling a program for Wii and got the following missing symbols:

Code: Select all

i:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-gekko/4.2.3/../../../../powerpc-gekko/lib\libm.a(lib_a-sf_logarithm.o): In function `logarithmf':
(.text+0x34): undefined reference to `isfinitef'
i:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-gekko/4.2.3/../../../../powerpc-gekko/lib\libc.a(lib_a-clock.o): In function `clock':
(.text+0x18): undefined reference to `_times_r'
i:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-gekko/4.2.3/../../../../powerpc-gekko/lib\libc.a(lib_a-system.o): In function `_system_r':
(.text+0x44): undefined reference to `_fork_r'
i:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-gekko/4.2.3/../../../../powerpc-gekko/lib\libc.a(lib_a-system.o): In function `_system_r':
(.text+0x60): undefined reference to `_wait_r'
i:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-gekko/4.2.3/../../../../powerpc-gekko/lib\libc.a(lib_a-sysexecve.o): In function `execve':
(.text+0x28): undefined reference to `_execve_r'
The first is generated from the log set (i.e. log, log10, logf, etc) of functions. This should have worked.

The second is from clock. If clock is not supported in devKitPPC, then clock should be removed from libc.a so if you use it, the linker tells where the user used clock, not where clock used _times_r, which is useless.

The last three are from system. Like clock, if system is not support (and it probably should not be) then system should be removed from libc.a, same reason as above.

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Missing standard symbols

Post by WinterMute » Wed Oct 29, 2008 10:06 am

Could you supply a minimal project which exhibits these link errors. I'll look at fixing them for the next release.
Help keep devkitPro toolchains free, Donate today

Personal Blog

litghost
Posts: 3
Joined: Fri Oct 24, 2008 8:05 pm

Re: Missing standard symbols

Post by litghost » Sun Nov 09, 2008 8:40 am

Sorry for the delay, never got the notification of the reply.

On another note, it would be nice if you compiled libc and libm with -g so find stack trace symbols was easier. Also, gettimeofday does not seem to work.

Here is the .c file:

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>



int main ( int argc, char** argv )   // Create Main Function For Bringing It All Together
{
	float onethousand = 1000;
	
	time_t time1 = clock();

	// Should be 3!
	float ans = log10f(onethousand);
	
	time_t time2 = clock();
	
	// This is non-sense
	system("clr");

	return 0;
}
And here is the Makefile

Code: Select all

#---------------------------------------------------------------------------------
# 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		:=	./
DATA		:=	data  
INCLUDES	:=  ./

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

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

LDFLAGS	=	-g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:=	-lwiiuse -lbte -logc -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS	:= /i/setup/gl2gx/libogc/lib/wii

#---------------------------------------------------------------------------------
# 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	:=	$(addsuffix .o,$(BINFILES)) \
					$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
					$(sFILES:.s=.o) $(SFILES:.S=.o)

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

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)) \
					-L$(LIBOGC_LIB)

export OUTPUT	:=	$(CURDIR)/$(TARGET)
.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:
	psoload $(TARGET).dol

#---------------------------------------------------------------------------------
reload:
	psoload -r $(TARGET).dol


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

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

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

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

-include $(DEPENDS)

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

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Missing standard symbols

Post by WinterMute » Tue Dec 23, 2008 4:33 am

These link errors have been corrected in the latest release sets with the caveat that system() & clock() will return an error. Although it seems like a good idea to remove unsupported functions completely allowing code to link with these aids immensely in getting ports to compile in preparation for conversion to Wii/Gamecube.

clock() may be implemented in the future although the specification is quite low resolution making it not that useful on modern machines.

I still have to check on gettimeofday - just suffering a little from insufficient tuit accumulation :wink:
Help keep devkitPro toolchains free, Donate today

Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest