2014-10-30 42 views
5

我一直在安裝libsasl2(賽勒斯SASL)的版本有一些麻煩。OSX Yosemite上的libsasl2破解了嗎?缺少sasl_client_done

特別是,似乎本地頭文件和sasl_version報告了版本2.1.26,但沒有爲全局函數sasl_client_done提供符號。

我敢肯定,我應該有一個符號,因爲:

  • 它的存在在提供SASL/sasl.h頭
  • 的cyrsus SASL NEWS文件列表「實現sasl_client_done()/sasl_server_done()」作爲2.1.24功能
  • 它的存在處處提供2.1.26外約塞米蒂

的對於再現:

  • 注意,下面將打印樣品
    • 「IMPL: '賽勒斯SASL',版本:33619994,主要:2,次要:1,步驟:26」
  • 樣品編譯和執行在Linux在取消

的註釋掉的代碼產生的優勝美地

Undefined symbols for architecture x86_64: 
    "_sasl_client_done", referenced from: 
     _main in foo-072675.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
鏈接錯誤代碼後用相同的庫版本安裝

調用編譯器:

clang -Wall -Werror -lsasl2 -o foo foo.c -v 

與鐺-v:

Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) 
Target: x86_64-apple-darwin14.0.0 
Thread model: posix 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name foo.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 241.9 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -Wall -Werror -fdebug-compilation-dir /Users/jcarey/work -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fdiagnostics-show-option -vectorize-slp -o /var/folders/wq/jypwqgv976n0db5l5qxw900r0000gq/T/foo-92054e.o -x c foo.c 
clang -cc1 version 6.0 based upon LLVM 3.5svn default target x86_64-apple-darwin14.0.0 
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/local/include" 
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/Library/Frameworks" 
#include "..." search starts here: 
#include <...> search starts here: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks (framework directory) 
End of search list. 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -o foo -lsasl2 /var/folders/wq/jypwqgv976n0db5l5qxw900r0000gq/T/foo-92054e.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a 
Undefined symbols for architecture x86_64: 
    "_sasl_client_done", referenced from: 
     _main in foo-92054e.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

和代碼的問題:

#include <sasl/sasl.h> 
#include <stdio.h> 
#include <stdint.h> 

int main(int argc, char ** argv) { 
    const char *impl; 
    int version; 
    uint32_t buf; 
    uint16_t major; 
    uint8_t minor; 
    uint8_t step; 

    sasl_version(&impl, &version); 

    buf = version; 

    major = buf >> 24; 
    minor = (buf << 8) >> 24; 
    step = (buf << 24) >> 24; 

    printf("impl: '%s', version: %d, major: %d, minor: %d, step: %d\n", impl, version, major, minor, step); 

    /* 
    { 
     int (* scd)(void); 

     scd = &sasl_client_done; 

     printf("sasl_client_done: %p\n", scd); 
    } 
    */ 

    return 0; 
} 

我想的東西的扭曲與方式cyrus sasl被包裝爲優勝美地(使用從小牛符號列表也許?)。

+0

您正在尋找的實用程序是nm。運行'nm/usr/lib/libsasl2.dylib'查看所有符號。你會發現它確實沒有在約塞米蒂有'sasl_client_done'。該庫被命名爲'libsasl2.2 *',但顯然這並不意味着它對於OS X來說並不是真正的'2.1.x'版本。 – indiv 2014-10-31 00:57:08

+0

我對nm很熟悉,但是認爲鏈接失敗與報告major.minor.step sasl_version()2.1.26出相同的鏈接鏈更有用。 在這個世界裏,頭文件與發佈的dylib(sasl_version return(<2.1.24))不匹配,然後是我認爲我在其中的那個(他們沒有遵守LIBSASL_API導出宏)。 nm無法區分 – hanumantmk 2014-10-31 17:01:58

回答

2

爲感興趣的事,我只是檢查與10.10.4,我看到的符號是現在有:

$ nm /usr/lib/libsasl2.dylib |grep sasl_client_done 
000000000000724a T _sasl_client_done 

的示例代碼現在工作正常(帶有註釋的部分取消註釋現在)。雖然相同的賽勒斯SASL版本仍然返回:

impl: 'Cyrus SASL', version: 33619994, major: 2, minor: 1, step: 26 
sasl_client_done: 0x7fff8e3dc24a