[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[webdav-jp:0151] Re: MacOS X で mod_encording



こんばんは。

> > cc -Wall -shared -o libiconv_hook.so iconv_hook.o iconv_hook_default.o
> > iconv_hook_ja_auto.o iconv_hook_mssjis.o identify_encoding.o
> > /usr/bin/ld: Undefined symbols:
> > _main
> > _libiconv

libiconv が見えていないという問題もありますが、このオプションでは Mac
OS X 上でシェアードライブラリが作れないような気がします。僕も調べてい
る最中なんですが、

http://fink.sourceforge.net/doc/porting/porting.html#shared.build-lib

によると、普通の gcc には存在しないオプションを指定しないといけないようです。

2.4 Building a Shared Library

To build a shared library, you invoke the compiler driver with the
-dynamiclib option. This is best demonstrated by a comprehensive
example. We'll build a library called libfoo, composed of the source
files source.c and code.c. The version number is 2.4.5, where 2 is the
major revision (incompatible API change), 4 is the minor revision
(backwards-compatible API change) and 5 is the bugfix revision count
(some people call this the "teeny" revision, it denotes fully
compatible changes). The library depends on no other shared libraries
and will be installed in /usr/local/lib.

cc -fno-common -c source.c
cc -fno-common -c code.c
cc -dynamiclib -install_name /usr/local/lib/libfoo.2.dylib \
 -compatibility_version 2.4 -current_version 2.4.5 \
 -o libfoo.2.4.5.dylib source.o code.o
rm -f libfoo.2.dylib libfoo.dylib
ln -s libfoo.2.4.5.dylib libfoo.2.dylib
ln -s libfoo.2.4.5.dylib libfoo.dylib

-- やまの