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

Could not compile & run. #317

Closed
0400H opened this issue Jun 10, 2022 · 17 comments
Closed

Could not compile & run. #317

0400H opened this issue Jun 10, 2022 · 17 comments

Comments

@0400H
Copy link
Contributor

0400H commented Jun 10, 2022

Env:

Ubuntu18.04 docker
rustc 1.60.0-nightly (5e57faa78 2022-01-19)
commit fd67f173df1404fb805818e41ca97898deedb0c1


Run zcore in linux-libos mode

step 2: Compile & Run native Linux program (Busybox) in libos mode:
cargo run --release --features "linux libos" -- /bin/busybox [args]

type

cargo run --release --features "linux libos" -- /bin/busybox ls

get

error: none of the selected packages contains these features: libos, linux

Run Linux shell in linux-bare-metal mode

step 2: Create Linux rootfs image:
Note: Before below step, you can add some special apps in zCore/rootfs
make image

type

make image

get

cargo image --arch x86_64
warning: unused import: `ffi::OsStr`
 --> xtask/src/linux/opencv.rs:7:5
  |
7 |     ffi::OsStr,
  |     ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `xtask` (bin "xtask") generated 1 warning
    Finished release [optimized + debuginfo] target(s) in 0.12s
     Running `target/release/xtask image --arch x86_64`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', xtask/src/command/mod.rs:50:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@0400H
Copy link
Contributor Author

0400H commented Jun 10, 2022

Fix README.md or code errors?
Provide a dev docker image for developer?
Provide some git tag for stable git commit?

@YdrMaster
Copy link
Collaborator

先试试 qemu?cargo qemu --arch riscv64 或者 cargo qemu --arch aarch64 肯定可以(当然,需要先安装 qemu)。目前 libos 主要用来单元测试,启动接 bash 还需要整理。
可以看这个文档(注意 make setup)。

@YdrMaster
Copy link
Collaborator

YdrMaster commented Jun 13, 2022

Run zcore in linux-libos mode

step 2: Compile & Run native Linux program (Busybox) in libos mode:
cargo run --release --features "linux libos" -- /bin/busybox [args]

type

cargo run --release --features "linux libos" -- /bin/busybox ls

get

error: none of the selected packages contains these features: libos, linux

Run Linux shell in linux-bare-metal mode

step 2: Create Linux rootfs image:
Note: Before below step, you can add some special apps in zCore/rootfs
make image

type

make image

get

cargo image --arch x86_64
warning: unused import: `ffi::OsStr`
 --> xtask/src/linux/opencv.rs:7:5
  |
7 |     ffi::OsStr,
  |     ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: `xtask` (bin "xtask") generated 1 warning
    Finished release [optimized + debuginfo] target(s) in 0.12s
     Running `target/release/xtask image --arch x86_64`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', xtask/src/command/mod.rs:50:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

libos 模式需要 cd zCorecargo run --release --features "linux libos" -- /bin/busybox [args]。并且是跑完就完了,不能交互。

@YdrMaster
Copy link
Collaborator

YdrMaster commented Jun 13, 2022

提交了一个 pr #322 支持在顶层以 cargo linux-libos --args <args> 方式启动,例如 `cargo linux-libos --args /bin/busybox

@0400H
Copy link
Contributor Author

0400H commented Jun 13, 2022

先试试 qemu?cargo qemu --arch riscv64 或者 cargo qemu --arch aarch64 肯定可以(当然,需要先安装 qemu)。目前 libos 主要用来单元测试,启动接 bash 还需要整理。 可以看这个文档(注意 make setup)。

目前还没有尝试去配置QEMU环境和执行(没找到说明文档).
看过这个文档,但是LibOS模式还是不能编译,能提供一个commit吗?
对于LibOS模式建议使用容器来标准化开发环境,也方便测试。
以后定期打Tag可能比较方便Checkout。

@YdrMaster
Copy link
Collaborator

YdrMaster commented Jun 13, 2022

先试试 qemu?cargo qemu --arch riscv64 或者 cargo qemu --arch aarch64 肯定可以(当然,需要先安装 qemu)。目前 libos 主要用来单元测试,启动接 bash 还需要整理。 可以看这个文档(注意 make setup)。

