4

节约时间,修改后的tree版本传送门,https://github.com/feilongfl/tree-for-fuchsia

高高兴兴的把tree下载下来发现根本不能用:)

从 http://mama.indstate.edu/users/ice/tree/ 下载最新(2019.3.4)版本1.8 放在//zircon/system/uapp/tree下,并在uapp下的BUILD.gn添加tree,在tree目录下建立编译文件,忽略各种warrning,然后改掉tree里面各种空括号函数()=>(void)

# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config("tree_config") {
  cflags = [
    "-Wno-discarded-qualifiers",
    "-Wno-implicit-fallthrough",
    "-Wno-sign-compare",
    "-Wno-unused-but-set-parameter",
    "-Wno-incompatible-pointer-types"
  ]
}

executable("tree") {
  configs += [ ":tree_config" ]

  sources = [
    "color.c",
    "hash.c",
    "json.c",
    "tree.c",
    "unix.c",
    "file.c",
    "html.c",
    "strverscmp.c",
    "tree.h",
    "xml.c",
  ]
}

开始编译…….顺利通过,高高兴兴在系统中打开tree命令,顺利的看到崩溃堆栈(手动滑稽),什么鬼…

今天(2019.3.4)太晚了,随手搞搞,先开个坑

开始查坑

首先早上(2019.3.5)起来先写了个helloworld试试水,毕竟这才是正路啊~~

# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

executable("i2c") {
  sources = [
    "i2c.c",
  ]
  deps = [
    "$zx/system/fidl/fuchsia-hardware-i2c:c",
    "$zx/system/ulib/fdio",
    "$zx/system/ulib/zircon",
  ]
}


所以说c语言helloworld我还是能不调试一次写成功的(笑)

这样的话问题就比较清晰了,之前的tree命令没有依赖项。使用输入输出必须添加fdio依赖

google对fdio的说明

FDIO是一个客户端库,它通过紫红色系统接口中的底层fuchsia.io协议提供类似POSIX的抽象。FDIO is a client library that provides a POSIX-like abstraction over the underlying fuchsia.io protocol in the Fuchsia System Interface.

解决tree

添加fdio依赖即可运行(我已经修正github仓库)

# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config("tree_config") {
  cflags = [
    "-Wno-discarded-qualifiers",
    "-Wno-implicit-fallthrough",
    "-Wno-sign-compare",
    "-Wno-unused-but-set-parameter",
    "-Wno-incompatible-pointer-types"
  ]
}

executable("tree") {
  configs += [ ":tree_config" ]

  sources = [
    "color.c",
    "hash.c",
    "json.c",
    "tree.c",
    "unix.c",
    "file.c",
    "html.c",
    "strverscmp.c",
    "tree.h",
    "xml.c",
  ]

  deps = [
    "$zx/system/ulib/fdio",
  ]
}

然后就可以查看fuchsia里面到底是什么目录结构了

想直接查看的朋友移步 https://gist.github.com/feilongfl/1a0d564b85d4de3747af9820abcc82fd


Fuchsia OS 中文社区经授权转载,本文链接:这里;本文原作者:飞龙;原文链接:这里

Google 从苹果公司挖角 Mac 大佬,将负责把 Fuchsia 推向市场

Previous article

首个候选发布版本?Google Fuchsia 团队被发现构建了一个 RC 分支

Next article

You may also like

4 Comments

  1. 改掉tree里面各种空括号函数()=>(void)

    加 “-Wno-strict-prototypes” 就不用修改源碼了

    1. 我试着加过,但是看到最后的编译命令在最后又被加上了 -Werror-strict..... 这个参数,由于我当时没有细看build脚本,所以我不知道最后的参数是在哪一部加上的。

      1. -Wstrict-prototypes 應該是在 cflags_c 加進去的,所以在 BUILD.gn 要改 cflags_c 而不是 cflags 才能把設定改掉。

        1. 感谢回复,学习了

Leave a reply

您的邮箱地址不会被公开。 必填项已用 * 标注

More in 开发