FreeBSD 6.0 and Objective C

Marc Argent margent at gmail.com
Mon Nov 14 00:44:54 GMT 2005


Hi,

I am trying to compile a very simple Objective C program (actually, it
is a 'Hello World' test program with a different file extension and
linked to the Objective C library).

#import <stdio.h>

int main (int argc, const char *argv[])
{
	printf("Hello World\n");
	return 0;
}

I am invoking the compiler with the following line:

gcc main.m -o helloworld -l objc

This results in the following error message:

/usr/lib/libobjc.so: undefined reference to `pthread_attr_destroy'
/usr/lib/libobjc.so: undefined reference to `pthread_create'
/usr/lib/libobjc.so: undefined reference to `pthread_attr_init'
/usr/lib/libobjc.so: undefined reference to `pthread_exit'
/usr/lib/libobjc.so: undefined reference to `pthread_getschedparam'
/usr/lib/libobjc.so: undefined reference to `pthread_setschedparam'
/usr/lib/libobjc.so: undefined reference to `pthread_attr_setdetachstate'

I get the same error message from a vanilla install of FreeBSD 6.0 and
one that has been updated with all security updates as of Friday
(11/11/2005).  I realise that security updates wouldn't fix this, but
thought it worth mentioning.  Compiling the code without the "-l objc"
flag works just fine.

Any idea what is up?  I will try updating my other machine to the
latest and greatest sources tomorrow and see if that fixes it.

Regards

Marc


More information about the freebsd-questions mailing list