I created a bunch of files .o(via gcc -c $file.c $someotherops -o $file.o). Now I want to link them to a static library.
I am not sure what I should use ldor gccfor this. The manual ldsays that I should not use it directly. However, I cannot define gcc options to create a static library.
I tried ld *.o -static -o libfoo.a, but it complains about a lot of missing characters (I think everything is from libc). I do not understand why it complains because it must be a static library. I thought I would check for the characters as soon as I link this static library to some other task.
Another thing: I use /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ldhere (my goal is iOS). He complains about the warning ld: warning: using ld_classic. What does it mean?
Then I thought, maybe he needs to specify dynamic libraries. So I added -lcfor reference to libc. But he complains about can't locate file for: -lc. I added -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/liband eat libc.dylib.
Any ideas?
Error -lc: It disappeared after I pointed out -arch armv6. Then he complained about the wrong one libcache.dylib(which should be connected with libc.dylib, I think, because he did not indicate it). Added support -L.../usr/lib/system.
Now, for every single file .o, I get a warning ld: warning: CPU_SUBTYPE_ARM_ALL subtype is deprecated. What does it mean?
And I still have a bunch of missing characters, esp:
Undefined symbols for architecture armv6:
"start", referenced from:
-u command line option
(maybe you meant: _PyThread_start_new_thread)
"___udivsi3", referenced from:
_get_len_of_range in bltinmodule.o
_quorem in dtoa.o
_array_resize in arraymodule.o
_newarrayobject in arraymodule.o
_array_fromfile in arraymodule.o
_get_len_of_range in rangeobject.o
_inplace_divrem1 in longobject.o
...
"___unorddf2", referenced from:
_builtin_round in bltinmodule.o
...
, . ___udivsi3 get_len_of_range. C-, . , , , , ___udivsi3. ?
-lgcc_s.1 ___udivsi3 . start - . -u command line option?
, , , , ld . ar. , , . , .
, ar . libtool. , , .. libtool -static -o libfoo.a *.o. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang, , .
, , :
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in __PyBuiltin_Init from /Users/az/Programmierung/python-embedded/libpython.a(bltinmodule.o). To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
ld: warning: 32-bit absolute address out of range (0x1001B70C4 max is 4GB): from _usedpools + 0x00000004 (0x001B70CC) to 0x1001B70C4
ld: warning: 32-bit absolute address out of range (0x1001B70C4 max is 4GB): from _usedpools + 0x00000000 (0x001B70CC) to 0x1001B70C4
? -mdynamic-no-pic. _PyBuiltin_Init, .
, ? : . ( WITH_PYMALLOC, - Python).
iPhone, :
dyld: vm_protect(0x00001000, 0x00173000, false, 0x07) failed, result=2 for segment __TEXT in /var/mobile/Applications/C15D9525-E7DC-4463-B05B-D39C9CA24319/...
-no_pie , . :
Illegal text-relocation to ___stderrp in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libSystem.dylib from _read_object in /Users/az/Programmierung/python-embedded/libpython.a(marshal.o) for architecture armv7
PIE, . -static Clang. , , dyld/vm_protect. , .
. , Clang.