내 Mac 응용 프로그램을 멋진 libancillary 라이브러리에 연결하려고합니다. 그러나 공유 라이브러리를 만들기 위해 라이브러리 빌드 스크립트를 변경했습니다. 내가 nm libancillary.dylib
를 사용하여이 라이브러리의 기호를 검사 할 수 있습니다 - 결과는 다음과 같습니다 그러나ld가 누락 된 기호를보고하지만 기호가있는 것 같습니다.
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
은 (난이 편집 한 객체 파일의 매우 긴 목록을 제거하려면 약간.
이 연결이 실패 할 수있는 원인은 무엇입니까? 심볼이 존재하며 공개되어 있으며 라이브러리를 찾을 수 없다는 오류 또는 기타 오류 메시지가 없습니다.
비슷한 질문 : http://stackoverflow.com/questions/942754/nm-reports-symbol-is-defined-but-ldd-reports-symbol-is-undefined 내 기호가 표시되는 것을 제외 공개로. – Thomi
nm -D를 사용하여 동적으로 링크 된 심볼을 볼 필요가 없나요? 아니면 osx에서 linux와 다르게 작동합니까? –