GATTCentral with BluetoothLinux' HostController yields linker error
Closed this issue · 3 comments
fwcd commented
A simple Swift project using the latest versions of BluetoothLinux
and GATT
with the following main script
import Bluetooth
import BluetoothLinux
import GATT
let hostController = BluetoothLinux.HostController.default!
let central = GATTCentral<BluetoothLinux.HostController, BluetoothLinux.L2CAPSocket>(hostController: hostController)
causes linking to fail:
<compiler-generated>:0: error: undefined reference to '$s13BluetoothGATT26ATTMaximumTransmissionUnitV3maxACvgZ'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
link command failed with exit code 1 (use -v to see invocation)
colemancda commented
I assume this is on Swift 5.3
colemancda commented
Your final executable also needs to link to BluetoothGATT, BluetoothGAP, and BluetoothHCI on macOS and Linux
colemancda commented
@fwcd Add this to your CLI tool's dependencies:
.target(
name: "testtool",
dependencies: [
"Bluetooth",
.product(
name: "BluetoothGAP",
package: "Bluetooth"
),
.product(
name: "BluetoothGATT",
package: "Bluetooth"
),
.product(
name: "BluetoothHCI",
package: "Bluetooth"
),
.product(
name: "BluetoothLinux",
package: "BluetoothLinux",
condition: .when(platforms: [.linux])
),
.product(
name: "DarwinGATT",
package: "GATT",
condition: .when(platforms: [.macOS])
),
.product(
name: "BluetoothDarwin",
package: "BluetoothDarwin",
condition: .when(platforms: [.macOS])
)
]
)