Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit declaration of function 'IOBluetooth*' is invalid in C99 on macos 11.1 #15

Open
jsotogaviard opened this issue Dec 19, 2020 · 5 comments

Comments

@jsotogaviard
Copy link

Project is not building because of those three errors:

/Users/isoto/dev/lightblue-0.4/src/mac/LightAquaBlue/BBServiceAdvertiser.m:128:20: Implicit declaration of function 'IOBluetoothAddServiceDict' is invalid in C99

/Users/isoto/dev/lightblue-0.4/src/mac/LightAquaBlue/BBServiceAdvertiser.m:142:3: Implicit declaration of function 'IOBluetoothObjectRelease' is invalid in C99

/Users/isoto/dev/lightblue-0.4/src/mac/LightAquaBlue/BBServiceAdvertiser.m:151:9: Implicit declaration of function 'IOBluetoothRemoveServiceWithRecordHandle' is invalid in C99

@jloi
Copy link

jloi commented Dec 24, 2020

I got it to compile by changing line 66 in setup.py to

os.system("xcodebuild install -arch 'x86_64' -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES ALWAYS_SEARCH_USER_PATHS=NO GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS=NO OTHER_CFLAGS='-Wno-implicit-function-declaration'")

The key here is OTHER_CFLAGS='-Wno-implicit-function-declaration'.

But after that I got a linking error.

"_IOBluetoothLocalDeviceReadAddress", referenced from:
      +[BBLocalDevice getAddressString] in BBLocalDevice.o
  "_IOBluetoothLocalDeviceReadClassOfDevice", referenced from:
      +[BBLocalDevice getClassOfDevice] in BBLocalDevice.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1

@jloi
Copy link

jloi commented Dec 25, 2020

Apple removed the IOBluetoothLocalDeviceReadAddress and IOBluetoothLocalDeviceReadClassOfDevice, among others from IOBluetoothUserLib.h since MacOS 10.8 (see API diff). I don't know what to replace those methods with. Using LightBlue may be a dead end for MacOS 11.

@JuliusNmn
Copy link

JuliusNmn commented Jun 6, 2021

I have replaced the deprecated function references. The framework builds without errors and seems to be working for my use cases (PyBluez), but I don't know how to properly test it. I have opened a pull request anyway.

@burricks
Copy link

Can you please add the link to the PR? I'd like to modify my code in the same way @JuliusNmn

@JuliusNmn
Copy link

Here you go: Pull request 19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants