Compilation problems

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Piker
Posts: 2
Joined: Mon Feb 05, 2007 7:22 am

Compilation problems

Post by Piker »

When I try to compile and a file has a division, ej: int i = 300 / 100;
the linker shows an error of undefined reference to `__divdi3' function.

I'm using VLF library of Dark_Alex, if anyone know the solution, please reply.

Makefile

Code: Select all

TARGET = PSPasswordv2

OBJS = crt0.o main.o 



INCDIR = ../../include

CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division 

CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti

ASFLAGS = $(CFLAGS) -c



LIBDIR = ../../lib

LDFLAGS = -mno-crt0 -nostdlib -nodefaultlibs

LIBS = -lvlfgui -lvlfgu -lvlfutils -lvlflibc



PSP_FW_VERSION = 500



EXTRA_TARGETS = EBOOT.PBP

PSP_EBOOT_TITLE = PSPassword v2





BUILD_PRX = 1



PSPSDK=$(shell psp-config --pspsdk-path)

include ./build.mak
And here is the error:

Code: Select all

[...]
int i, percent, cpercent, total_percent = 0;

	char tmp = 0x0;	

	

	archivo.tamf = sceIoLseek(archivo.fd, 0, SEEK_END);

	

	sceIoLseek (archivo.fd, 0, SEEK_SET);

	

	percent = archivo.tamf/100;

	cpercent = 	(percent = archivo.tamf / 100);
[...]
Thanks.
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Well, you've told the compiler to eliminate any standard libraries and compiler support libraries (for any good reason?), but the compiler doesn't know - it clearly needs a support function called __divdi3 to help it do the divide instead of emitting instructions inline. Either you must supply it yourself, or set the linker up differently, or tell the compiler not to generate those calls, or don't do division.

Jim
Piker
Posts: 2
Joined: Mon Feb 05, 2007 7:22 am

Post by Piker »

The VLF library has its own libc library version(vlflibc) then you have to include that library and exclude the original one. The Makefile is a copy(90%) of the Makefile used to compile the example provided with the library. It seems to be OK.

I supose the VLF library doesn't include that function or library so it is a problem of the D_A library, but i don't know.

I tried to compile removing the LDFLAGS line too, but i only got more errors.

I'm blocked.


Thanks by the response.

Piker.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

__divdi3 is defined in libgcc.a
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Whoops! Wrong thread. :)
Post Reply