MAC OSX 10.6 & iPhone OS 3.1 Simulator Linking Errors
For those getting linker errors, try some of the advice below.
If you’re having libcrt linker errors, similar to:
ld: library not found for -lcrt1.10.6.o collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
This can be solved by creating a sym link from crt1.10.5.o to crt1.10.6.o:
MacMini-2:lib johannes$ pwd /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib MacMini-2:lib johannes$ sudo ln -s crt1.10.5.o crt1.10.6.o MacMini-2:lib johannes$ ls -la *crt* -rw-r--r-- 1 root wheel 17324 Dec 22 2007 crt1.10.5.o lrwxr-xr-x 1 root wheel 11 Sep 15 19:38 crt1.10.6.o -> crt1.10.5.o -rw-r--r-- 1 root wheel 18212 Dec 22 2007 crt1.o -rw-r--r-- 1 root wheel 18472 Dec 22 2007 gcrt1.o
If you’re getting gcov linker errors similar to:
Undefined symbols: "_vproc_transaction_begin", referenced from: ___gcov_init in libgcov.a(_gcov.o) _vproc_transaction_begin$non_lazy_ptr in libgcov.a(_gcov.o) "_vproc_transaction_end", referenced from: _gcov_exit in libgcov.a(_gcov.o) _vproc_transaction_end$non_lazy_ptr in libgcov.a(_gcov.o) ld: symbol(s) not found collect2: ld returned 1 exit status
The problem is the implementation is missing for some reason… Apple screwed up somewhere. Here is a small blank stub version to at least get the compiler to compile:
#include <Availability.h>
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/syslog.h>
#include <sys/time.h>
#include <stdbool.h>
#include <launch.h>
#include <vproc.h>
typedef struct vproc_transaction_s *vproc_transaction_t;
vproc_transaction_t vproc_transaction_begin(vproc_t vp __attribute__((unused))) {
return NULL;
}
void _vproc_transaction_begin(void) {
return;
}
void vproc_transaction_end(vproc_t vp __attribute__((unused)), vproc_transaction_t vpt) {
return;
}
void _vproc_transaction_end(void) {
return;
}
I’ve tested this and at least got a compile to work and a build going, but obviously something is now being broken purposely. If anybody wanted to take a closer look, an implementation of the functions might be able to be hashed from:
http://www.mirrors.docunext.com/websvn/launchd/checkout/trunk/launchd/src/libvproc.c
Hope this helps. Best of luck.
Thanks. You saved me a whole lot of investigation to get around the _vproc_transaction_end() missing error.
I guess no-one at Apple is testing gcov. 8-(
I’m trying to get Coverstory working for the iPhone again… following your instructions everything builds (thanks!) and the .gcno files are generated, but not the accompanying .gcda. You’re not getting the .gcda files either right? I assume something in the function stubs that we’ve added is responsible for creating those files.
Most likely.
To be honest, I’m not even sure what .gcda or .gcno files are, and I’m assuming they are part or gcov.
As mentioned, we’re purposely breaking the lib to just get a build going, so, I really can’t help beyond that. Out of thought, you may want to dump the symbol table and see if Apple simply renamed the routines and you can, instead of just returning (or returning null) have the functions call the right symbol instead.
Aside from that, sorry I can’t be more help.
Best of luck.
Using Xcode?
Mach-O Type set to Dynamic Library