Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Produce working, fat binary dynamic library from command line?



Hello.

I'm trying to produce working fat binary shared libraries
from the command line. I'm encountering linker errors.
Platform is PPC with a clean install of 10.4.9 (8.9.0) and
up-to-date developer tools.

I have the following files:

/* t.h */
#ifndef T_H
#define T_H

void t1(void);
void t2(void);
void t3(void);

#endif

/* t1.c */

#include <stdio.h>
#include "t.h"

void t1(void)
{
 printf("t1\n");
}

/* t2.c */

#include <stdio.h>
#include "t.h"

void t2(void)
{
 printf("t2\n");
}

/* t3.c */

#include <stdio.h>
#include "t.h"

void t3(void)
{
 printf("t3\n");
}

Makefile:

t.dylib: t.h t1.o t2.o t3.o
       libtool -dynamic -o t.dylib t1.o t2.o t3.o -lSystemStubs -lc

t1.o: t1.c t.h
       cc -arch i386 -arch ppc -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -c -dynamic -o t1.o t1.c
t2.o: t2.c t.h
       cc -arch i386 -arch ppc -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -c -dynamic -o t2.o t2.c
t3.o: t3.c t.h
       cc -arch i386 -arch ppc -isysroot
/Developer/SDKs/MacOSX10.4u.sdk -c -dynamic -o t3.o t3.c

clean:
       rm -f t.dylib t1.o t2.o t3.o

I'm getting this error:

$ make
cc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c
-dynamic -o t1.o t1.c
cc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c
-dynamic -o t2.o t2.c
cc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -c
-dynamic -o t3.o t3.c
libtool -dynamic -o t.dylib t1.o t2.o t3.o -lSystemStubs -lc
ld: for architecture i386
ld: Undefined symbols:
_puts
libtool: internal link edit command failed
make: *** [t.dylib] Error 1

What is the correct way to produce shared libraries from
the command line in this manner? My method obviously
isn't right...

thanks,
MC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.