目前还没有尝试去配置QEMU环境和执行(没找到说明文档). 看过这个文档,但是LibOS模式还是不能编译,能提供一个commit吗? 对于LibOS模式建议使用容器来标准化开发环境,也方便测试。 以后定期打Tag可能比较方便Checkout。

等明天 pr #322 合了再试试吧。libos 就是为了直接跑,什么都不用配才做的,qemu 实际也很方便了。

  1. 下载,建议 7.0.0,不能早于 6.1.0
  2. 安装
    tar xf qemu.tar.xz
    cd qemu
    ./configure --target-list=x86_64-softmmu,riscv64-softmmu,aarch64-softmmu
    make -j
    sudo make install
    configure 的时候可能会报缺依赖,看 rcore-Tutorial 文档 就能解决。

qemu 安装好之后就可以 cargo qemu --arch riscv64 了。

@0400H
Copy link
Contributor Author

0400H commented Jun 21, 2022

先试试 qemu?cargo qemu --arch riscv64 或者 cargo qemu --arch aarch64 肯定可以(当然,需要先安装 qemu)。目前 libos 主要用来单元测试,启动接 bash 还需要整理。 可以看这个文档(注意 make setup)。

目前还没有尝试去配置QEMU环境和执行(没找到说明文档). 看过这个文档,但是LibOS模式还是不能编译,能提供一个commit吗? 对于LibOS模式建议使用容器来标准化开发环境,也方便测试。 以后定期打Tag可能比较方便Checkout。

等明天 pr #322 合了再试试吧。libos 就是为了直接跑,什么都不用配才做的,qemu 实际也很方便了。

  1. 下载,建议 7.0.0,不能早于 6.1.0

  2. 安装

    tar xf qemu.tar.xz
    cd qemu
    ./configure --target-list=x86_64-softmmu,riscv64-softmmu,aarch64-softmmu
    make -j
    sudo make install

    configure 的时候可能会报缺依赖,看 rcore-Tutorial 文档 就能解决。

qemu 安装好之后就可以 cargo qemu --arch riscv64 了。


重新 Open Issue?

还是无法编译&运行。


Commit 0c37bb3485040d825b2e8281f7016e8c98392ec9
Env ubuntu 18.04 docker

make rootfs

make rootfs error.log


是ubuntu 18.04问题?

还是建议使用docker标准化开发环境,这种事情几乎可以避免。

@YdrMaster
Copy link
Collaborator

YdrMaster commented Jun 22, 2022

是ubuntu 18.04问题?

可能是吧,busybox 不能编译。但是这个情况能编译大概率也不能运行。

还是建议使用docker标准化开发环境,这种事情几乎可以避免。

或许有时间你可以弄一个,眼下人手不太够。或许你可以先试一下 rCore-Tutorial,那个是教学用的,一般那个环境对了 zCore 也能对

@YdrMaster YdrMaster reopened this Jun 22, 2022
@0400H
Copy link
Contributor Author

0400H commented Jun 22, 2022

是ubuntu 18.04问题?

可能是吧,busybox 不能编译。但是这个情况能编译大概率也不能运行。

还是建议使用docker标准化开发环境,这种事情几乎可以避免。

或许有时间你可以弄一个,眼下人手不太够。或许你可以先试一下 rCore-Tutorial,那个是教学用的,一般那个环境对了 zCore 也能对

之后我尝试下Ubuntu 20.04,如果能成功编译运行的话,PR提供dockerfile是没有问题的.

@0400H
Copy link
Contributor Author

0400H commented Jun 22, 2022

PR332

基于此镜像和最新的文档,跑通了以下运行模式:

  1. Run Linux shell in linux-bare-metal mode
  2. Build and run zcore in zircon-bare-metal mode

@YdrMaster
Copy link
Collaborator

PR332

基于此镜像和最新的文档,跑通了以下运行模式:

  1. Run Linux shell in linux-bare-metal mode
  2. Build and run zcore in zircon-bare-metal mode

