1

有没有人能够为嵌入式 linux 设备单独编译氟化物蓝牙堆栈? https://android.googlesource.com/platform/system/bt/+/181144a50114c824cfe3cdfd695c11a074673a5e/README.md
有一个指南,但是按照这些说明失败,没有获取 common-mk 文件夹并修改一些构建文件,所以没有缺少变量、文件夹等。 我已经能够生成 Ninja 文件,但是在构建时,缺少 gtest 和 modp_b64 标头。从 Google 的源搜索中获取它们后,Ninja 似乎能够在没有错误的情况下运行一点,但最终失败了:gn gen


In file included from ../../third_party/libchrome/base/message_loop/message_loop.h:18:
../../third_party/libchrome/base/message_loop/message_loop_current.h:209:3: error: static_assert failed due to requirement 'std::is_same<MessagePumpForUI, MessagePumpLibevent>::value' "MessageLoopCurrentForUI::WatchFileDescriptor is not supported when MessagePumpForUI is not a MessagePumpLibevent."
  static_assert(std::is_same<MessagePumpForUI, MessagePumpLibevent>::value,
  ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/libchrome/base/message_loop/message_loop_current.h:214:28: error: no type named 'Mode' in 'base::MessagePumpGlib'; did you mean 'MessagePumpLibevent::Mode'?
                           MessagePumpForUI::Mode mode,
                           ^~~~~~~~~~~~~~~~~~~~~~
                           MessagePumpLibevent::Mode
../../third_party/libchrome/base/message_loop/watchable_io_message_pump_posix.h:55:8: note: 'MessagePumpLibevent::Mode' declared here
  enum Mode {
       ^
In file included from ../../third_party/libchrome/base/run_loop.cc:10:
In file included from ../../third_party/libchrome/base/message_loop/message_loop.h:18:
../../third_party/libchrome/base/message_loop/message_loop_current.h:215:28: error: no type named 'FdWatchController' in 'base::MessagePumpGlib'; did you mean 'MessagePumpLibevent::FdWatchController'?
                           MessagePumpForUI::FdWatchController* controller,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                           MessagePumpLibevent::FdWatchController
../../third_party/libchrome/base/message_loop/message_pump_libevent.h:28:9: note: 'MessagePumpLibevent::FdWatchController' declared here
  class FdWatchController : public FdWatchControllerInterface {
        ^
In file included from ../../third_party/libchrome/base/run_loop.cc:10:
In file included from ../../third_party/libchrome/base/message_loop/message_loop.h:18:
../../third_party/libchrome/base/message_loop/message_loop_current.h:216:28: error: no type named 'FdWatcher' in 'base::MessagePumpGlib'; did you mean 'MessagePumpLibevent::FdWatcher'?
                           MessagePumpForUI::FdWatcher* delegate);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                           MessagePumpLibevent::FdWatcher
../../third_party/libchrome/base/message_loop/watchable_io_message_pump_posix.h:17:9: note: 'MessagePumpLibevent::FdWatcher' declared here
  class FdWatcher {
        ^
4 errors generated.

所有错误和丢失的文件都来自third_party/libchrome
任何帮助将不胜感激。

4

2 回答 2

0

出现 common-mk 问题的原因是在编写指令和现在 libchrome 之间添加了一个BUILD.gn文件 - 因此正在使用它,而不是build/secondary/third-party/libchrome按预期使用替代文件。要修复这部分构建,只需删除third-party/libchrome/BUILD.gn- 应该可以防止需要大量构建摆弄。

第二部分是因为libchrome的配置。删除提到的文件后,您需要修改build/secondary/third-party/libchrome/BUILD.gn以将以下内容添加到 source_set(如在上游所做的那样)libchrome_config以及下游用户:

 defines = [
    "__ANDROID_HOST__=1",
 ]

这将影响构建配置,因此它不会尝试使用 glib。

我最好的工作就是在这里,虽然我还没有完全工作。https://github.com/rpavlik/fluoride我这样做主要是作为一个实验,请随时从我离开的地方继续。

于 2020-08-03T16:35:12.633 回答
0

我按照https://cs.android.com/android/platform/superproject/+/master:system/bt/README.md的说明进行操作

除了那里的说明之外,我还必须手动解决构建脚本中的问题。我能够在 Ubuntu 21.04 中成功编译蓝牙堆栈

  • 在构建文件中替换//bt为。/home/udara/fluoride/bt

使用sed的命令。根据需要切换到您的氟化物目录。

for file in $(grep -r -l "//bt"); do sed -i 's/\/\/bt/\/home\/udara\/fluoride\/bt/g' $file; done
  • common-mk将生成的符号链接复制bootstrap.py到 fluoride 目录。
  • 并替换//common-mk/home/udara/fluoride/common-mk.
for file in $(grep -r -l "//common-mk"); do sed -i 's/\/\/common-mk/\/home\/udara\/fluoride\/common-mk/g' $file; done
  • 安装了一些缺少的依赖项
sudo apt install llvm
sudo apt install libc++abi-dev
  • 复制/home/udara/fluoride/bt/output/out/Default/gen/ABS_PATH/home/udara/fluoride/bt/gd/dumpsys/bundler/bundler_generated.h/home/udara/fluoride/bt/gd/dumpsys/
cp /home/udara/fluoride/bt/output/out/Default/gen/ABS_PATH/home/udara/fluoride/bt/gd/dumpsys/bundler/bundler_generated.h /home/udara/fluoride/bt/gd/dumpsys/
  • 创建目录中命名outputbt目录。
  • 设置环境变量
# this is set by bootstrap.py
export STAGING_DIR=/home/udara/fluoride/staging

# you have to manually set this
export OUTPUT_DIR=/home/udara/fluoride/bt/output
  • 然后编译蓝牙堆栈
./build.py --output ${OUTPUT_DIR} --platform-dir ${STAGING_DIR} --clang
  • 将以下行添加到/etc/dbus-1/system.d/bluetooth.conf
<policy>
    ...
    <allow own="org.chromium.bluetooth"/>
    <allow own="org.chromium.bluetooth.Manager"/>
</policy>
  • 最后运行氟化物
cd /home/udara/fluoride/bt/output/debug
sudo ./btadapterd --hci=0 INIT_gd_hci=true
于 2021-07-28T06:13:33.533 回答