Leopard SDK 10.4 strange phenomena libc
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=vs0GFEfw7sOIx07eFL33IYghiGYvs8e5xjqmN4VyxCY=; b=AjX1fI0+sRG1M9W07QGOjGM+mcnQVb68vPKiHfFkF7D0T4uRTnxcrDsOmXlJNe5GjgTM5H2w6O7hoAAyvGc6xb0/3JS6z6rcxgJnzplurTadZglLXmg+mDIyBOOuD9/u9k+HTU2CBFtuskt0mTwyMj4m4JEWSsLvhADVpTw3ndQ= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=KAdEZ5te3JKdYcPTSRHX4EJcDSSQvHJ6SP2/xhcn/VSsJ+LpHy8XbQusDhI8wP8hOQz65YSyxkeHqzFLbTR4CmF0FFZPI0FaHM0qfDWXbpCX3AUQdCz6nLtEdfI9/9wrIJHFvhQDExgbUmKNk5cPjWGYBANyjhlsDS/ng1JMV2M= Hi all, i provide a simple example: ------------------------------------------------------ bundle.c ------------------------------------------------------ #include <stdio.h> #include <stdlib.h> static int foo(const char *name) { const char *n = name; if(n) system("ls -la /"); return 0; } static int bar(void) { return foo("Finder"); } int init(void) { return bar(); } ------------------------------------------------------ $ gcc -mmacosx-version-min=10.4 -fPIC -c src/bundle.c -arch i686 -arch ppc -ansi -Wall -O2 -o build/bundle.o $ nm build/bundle.o 00000000 T _init U _system $ gcc -c src/bundle.c -arch i686 -arch ppc -ansi -Wall -O2 -o build/bundle.o $ nm build/bundle.o 00000000 T _init U _system$UNIX2003 AFAIK... everything is going well in fact, i was in the same case with a bigger project, but i got an error from ld: $ gcc -c src/obj.c -arch i686 -arch ppc -ansi -Wall -O2 -o build/obj.o $ gcc -bundle build/obj.o -o build/obj.so -mmacosx-version-min=10.4 -arch i686 -arch ppc -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -framework CoreFoundation Undefined symbols for architecture i386: "_system$UNIX2003", referenced from: _method in obj.o .... the selected dylib object was the good one, but my produced object was rotten, a 10.5-libc-stub symbol was catched: $ nm build/obj.o 00000000 T _init U _system$UNIX2003 first i thought it was a option problem, 'maybe?' something was dropped , after many investigations, i discovered the only difference between my simple build test and my code was the order of my 'include' files, ---------------------------------------------------- #include <linkedlib.h> #include <CoreFoundation/CoreFoundation.h> ---------------------------------------------------- then, i decided to make the following tests: ---------------------------------------------------- #include <CoreFoundation/CoreFoundation.h> /* stdio.h stdlib.h */ #include <linkedlib.h> ---------------------------------------------------- ---------------------------------------------------- #include <stdio.h> #include <stdlib.h> #include <linkedlib.h> #include <CoreFoundation/CoreFoundation.h> ---------------------------------------------------- and everything's back to normal, i also made a new test, i removed my standard headers from my simple test file: $ gcc -fPIC -c src/bundle.c -arch i686 -arch ppc -ansi -Wall -O2 -o build/bundle.o src/bundle.c: In function 'foo': src/bundle.c:7: warning: implicit declaration of function 'system' src/bundle.c: In function 'foo': src/bundle.c:7: warning: implicit declaration of function 'system' $ nm build/bundle.o 00000000 T _init U _system Does this make any sense to you? -mmw _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
mm w