5

OSX10.9 に pybluez と LightBlue の両方をインストールしようとしましたが、エラーが発生します。これらのいずれかを Mavericks にインストールできた人はいますか?

LightBlue で次のエラーが発生します。

    === BUILD TARGET LightAquaBlue OF PROJECT LightAquaBlue WITH CONFIGURATION Release ===

Check dependencies
error: There is no SDK with the name or path '/Users/myname/Downloads/lightblue-0.4/src/mac/LightAquaBlue/macosx10.6'

** INSTALL FAILED **


The following build commands failed:
    Check dependencies
(1 failure)

そして、私は pyBluez に対してこのエラーが発生しています:

    osx/_osxbt.c:676:5: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean 'IOBluetoothDeviceRef'?

    IOBluetoothDeviceInquiryRef inquiry;

    ^~~~~~~~~~~~~~~~~~~~~~~~~~~

    IOBluetoothDeviceRef

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetoothUserLib.h:34:47: note: 'IOBluetoothDeviceRef' declared here

typedef struct OpaqueIOBluetoothObjectRef *                     IOBluetoothDeviceRef;

                                                                ^

osx/_osxbt.c:688:17: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean 'IOBluetoothDeviceRef'?

                IOBluetoothDeviceInquiryRef inquiryRef,

                ^~~~~~~~~~~~~~~~~~~~~~~~~~~

                IOBluetoothDeviceRef

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetoothUserLib.h:34:47: note: 'IOBluetoothDeviceRef' declared here

typedef struct OpaqueIOBluetoothObjectRef *                     IOBluetoothDeviceRef;

                                                                ^

osx/_osxbt.c:703:19: warning: implicit declaration of function 'IOBluetoothDeviceInquiryCreateWithCallbackRefCon' is invalid in C99 [-Wimplicit-function-declaration]

    dd->inquiry = IOBluetoothDeviceInquiryCreateWithCallbackRefCon (&dd);

                  ^

osx/_osxbt.c:703:17: warning: incompatible integer to pointer conversion assigning to 'IOBluetoothDeviceRef' (aka 'struct OpaqueIOBluetoothObjectRef *') from 'int' [-Wint-conversion]

    dd->inquiry = IOBluetoothDeviceInquiryCreateWithCallbackRefCon (&dd);

                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

osx/_osxbt.c:705:5: warning: implicit declaration of function 'IOBluetoothDeviceInquirySetCompleteCallback' is invalid in C99 [-Wimplicit-function-declaration]

    IOBluetoothDeviceInquirySetCompleteCallback (dd->inquiry,

    ^

osx/_osxbt.c:717:5: warning: implicit declaration of function 'IOBluetoothDeviceInquiryStart' is invalid in C99 [-Wimplicit-function-declaration]

    IOBluetoothDeviceInquiryStart (dd->inquiry);

    ^

osx/_osxbt.c:721:5: warning: implicit declaration of function 'IOBluetoothDeviceInquiryDelete' is invalid in C99 [-Wimplicit-function-declaration]

    IOBluetoothDeviceInquiryDelete (dd->inquiry);

    ^

5 warnings and 2 errors generated.

error: command 'gcc' failed with exit status 1
4

2 に答える 2

7

PyBluez は Windows のみです:

「PyBluez は GNU/Linux および Windows XP (Microsoft および Widcomm Bluetooth スタック) で動作します。」- pybluezホームページ

間違ったバージョンの LightBlueをインストールしているようです

Check dependencies 
error: There is no SDK with the name or path '/Users/myname/Downloads/lightblue-0.4/src/mac/LightAquaBlue/macosx10.6'

OSX 10.6 用のファイルを探しています。

マスター ディストリビューションをダウンロードしてインストールします: https://github.com/postskolkovo/lightblue-0.4

エラーが発生した場合:

Check dependencies
No architectures to compile for (ARCHS=$(NATIVE_ARCH_ACTUAL), VALID_ARCHS=i386 x86_64).

** INSTALL FAILED **

setup.py を開いて次のように変更する必要があります。

os.system("xcodebuild install -arch '$(NATIVE_ARCH_ACTUAL)' -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES")

に:

os.system("xcodebuild install -arch 'i386' -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES")

この議論を通して

編集インポートしようとしたときに
実際に Mavericks を取得しました。 これは、64ビットコンピューターの修正のようです:ImportError: Bundle could not be loaded

os.system("xcodebuild install -arch 'x86_64' -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES")

あなたが同じことに遭遇した場合、必要になるかもしれません。

于 2014-03-09T22:54:42.093 に答える
4

特に mac osx 10.8 https://github.com/0-1-0/lightblue-0.4用の別のバージョンがあります。このバージョンは osx 10.10 Yosemite でも実行できます。

setup.py ファイルの次の行を変更する必要がありました。

os.system("xcodebuild install -arch 'x86_64' -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES")

そして、次の 2 つのメソッドを /Library/Python/2.7/site-packages/lightblue/_lightblue.py に挿入しました。

def deviceInquiryDeviceNameUpdated_device_devicesRemaining_(自己、送信者、デバイス、devicesRemaining): パス

def deviceInquiryUpdatingDeviceNamesStarted_devicesRemaining_(self、sender、devicesRemaining): パス

次のコンストラクタの後:

_AsyncDeviceInquiry(Foundation.NSObject):

完全なコードは次のとおりです。

class _AsyncDeviceInquiry(Foundation.NSObject): 

# NSObject init, not python __init__
def init(self):
    try:
        attr = _IOBluetooth.IOBluetoothDeviceInquiry
    except AttributeError:
        raise ImportError("Cannot find IOBluetoothDeviceInquiry class " +\
            "to perform device discovery. This class was introduced in " +\
            "Mac OS X 10.4, are you running an earlier version?")

    self = super(_AsyncDeviceInquiry, self).init()
    self._inquiry = \
        _IOBluetooth.IOBluetoothDeviceInquiry.inquiryWithDelegate_(self)

    # callbacks
    self.cb_started = None
    self.cb_completed = None
    self.cb_founddevice = None

    return self

def deviceInquiryDeviceNameUpdated_device_devicesRemaining_(self, sender, device, devicesRemaining):
    pass

def deviceInquiryUpdatingDeviceNamesStarted_devicesRemaining_(self, sender, devicesRemaining):
    pass

最後のステップは、同じファイル内の次の行を変更することです。

deviceInquiryComplete_error_aborted_, signature="v@:@iB")

deviceInquiryComplete_error_aborted_, signature="v@:@iZ")

私にとってはうまくいきます!

これが役立つ投稿であることを願っています。

于 2014-11-11T14:30:48.850 に答える