2012-02-06 26 views
3

XCodeがインストールされていて、FreeTDSもあります。私はSQL Serverに接続しようとしましたが、完璧に動作します。Mac OS X Lionにpymssqlをインストールする際のエラー

今私は、このSQL Serverと - 私はpymsqlをインストールしようとして働くのpythonのaplicationを開発する必要がありますが、私はsudoのPythonのsetup.pyコマンドlauncheとき、私はこのエラーを得た:

==> sudo python setup.py install 
running install 
running bdist_egg 
running egg_info 
writing pymssql.egg-info/PKG-INFO 
writing top-level names to pymssql.egg-info/top_level.txt 
writing dependency_links to pymssql.egg-info/dependency_links.txt 
reading manifest file 'pymssql.egg-info/SOURCES.txt' 
reading manifest template 'MANIFEST.in' 
writing manifest file 'pymssql.egg-info/SOURCES.txt' 
installing library code to build/bdist.macosx-10.7-intel/egg 
running install_lib 
running build_ext 
skipping '_mssql.c' Cython extension (up-to-date) 
building '_mssql' extension 
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/sw/include -Ifreetds/nix_64/include -I/opt/local/include -I/opt/local/include/freetds -I/opt/local/freetds/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mssql.c -o build/temp.macosx-10.7-intel-2.7/_mssql.o -DMSDBLIB 
_mssql.c: In function ‘__pyx_f_6_mssql_15MSSQLConnection_convert_python_value’: 
_mssql.c:7322: warning: implicit conversion shortens 64-bit value into a 32-bit value 
_mssql.c: In function ‘__pyx_f_6_mssql_15MSSQLConnection_get_result’: 
_mssql.c:9554: warning: implicit conversion shortens 64-bit value into a 32-bit value 
_mssql.c:9566: warning: implicit conversion shortens 64-bit value into a 32-bit value 
_mssql.c: In function ‘__pyx_pf_6_mssql_20MSSQLStoredProcedure_2bind’: 
_mssql.c:11146: warning: implicit conversion shortens 64-bit value into a 32-bit value 
llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.7-intel-2.7/_mssql.o -L/sw/lib -Lfreetds/nix_64/lib -L/opt/local/lib -L/opt/local/lib/freetds -L/opt/local/freetds/lib -lsybdb -lrt -o build/lib.macosx-10.7-intel-2.7/_mssql.so 
ld: warning: directory not found for option '-L/sw/lib' 
ld: warning: directory not found for option '-L/opt/local/lib' 
ld: warning: directory not found for option '-L/opt/local/lib/freetds' 
ld: warning: directory not found for option '-L/opt/local/freetds/lib' 
ld: library not found for -lrt 
collect2: ld returned 1 exit status 
ld: warning: directory not found for option '-L/sw/lib' 
ld: warning: directory not found for option '-L/opt/local/lib' 
ld: warning: directory not found for option '-L/opt/local/lib/freetds' 
ld: warning: directory not found for option '-L/opt/local/freetds/lib' 
ld: library not found for -lrt 
collect2: ld returned 1 exit status 
lipo: can't open input file: /var/tmp//cc6eQsIN.out (No such file or directory) 
error: command 'llvm-gcc-4.2' failed with exit status 1 

を助けや手がかりは?

+0

は、フォルダを作成しています:「/ sw/lib "、"/opt/local/lib "...? – CarlJ

+0

いいえ...私はする必要がありますか? –

答えて

11

残念ながら、pymssqlのsetup.py(バージョンpymssql-2.0.0b1-dev-20111019)は、OSX Lionで正しく動作するには少しの助けが必要です。現在のsetup.pyは、あらかじめ構築されたLinux FreeTDSライブラリをコンパイル/リンクしようとしますが、OSX上に存在しないlibrtとのリンクも試みます。さらに、FinkやMacPortsからFreeTDSライブラリを明示的に探すため、Homebrew(ifを使用する場合)またはFreeTDS自体を非標準の場所にインストールした場合、コンパイラ/リンカーによって見つけられないことがあります。

私はsetup.py hereの修正バージョンを作成しました。標準の場所(/ usr/local/{lib、include})を使用してFreeTDSのHomebrewビルドで私にとってはうまく機能しましたが、常にYMMVと同じです。 FreeTDSを別の場所にインストールした場合は、さらにsetup.pyを調整する必要があります。

LD:警告:ディレクトリオプションが見つかりません「-L/usr/local/libディレクトリ/ FreeTDSの」

一つあなたは、一般的にシステム上に存在しない可能性があり、ディレクトリの欠落について、リンカからの警告を無視することができますその他の注意:おそらくx86_64のような単一のアーキテクチャ用にFreeTDSを構築しているでしょう。デフォルトでは、pymsslは(システムPython 2.7.1を使用していると仮定して)マルチアーキテクチャのビルドになります。パッチされたsetup.pyを使用しても、

ld:warning:ファイル/usr/local/lib/libsybdb.dylibを無視すると、ファイルはリンクされているアーキテクチャではないサポートされていないファイル形式用に構築されています(i386)

この警告は、FreeTDSライブラリには、 。 ARCHFLAGSを使用してx86_64専用ビルドを作成すると、警告を回避できます。

ARCHFLAGS = " - arch x86_64" python setup。PY

+0

+1良い説明とsetup.pyへのリンクは、正しく動作するように助けました。 – dlamotte

+0

ありがとう!完全に私を救った。 –

3

をインストールするか、このフォークを試してみてください、それは問題なくインストールされます。

https://github.com/blackbass1988/pymssql-macos-lion

OS Xマーベリックスにインストールするには、

OS Xコマンドラインツール

FreeTDSのを必要とし

brew install freetds 

cython

pip install cython 

そして最後に、あなたがpymssql-macoslionに

pip install git+git://github.com/blackbass1988/[email protected] 
2

をインストールすることができ、誰もがこれを読んでいるだけで包み、次は私の仕事:

brew install freetds 
sudo pip install pymssql 
関連する問題