Author Topic: Undefined Symbol: __divsi3  (Read 5063 times)

telemetric_au

  • Sr. Member
  • ****
  • Posts: 327
    • View Profile
    • http://www.tyrannozaurus.com/feed/contribs/telemetric/index.htm
Undefined Symbol: __divsi3
« on: July 06, 2007, 04:20:10 am »
/usr/lib/libkgsha.so: undefined symbol: __divsi3
Can not Load Key Generators


i guess it trying to load/use theis module which is part of package i compile with new testing gcc-2.95.3 fpa native toolchain

i get the feeling from looking around it could be result of a few things...

if my path is set to default vfp toolchain i get:
Code: [Select]
# ldd /usr/lib/libkgsha.so
        libc.so.6 => /lib/libc.so.6 (0x40011000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
#

if my path is set to the new toolchain i get:

Code: [Select]
# ldd /usr/lib/libkgsha.so
        libc.so.6 => /lib/libc.so.6 (0x40011000)
        /opt/native/arm/2.95.3-armv4l-hardfpa//lib/ld-linux.so.2 => /opt/native/arm/2.95.3-armv4l-hardfpa//lib/ld-linux.so.2 (0x2aaaa000)
#

and if i add my new toolchain's /lib to the LD_LIBRARY_PATH i get :

Code: [Select]
# ldd /usr/lib/libkgsha.so
        libc.so.6 => /opt/native/arm/2.95.3-armv4l-hardfpa/lib/libc.so.6 (0x40012000)
        /opt/native/arm/2.95.3-armv4l-hardfpa//lib/ld-linux.so.2 => /opt/native/arm/2.95.3-armv4l-hardfpa//lib/ld-linux.so.2 (0x2aaaa000)
#

maybe it has some thing to so with the source code for the module ??

Code: [Select]
# *******************************************************************
# *     Copyright (c) 1994-2005 Jetico, Inc., Finland
# *     All rights reserved.
# *
# *     File:           Makefile
# *
# *     Description:    kgsha makefile
# *
# *     Scope:          SHA-1 key generator
# *
# *     Platforms:      Linux
# *
# *     Author:         Vitaliy Zolotarev
# *
# *     Revision:    $Id: Makefile,v 1.11 2007/02/08 06:48:34 nail Rel-1.6-13 $
# *
# *******************************************************************/                                                        #

LD = ld -d -shared

CPP=g++
#CPPFLAGS = -fPIC -Wall -Werror -fno-strength-reduce -I../include -g
CPPFLAGS = -fPIC -Wall -fno-strength-reduce -I../include -O2
CPPFLAGS += $(EXTRA_CXXFLAFS)

TARGET = libkgsha.so
HEADERS = kg_defs.h kgsha.h kblock.h sha1.h random.h

OBJ = alg.o kblock.o kg_misc.o kgsha.o pwldlg.o sha1.o random.o

all: $(TARGET)

%.o: %.cpp
    $(CPP) $(CPPFLAGS) -c -o $@ $<

$(TARGET):    $(OBJ)
  $(LD) $(OBJ) -soname $(TARGET) -o $(TARGET) -lc
  cp -f $(TARGET) ../lib
#  cp -f $(HEADERS) ../include
clean:
    rm -f *.o *.ver *~ $(TARGET)


for example i found this on a site out there:

Quote
AsIDE will now automatically create an Intel-HEX format file after every build.
I'm getting getting a linker error undefined reference to `__divsi3' when I build my application. Why?
You need to link in the library libgcc.a. Within AsIDE:
1. Select Project|Project Properties|Tools
2. Select Link in the Tool name list
3. Click the Options... button
4. Add the following line to Libraries/Objects:

-L %(GCC_EXEC_PREFIX)\arm-elf\3.3.1 -lc -lgcc

Where -lgcc is shorthand for libgcc.a. AsIDE will now automatically link in libgcc.a after every build.

maybe something similiar could help... ?
« Last Edit: July 06, 2007, 08:42:31 am by telemetric_au »
Collie w/ pdaxrom & Puppy OS w/ cross-sdk
Hawking HCF686TX 10/100, Ambicom 802.11b (WL1100C-CF), Xircom 56K Global CF
Kingston CF Elite Pro & SD 1Gb & 128mb for flashing
$2 screen protector, collie.pdaxrom.feed : my collie pdaxrom site

telemetric_au

  • Sr. Member
  • ****
  • Posts: 327
    • View Profile
    • http://www.tyrannozaurus.com/feed/contribs/telemetric/index.htm
Undefined Symbol: __divsi3
« Reply #1 on: July 06, 2007, 08:20:42 am »
(i think its an old gcc thing)

yep, just add the following to the end of the linker command ( $(LD) $(OBJ) -soname $(TARGET) -o $(TARGET) -lc) in the Makefile for the .o file::


 -L/opt/native/arm/2.95.3-armv4l-hardfpa/lib/gcc-lib/armv4l-unknown-linux-gnu/2.95.3/ -lgcc


ie path to libgcc.a which defines __divsi3 among other goodies
« Last Edit: July 06, 2007, 08:24:52 am by telemetric_au »
Collie w/ pdaxrom & Puppy OS w/ cross-sdk
Hawking HCF686TX 10/100, Ambicom 802.11b (WL1100C-CF), Xircom 56K Global CF
Kingston CF Elite Pro & SD 1Gb & 128mb for flashing
$2 screen protector, collie.pdaxrom.feed : my collie pdaxrom site