0

I built an iPhone toolchain on Ubuntu based on the directions at http://www.saurik.com/id/4 . When I try to compile something as simple as:

int main () {
    return 4;
}

It gives me this:

Undefined symbols:
  "_main", referenced from:
      _main$non_lazy_ptr in crt1.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

This happens for both the crt1.o from the iPhone SDK and from the http://code.google.com/p/iphone-dev/wiki/Building . Using -save-temps, I found out that the cc1 command produced no output. Why is that? Is there something wrong with my specs file?

Using built-in specs.
Target: arm-apple-darwin10
Configured with: ../llvm-gcc-4.2-2.8.source/configure --target=arm-apple-darwin10 --prefix=/home/kevin/it --with-sysroot=/home/kevin/is --enable-languages=c,c++,objc,obj-c++ --with-as=/home/kevin/it/bin/arm-apple-darwin10-as --with-ld=/home/kevin/it/bin/arm-apple-darwin10-ld --enable-wchar_t=no --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658)
 /home/kevin/it/libexec/gcc/arm-apple-darwin10/4.2.1/cc1 -quiet -v -D__DYNAMIC__ test.c -miphoneos-version-min=3.0 -fPIC -fno-builtin-strcat -fno-builtin-strcpy -quiet -dumpbase test.c -auxbase test -version -o /tmp/ccyVHwhV.s
ignoring nonexistent directory "/home/kevin/is/usr/local/include"
ignoring nonexistent directory "/home/kevin/is/home/kevin/it/lib/gcc/arm-apple-darwin10/4.2.1/../../../../arm-apple-darwin10/include"
ignoring nonexistent directory "/home/kevin/is/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /home/kevin/it/lib/gcc/arm-apple-darwin10/4.2.1/include
 /home/kevin/is/usr/include
 /home/kevin/is/System/Library/Frameworks (framework directory)
End of search list.
GNU C version 4.2.1 (Based on Apple Inc. build 5658) (arm-apple-darwin10)
    compiled by GNU C version 4.4.5.
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=131072
Compiler executable checksum: 47b826ed9d7049d0b0acd26e928e4c9e
 /home/kevin/it/bin/arm-apple-darwin10-as -arch arm -force_cpusubtype_ALL -o /tmp/cck3gviA.o /tmp/ccyVHwhV.s
ERROR: ld.so: object '/etc/override.so' from /etc/ld.so.preload cannot be preloaded: ignored.
ERROR: ld.so: object '/etc/override.so' from /etc/ld.so.preload cannot be preloaded: ignored.
 /home/kevin/it/libexec/gcc/arm-apple-darwin10/4.2.1/collect2 -dynamic -arch arm -force_cpusubtype_ALL -iphoneos_version_min 3.0 -syslibroot /home/kevin/is -weak_reference_mismatches non-weak -o test -lcrt1.o -L/home/kevin/is/usr/lib -L/home/kevin/it/lib/gcc/arm-apple-darwin10/4.2.1 -L/home/kevin/it/lib/gcc/arm-apple-darwin10/4.2.1/../../../../arm-apple-darwin10/lib /tmp/cck3gviA.o -lgcc -lSystem
ERROR: ld.so: object '/etc/override.so' from /etc/ld.so.preload cannot be preloaded: ignored.
ld warning: unknown option to -iphoneos_version_min, not 1.x or 2.x
Undefined symbols:
  "_main", referenced from:
      _main$non_lazy_ptr in crt1.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

1 Answer 1

0

Never mind, it turns out that I forgot to compile llvm along with it, and I didn't realize that obviously llvm-gcc would need llvm to function correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.