我看这也没什么特别的啊,按你提交的这个配置,系统改成 18 就不行了吗?难以理解。

@0400H
Copy link
Contributor Author

0400H commented Jun 23, 2022

PR332
基于此镜像和最新的文档,跑通了以下运行模式:

  1. Run Linux shell in linux-bare-metal mode
  2. Build and run zcore in zircon-bare-metal mode

我看这也没什么特别的啊,按你提交的这个配置,系统改成 18 就不行了吗?难以理解。

20.04和18.04版本都没能跑成LibOS mode,类似于最简单的Hello world,这个理应是依赖最少可以直接跑的。
20.04根据建议安装了QEMU,以上两种Mode可以跑。
18.04我没有去装QEMU,装了之后,以上两种Mode应该也能跑。

希望如果有时间的话,可以将根目录的README.md按照运行Mode的关联性,分离成各个子README.md
需要重复执行的指令不要节省,按照原样贴出,需要的依赖,按照运行的Mode分别在子README.md中提及就行了,现在看起来相当混乱。

@0400H
Copy link
Contributor Author

0400H commented Jun 23, 2022

PR332
基于此镜像和最新的文档,跑通了以下运行模式:

  1. Run Linux shell in linux-bare-metal mode
  2. Build and run zcore in zircon-bare-metal mode

我看这也没什么特别的啊,按你提交的这个配置,系统改成 18 就不行了吗?难以理解。

对于提PR有什么流程吗?PR332是按照常规流程走的,希望能够审阅Merge。
后续有时间可以提供贡献代码的标准流程README。

@0400H
Copy link
Contributor Author

0400H commented Jun 23, 2022

PR332
基于此镜像和最新的文档,跑通了以下运行模式:

  1. Run Linux shell in linux-bare-metal mode
  2. Build and run zcore in zircon-bare-metal mode

我看这也没什么特别的啊,按你提交的这个配置,系统改成 18 就不行了吗?难以理解。

cargo run --release --features "linux libos" -- /bin/busybox

这条LibOS的指令现在是有更新吗?从来没能执行成功过,一直返回

error: none of the selected packages contains these features: libos, linux

@YdrMaster
Copy link
Collaborator

之前发了 需要先 cd zCore。建议看一下我前面的回复。目前 README 已经过时,没有时间改。

@YdrMaster
Copy link
Collaborator

YdrMaster commented Jun 23, 2022

PR332
基于此镜像和最新的文档,跑通了以下运行模式:

  1. Run Linux shell in linux-bare-metal mode
  2. Build and run zcore in zircon-bare-metal mode

我看这也没什么特别的啊,按你提交的这个配置,系统改成 18 就不行了吗?难以理解。

20.04和18.04版本都没能跑成LibOS mode,类似于最简单的Hello world,这个理应是依赖最少可以直接跑的。 20.04根据建议安装了QEMU,以上两种Mode可以跑。 18.04我没有去装QEMU,装了之后,以上两种Mode应该也能跑。

希望如果有时间的话,可以将根目录的README.md按照运行Mode的关联性,分离成各个子README.md 需要重复执行的指令不要节省,按照原样贴出,需要的依赖,按照运行的Mode分别在子README.md中提及就行了,现在看起来相当混乱。

实际上你遇到的问题应该和系统没什么关系。后面发的那个 busybox 无法编译的问题不知道为什么,但理论上啊说也应该和系统无关。我试过 Ubuntu18/20/22 以及 Debian,团队也有人用其他发行版,只有 Ubuntu22 因为软件库还不全,无法运行 libc-test,其他都没有问题。

@YdrMaster
Copy link
Collaborator

PR332
基于此镜像和最新的文档,跑通了以下运行模式:

  1. Run Linux shell in linux-bare-metal mode
  2. Build and run zcore in zircon-bare-metal mode

我看这也没什么特别的啊,按你提交的这个配置,系统改成 18 就不行了吗?难以理解。

对于提PR有什么流程吗?PR332是按照常规流程走的,希望能够审阅Merge。 后续有时间可以提供贡献代码的标准流程README。

有人在看。

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

2 participants