Mac アプリケーションを素晴らしいlibancillaryライブラリにリンクしようとしています。ただし、共有ライブラリを作成するようにライブラリ ビルド スクリプトを変更しました。を使用してこのライブラリのシンボルを検査できますnm libancillary.dylib
-結果は次のとおりです。
libancillary.dylib(single module):
U ___sF
U __keymgr_get_and_lock_processwide_ptr
U __keymgr_get_and_lock_processwide_ptr_2
U __keymgr_set_and_unlock_processwide_ptr
U _abort
00002cfe T _ancil_recv_fd
00002c87 T _ancil_recv_fds
00002b6a T _ancil_recv_fds_with_buffer
00002e9e T _ancil_send_fd
00002e27 T _ancil_send_fds
00002d3f T _ancil_send_fds_with_buffer
U _calloc
U _dlopen
U _dlsym
U _fflush
U _fprintf
U _free
U _malloc
U _recvmsg
U _sendmsg
ただし、アプリケーションをリンクしようとすると、次のような出力が得られます。
g++ -headerpad_max_install_names -framework AppKit -framework Cocoa -framework IOKit -framework CoreFoundation -framework Carbon -framework OpenGL -framework SystemConfiguration -framework Security -Wl,-bind_at_load -arch i386 -o MyApp build/app.o build/client.o build/util.o -F/Library/Frameworks -L/Library/Frameworks -L../ancillary -lancillary
Undefined symbols:
"ancil_recv_fd(int, int*)", referenced from:
CIPCUnixUtils::readFD(int, int&) constin utils.o
"ancil_send_fd(int, int)", referenced from:
CIPCUnixUtils::writeFD(int, int) constin utils.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [ABClient] Error 1
(オブジェクト ファイルの非常に長いリストを削除するために、これを少し編集しました)。
このリンクが失敗する原因は何ですか? シンボルが存在し、公開されており、ライブラリが見つからないというエラーやその他のエラー メッセージはありません。