[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Errors linking against the framework I just built
From: |
Jens Alfke |
Subject: |
Errors linking against the framework I just built |
Date: |
Tue, 28 Feb 2012 11:37:21 -0800 |
Hi again. I’ve now gotten as far as building my code into a framework, but I’m
having trouble with linking against it. I’m sure half of this is my own Linux
n00b-ness, so bear with me.
My framework itself builds and links successfully, which was surprising because
I have a number of unimplemented functions and classes in it yet, so I was
expecting missing-symbol link errors. I’m guessing this is just a difference
between the way shared libraries work on Linux vs Darwin, where the latter
resolves all symbols when the library is linked and complains about ones it
can’t find in the code itself or an imported library. Presumably Linux doesn’t
resolve symbols until an app is linked with the library?
I do get the following warning, which I’m ignoring but might be significant:
> clang: warning: argument unused during compilation: '-shared-libgcc'
So I’m trying to build a trivial ‘tool’ binary. It has one source file with a
main() function that does nothing but call a function in my framework. I can’t
figure out how to get it to link against my framework, though.
I added the following to my GNUmakefile:
> TOOL_NAME = MyTool
> MyTool_OBJC_FILES = TrivialMain.m
> MyTool_OBJC_LIBS = -lMyFramework
> ADDITIONAL_NATIVE_LIB_DIRS += MyFramework.framework
The last line seems kludgy to me, but without it the linker can’t find the .so
file. With it, I get no error finding the library, but do get a missing-symbol
error:
> ./obj/MyTool.obj/TrivialMain.m.o:(.data.rel.ro.__objc_class_ref_TDServer[__objc_class_ref_TDServer]+0x0):
> undefined reference to `__objc_class_name_TDServer’
Where ‘TDServer’ is the class I’m trying to use in my little main() function.
Here’s where I’m stuck. The .so file seems to be [a symlink to] a valid shared
library — it’s 1.4MB, and ‘file’ says it’s an "ELF 32-bit LSB shared object,
Intel 80386, version 1 (SYSV), dynamically linked, not stripped”. The ‘nm’ tool
lists the missing symbol as
000c3c60 B __objc_class_name_TDServer
Any ideas? (And thanks again for the help so far!)
—Jens
smime.p7s
Description: S/MIME cryptographic signature
- Errors linking against the framework I just built,
Jens Alfke <=