Re: How to compile KEXTs?
Re: How to compile KEXTs?
- Subject: Re: How to compile KEXTs?
- From: Christian Stieber <email@hidden>
- Date: Mon, 07 Aug 2006 09:40:19 +0200
At 14:39 04.08.2006 +0200, plumber Idraulico wrote:
LDFLAGS = -nostdlib -r -lkmodc++ -lkmod -lcc_kext -lcpp_kext
Thanks; that took me through the compile and link stages.
Loading the thing still doesn't work, though. I worked though
a number of issues reported by kextload -t. I kept getting
an unknown symbol "_kmod_info" --- couldn't figure out what
it wants, so for now I just added a
kmod_info_t kmod_info;
into the driver. It will probably need some initialization, though...
If I take it out I now get a "does not contain kernel extension code"
message; don't remember how I got the unknown symbol thing. In any case,
if I leave it in I'm getting a bit further ahead.
I'm now at a stage where kextload -t no longer gives real error
messages, but instead I get
kextload: extension /Users/stieber/MacOS-Bundles/WTG.kext appears to be valid
kld(): Undefined symbols:
.constructors_used
.destructors_used
__ZTI11OSMetaClass
__ZTI9IOService
__ZTVN10__cxxabiv120__si_class_type_infoE
and then it fails again. I grepped through every file in /usr, /System and
/Developer for the ZTI11OSMetaClass symbol, with no result...
There was another problem before, though: the loader was complaining about
me using dynamic libaries with rld interface. When I added -static to the
linker, the linker complained about that being incompatible with -framework.
So I removed the -framework specifications from the linker, which in
turn might cause the symbols to be missing ("IOService" looks like
it's part of the IOKit framework, for example). It seems I can either
get those missing symbols, or a complaint about the executable format.
I used to have "-framework IOKit -framework System" in the linker call;
currently the calls are
g++ -arch ppc -c -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_3 -I
/System/Library/Frameworks/Kernel.framework/Versions/A/Headers -fapple-kext
-fno-exceptions -static -fconstant-cfstrings -fpascal-strings -Wall -W
-Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align
-Wwrite-strings -Wmissing-noreturn -Wmissing-format-attribute
-Wno-multichar -Wredundant-decls -Winline -Wno-invalid-pch -Werror -DDEBUG
-ggdb -o /tmp/stieber/WTG-Build-Driver/Driver.o.ppc Driver.cpp;
lipo /tmp/stieber/WTG-Build-Driver/Driver.o.ppc -output
/tmp/stieber/WTG-Build-Driver/Driver.o -create
g++ -macosx_version_min=10.3 -nostdlib -r -lkmodc++ -lkmod -lcc_kext
-lcpp_kext -o /tmp/stieber/WTG-Build-Driver/Driver
/tmp/stieber/WTG-Build-Driver/Driver.o
The lipo call is an old thing in my build environment from when I tried to
ompile the normal software (not the kext) for both architectures, which didn't
work (I can only make i386 binaries on the intel mac and ppc binaries on the
ppc mac). It's still there since it didn't seem to cause problems, and at some
point I want to look into that again.
Christian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden