pereraa / iphone-dev

Automatically exported from code.google.com/p/iphone-dev
0 stars 0 forks source link

odcctools build failing - undefined symbols compling otool #128

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

    * Check out a copy of LLVM SVN, and build a release build (as opposed
to a debug one). Currently, due to Issue 70, we are limited to revision 42498.

      $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm-svn -r 42498
      $ pushd llvm-svn
      $ ./configure --enable-optimized
      $ make ENABLE_OPTIMIZED=1
      $ sudo make install
      $ LLVMOBJDIR=`pwd`
      $ popd

    * Check out a copy of the iphone-dev SVN repository.

      $ svn checkout http://iphone-dev.googlecode.com/svn/trunk/ iphone-dev
      $ pushd iphone-dev

    * Make a directory to hold the toolchain.

      $ sudo mkdir /usr/local/arm-apple-darwin

    * Build odcctools.

      $ mkdir -p build/odcctools
      $ pushd build/odcctools
      $ ../../odcctools/configure --target=arm-apple-darwin --disable-ld64
      $ make

What is the expected output? What do you see instead?

Successful compilation.

What version of the product are you using? On what operating system?

OS X 10.5.2

Please provide any additional information below.

gcc -x objective-c -Wall -Wno-long-double -Wno-import  -DHAVE_CONFIG_H   
-I. -I../../../odcctools/otool -I..//include -I../../../odcctools/include
-isysroot /Developer/SDKs/MacOSX10.4u.sdk  -g -O2 -fno-builtin-round
-fno-builtin-trunc -no-cpp-precomp -mdynamic-no-pic  -c -o print_objc.o
../../../odcctools/otool/print_objc.c
../../../odcctools/otool/print_objc.c: In function ‘print_protocol_list’:
../../../odcctools/otool/print_objc.c:1496: warning: format ‘%ld’ expects
type ‘long int’, but argument 2 has type ‘int’
gcc -DOTOOL -Wall -Wno-long-double -Wno-import  -DHAVE_CONFIG_H    -I.
-I../../../odcctools/otool -I..//include -I../../../odcctools/include
-isysroot /Developer/SDKs/MacOSX10.4u.sdk  -g -O2 -fno-builtin-round
-fno-builtin-trunc -no-cpp-precomp -mdynamic-no-pic  -c -o ofile.o
../../../odcctools/libstuff/ofile.c
gcc -o otool main.o ofile_print.o m68k_disasm.o i860_disasm.o m88k_disasm.o
i386_disasm.o ppc_disasm.o hppa_disasm.o sparc_disasm.o arm_disasm.o
print_objc.o ofile.o -multiply_defined suppress -L..//libstuff  -lstuff
Undefined symbols:
  "_print_objc_string_object_section_64", referenced from:
      _processor in main.o
  "_print_objc2", referenced from:
      _processor in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [otool] Error 1
make: *** [otool] Error 2

Original issue reported on code.google.com by s.p.b...@gmail.com on 7 Apr 2008 at 6:34

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I encountered the exactly same problem, Any ideas is appreciated.

Original comment by frank.go...@gmail.com on 9 Apr 2008 at 7:07

GoogleCodeExporter commented 8 years ago
I make it works now.
My solution is as following:
go to odcctools/otool,open 'Makefile', add print_objc2.c to compiling 
dependency similar as print_objc.c.

Original comment by frank.go...@gmail.com on 9 Apr 2008 at 9:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
thanks for the tip frank, but it didn't quite work for me. more or less i did 
what
you suggested, but a bit more extended: i modified
iphone-dev/odcctools/otool/arm/Makefile as you said, also i had to delete 
everthing
in iphone-dev/build/odcctools, then edit iphone-dev/odcctools/Makefile.in until 
it
looked like below then do configure + make again. 

thanks and regards,
sebastian mecklenburg

builddir = @builddir@
top_builddir = @top_builddir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

prefix      = @prefix@
exec_prefix = @exec_prefix@
bindir      = @bindir@

VPATH = @srcdir@

