pc-ble-driver compile on macOS
I am trying to compile pc-ble-driver on macOS 10.15.2 by following the very excellent instructions on the github page.
Fixing GCC issues
I have installed the dependencies and made it to step 2 under Compiling pc-ble-driver on Ubuntu Linux or macOS, and when I run
$ cmake -G Ninja ..
the output I get is:
-- NRF_BLE_DRIVER_VERSION not specified, setting it to 0.0.0
CMake Error at cmake/nrf-ble-driver.cmake:20 (message):
ARCH not available on macOS / OS X. Universal 32 and 64-bit binaries will
be built.
Call Stack (most recent call first):
CMakeLists.txt:30 (include)
-- Configuring incomplete, errors occurred!
See also "/Users/mcanulty/Downloads/pc-ble-driver-master/build/CMakeFiles/CMakeOutput.log".
I can see the issue in nrf-ble-driver.cmake, but I can't figure out what architecture to enter as both x86_32 or x86_64 seem to produce the same output.
In CMakeFiles/CMakeOutput.log I see it begins with
The system is: Darwin - 19.2.0 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /Applications/Xcode_10.1/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
Build flags:
Id flags:
I believe homebrew best practice is not to shadow the system compiler, but in this case it seemed necessary. I went to usr/local/bin and ran the following:ln -s gcc-6 gcc
ln -s c++-6 c++
ln -s cc gcc
Encountering vcpkg issues
This seems to have fixed the ARCH issues, cmake output is now as follows and I'm stumped:
$ cmake -G Ninja ..
-- NRF_BLE_DRIVER_VERSION not specified, setting it to 0.0.0
-- CONNECTIVITY_VERSION not specified, setting it to 0.0.0
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode_10.1/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode_10.1/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode_10.1/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode_10.1/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Architecture not set, using native 64-bit toolchain.
-- Building with build type: .
-- Found Git: /usr/local/bin/git (found version "2.24.0")
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at /usr/local/bin/vcpkg-root/installed/x64-osx/share/spdlog/spdlogConfigTargets.cmake:88 (message):
The imported target "spdlog::spdlog" references the file
"/usr/local/bin/vcpkg-root/installed/x64-osx/debug/lib/libspdlogd.a"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/local/bin/vcpkg-root/installed/x64-osx/share/spdlog/spdlogConfigTargets.cmake"
but not all the files it references.
Call Stack (most recent call first):
/usr/local/bin/vcpkg-root/installed/x64-osx/share/spdlog/spdlogConfig.cmake:15 (include)
/usr/local/bin/vcpkg-root/scripts/buildsystems/vcpkg.cmake:233 (_find_package)
test/CMakeLists.txt:11 (find_package)
When I installed spdlog from head the output was the following.
The following packages will be built and installed:
* fmt[core]:x64-osx
spdlog[core]:x64-osx (from HEAD)
Additional packages (*) will be modified to complete this operation.
Starting package 1/2: fmt:x64-osx
Building package fmt[core]:x64-osx...
-- Downloading github.com/.../5.3.0.tar.gz...
-- Extracting source /usr/local/bin/vcpkg-root/downloads/fmtlib-fmt-5.3.0.tar.gz
-- Using source at /usr/local/bin/vcpkg-root/buildtrees/fmt/src/5.3.0-9fc40447dd
-- Configuring x64-osx-dbg
-- Configuring x64-osx-rel
-- Building x64-osx-dbg
-- Building x64-osx-rel
-- Installing: /usr/local/bin/vcpkg-root/packages/fmt_x64-osx/share/fmt/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package fmt[core]:x64-osx... done
Installing package fmt[core]:x64-osx...
Installing package fmt[core]:x64-osx... done
Elapsed time for package fmt:x64-osx: 18.45 s
Starting package 2/2: spdlog:x64-osx
Building package spdlog[core]:x64-osx from HEAD...
-- Downloading api.github.com/.../v1.x...
-- Skipping hash check for /usr/local/bin/vcpkg-root/downloads/temp/gabime-spdlog-v1.x.tar.gz.version.
-- Downloading github.com/.../v1.x.tar.gz...
-- Skipping hash check for /usr/local/bin/vcpkg-root/downloads/temp/gabime-spdlog-v1.x.tar.gz.
-- Extracting source /usr/local/bin/vcpkg-root/downloads/gabime-spdlog-v1.x.tar.gz
-- Applying patch disable-master-project-check.patch
-- Applying patch failed. This is expected if this patch was previously applied.
-- Using source at /usr/local/bin/vcpkg-root/buildtrees/spdlog/src/head/v1.x-660000b1df
-- Configuring x64-osx-dbg
-- Configuring x64-osx-rel
-- Building x64-osx-dbg
-- Building x64-osx-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package spdlog[core]:x64-osx... done
Installing package spdlog[core]:x64-osx...
Installing package spdlog[core]:x64-osx... done
Elapsed time for package spdlog:x64-osx: 47.47 s
Total elapsed time: 1.099 min
The package spdlog:x64-osx provides CMake targets:
find_package(spdlog CONFIG REQUIRED)
target_link_libraries(main PRIVATE spdlog::spdlog spdlog::spdlog_header_only)
Did it install the correct version for pc-ble-driver compatibility? Or is there something else that might be going wrong?