CC              = @CC@
CFLAGS          = @CFLAGS@
WARNINGS    = @WARNINGS@
MDYNAMICNOPIC   = @MDYNAMICNOPIC@
CPPFLAGS        = @CPPFLAGS@
DEFS            = @DEFS@ @ENDIAN_FLAG@
LDFLAGS         = @LDFLAGS@
OBJC        = @OBJC@
HAVE_PRIVEXT    = @HAVE_PRIVEXT@
HAVE_FOREIGN_HEADERS    = @HAVE_FOREIGN_HEADERS@

ifeq ($(HAVE_PRIVEXT),NO)
INCPRIVEXT      = -include $(top_srcdir)/include/extern.h
endif

ifeq ($(HAVE_FOREIGN_HEADERS),YES)
FORHDRS         = -I$(top_srcdir)/include/foreign
endif

INSTALL     = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
transform       = @program_transform_name@

MYINCLUDES      = -I$(builddir) -I$(srcdir) -I$(top_builddir)/include \
            -I$(top_srcdir)/include $(INCPRIVEXT) $(FORHDRS)
MYWARNINGS      = 
MYDEFS          = 
MYLDFLAGS   = -L$(top_builddir)/libstuff
MYLIBS      =

MYCOMPILEFLAGS  = $(WARNINGS) $(MYWARNINGS) $(DEFS) $(MYDEFS) \
    $(CPPFLAGS) $(MYINCLUDES) $(CFLAGS) $(MDYNAMICNOPIC) 

MYLINKFLAGS = $(LDFLAGS) $(MYLDFLAGS) $(MYLIBS)

CFILES = main.c ofile_print.c m68k_disasm.c i860_disasm.c \
         m88k_disasm.c i386_disasm.c ppc_disasm.c hppa_disasm.c \
         sparc_disasm.c arm_disasm.c
CFILES_extra = print_objc.c print_objc2.c ofile.c

OBJS = $(CFILES:.c=.o) 
OBJS64 = $(CFILES:.c=.64o) 

.PHONY: default clean distclean install

default: otool otool64

$(OBJS): %.o: %.c
    $(CC) $(MYCOMPILEFLAGS) -c -o $@ $<

$(OBJS64): %.64o: %.c
    $(CC) $(MYCOMPILEFLAGS) -DARCH64 -c -o $@ $<

otool: $(OBJS) print_objc.o print_objc2.o ofile.o
    $(CC) -o $@ $^ $(MYLINKFLAGS) -lstuff

otool64: $(OBJS64) print_objc.64o print_objc2.64o ofile.64o
    $(CC) -o $@ $^ $(MYLINKFLAGS) -lstuff64

ofile.o: $(top_srcdir)/libstuff/ofile.c
    $(CC) -DOTOOL $(MYCOMPILEFLAGS) -c -o $@ $<
ofile.64o: $(top_srcdir)/libstuff/ofile.c
    $(CC) -DOTOOL $(MYCOMPILEFLAGS) -DARCH64 -c -o $@ $<

print_objc.o: print_objc.c
    $(CC) $(OBJC) $(MYCOMPILEFLAGS) -c -o $@ $<
print_objc.64o: print_objc.c
    $(CC) $(OBJC) $(MYCOMPILEFLAGS) -DARCH64 -c -o $@ $<

print_objc2.o: print_objc2.c
    $(CC) $(OBJC) $(MYCOMPILEFLAGS) -c -o $@ $<
print_objc2.64o: print_objc2.c
    $(CC) $(OBJC) $(MYCOMPILEFLAGS) -DARCH64 -c -o $@ $<

install: otool otool64
    mkdir -p $(DESTDIR)/$(bindir)
    $(INSTALL_PROGRAM) otool \
        $(DESTDIR)/$(bindir)/`echo otool | sed '$(transform)'`
    $(INSTALL_PROGRAM) otool64 \
        $(DESTDIR)/$(bindir)/`echo otool64 | sed '$(transform)'`

clean:
    rm -r -f *.o *.64o
    rm -f otool otool64

Original comment by s...@happyhappyboy.de on 19 Apr 2008 at 1:17

GoogleCodeExporter commented 8 years ago
I was also able to solve the issue by clearing out build/odcctools and replacing
iphone-dev/odcctools/Makefile.in with the above Makefile.in.  Then configured 
and
make again and it worked.  Many thanks.

Original comment by gordon.c...@gmail.com on 22 Jul 2008 at 6:03