← 返回 Skills 市场
chunhualiao

Rose Docker Build

作者 Chunhua Liao · GitHub ↗ · v0.1.1
cross-platform ✓ 安全检测通过
1311
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install rose-docker-build-skill
功能描述
Build the ROSE compiler in a Docker container using autotools or CMake. Use when setting up ROSE development environment, building ROSE from source, or troubleshooting ROSE build issues. ROSE requires GCC 7-10 which most modern hosts don't have, so Docker is the recommended approach.
使用说明 (SKILL.md)

ROSE Docker Build

Build the ROSE source-to-source compiler in an isolated Docker container.

Why Docker?

ROSE requires GCC 7-10. Modern systems have GCC 11+, causing build failures. Docker provides:

  • Correct GCC version (9.x recommended)
  • All dependencies pre-installed
  • Reproducible builds
  • Edit on host, build in container

Quick Start (Autotools)

# 1. Clone ROSE
git clone [email protected]:rose-compiler/rose.git
cd rose && git checkout weekly

# 2. Create Docker environment
mkdir ../rose-docker && cd ../rose-docker

# 3. Build and run container (see Dockerfile below)
docker build -t rose-dev .
docker run -d --name rose-dev -v $(pwd)/../rose:/rose/src rose-dev

# 4. Build ROSE inside container
docker exec rose-dev bash -c 'cd /rose/src && ./build'
docker exec rose-dev bash -c 'mkdir -p /rose/build && cd /rose/build && \
  /rose/src/configure --prefix=/rose/install \
    --enable-languages=c,c++ \
    --with-boost=/usr \
    --with-boost-libdir=/usr/lib/x86_64-linux-gnu \
    --disable-binary-analysis \
    --disable-java'
docker exec rose-dev bash -c 'cd /rose/build && make core -j$(nproc)'
docker exec rose-dev bash -c 'cd /rose/build && make install-core'

Quick Start (CMake)

CMake builds require CMake 4.x (3.16 fails at ROSETTA generation).

# 1. Clone ROSE
git clone [email protected]:rose-compiler/rose.git
cd rose && git checkout weekly

# 2. Create Docker environment and build container
mkdir ../rose-docker && cd ../rose-docker
docker build -t rose-dev -f Dockerfile.cmake .
docker run -d --name rose-cmake -v $(pwd)/../rose:/rose/src:ro rose-dev

# 3. Configure with CMake
docker exec -w /rose/build rose-cmake cmake /rose/src \
  -DCMAKE_INSTALL_PREFIX=/rose/install \
  -DENABLE_C=ON \
  -DENABLE_TESTS=OFF \
  -DCMAKE_BUILD_TYPE=Release

# 4. Build (use -j4 to avoid OOM on 16GB systems)
docker exec -w /rose/build rose-cmake make -j4

# 5. Test
docker exec rose-cmake /rose/build/bin/rose-compiler --version

CMake Options

Option Description
ENABLE_C=ON Enable C/C++ analysis (uses EDG frontend)
ENABLE_BINARY_ANALYSIS=ON Enable binary analysis (no EDG needed)
ENABLE_TESTS=OFF Skip test compilation (faster build)
CMAKE_BUILD_TYPE=Release Optimized build

CMake vs Autotools

Feature Autotools CMake
Stability ✅ Mature ⚠️ Newer
C/C++ analysis ✅ Works ✅ Works (with fixes)
Build target make core make (full build)
Incremental builds Slower Faster
IDE integration Limited Excellent

Dockerfiles

Dockerfile (Autotools)

FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles

RUN apt-get update && apt-get install -y \
    build-essential g++ gcc gfortran \
    automake autoconf libtool flex bison \
    libboost-all-dev libxml2-dev \
    git wget curl vim \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -m -s /bin/bash developer
RUN mkdir -p /rose/src /rose/build /rose/install && chown -R developer:developer /rose
USER developer
WORKDIR /rose
CMD ["tail", "-f", "/dev/null"]

Dockerfile.cmake (CMake)

FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/Los_Angeles

# Install build dependencies
RUN apt-get update && apt-get install -y \
    build-essential g++ gcc gfortran \
    flex bison \
    libboost-all-dev libxml2-dev libreadline-dev \
    zlib1g-dev libsqlite3-dev libpq-dev libyaml-dev \
    libgmp-dev libmpc-dev libmpfr-dev \
    git wget curl vim \
    gnupg software-properties-common \
    && rm -rf /var/lib/apt/lists/*

# Install CMake 4.x from Kitware (Ubuntu 20.04 has 3.16 which is too old)
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - \
    && echo 'deb https://apt.kitware.com/ubuntu/ focal main' > /etc/apt/sources.list.d/kitware.list \
    && apt-get update && apt-get install -y cmake \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -m -s /bin/bash developer
RUN mkdir -p /rose/src /rose/build /rose/install && chown -R developer:developer /rose
USER developer
WORKDIR /rose
CMD ["tail", "-f", "/dev/null"]

EDG Binary Handling

EDG (C++ frontend) binaries are required for C/C++ analysis. The build checks:

Autotools

  1. Build directory for existing tarball
  2. Source tree at src/frontend/CxxFrontend/roseBinaryEDG-*.tar.gz
  3. Network download from edg-binaries.rosecompiler.org

CMake

  1. Source tree at src/frontend/CxxFrontend/roseBinaryEDG-*.tar.gz (auto-detected)
  2. Extracts matching tarball based on GCC version at build time
  3. Links libroseEDG.a to librose.so automatically

If server is down, ensure source tree has EDG binaries (included in weekly branch).

Common Commands

Autotools

# Rebuild after source changes
docker exec rose-dev bash -c 'cd /rose/build && make core -j8'

# Install
docker exec rose-dev bash -c 'cd /rose/build && make install-core'

CMake

# Rebuild after source changes  
docker exec -w /rose/build rose-cmake make -j4

# Install
docker exec -w /rose/build rose-cmake make install

Both

# Test ROSE compiler
docker exec rose-dev /rose/install/bin/rose-compiler --version
docker exec rose-cmake /rose/build/bin/rose-compiler --version

# Source-to-source test
docker exec rose-dev bash -c 'echo "int main(){return 0;}" > /tmp/test.c && \
  /rose/install/bin/rose-compiler -c /tmp/test.c && cat rose_test.c'

# Enter container shell
docker exec -it rose-dev bash
docker exec -it rose-cmake bash

Build Time

Build System First Build Incremental
Autotools (make core -j8) ~60-90 min seconds-minutes
CMake (make -j4) ~35 min seconds-minutes
  • librose.so: ~200 MB (CMake) to ~1.3 GB (autotools with debug)
  • Memory: Use -j4 on 16GB systems to avoid OOM

Troubleshooting

Issue Solution
EDG download fails Use weekly branch (has EDG binaries in source tree)
CMake: ROSETTA fails Upgrade to CMake 4.x
CMake: EDG link errors Ensure using latest CMake fixes (PR #250)
CMake: quadmath errors Add -lquadmath or use latest fixes
Permission denied Check volume mount permissions
Out of memory Reduce -j parallelism
Boost not found Verify boost paths in configure/cmake

Testing with Sample Code

# Create factorial test
cat \x3C\x3C 'EOF' | docker exec -i rose-cmake tee /tmp/factorial.cpp
#include \x3Ciostream>
int factorial(int n) { return n \x3C= 1 ? 1 : n * factorial(n-1); }
int main() {
    for(int i = 0; i \x3C= 10; i++)
        std::cout \x3C\x3C "factorial(" \x3C\x3C i \x3C\x3C ") = " \x3C\x3C factorial(i) \x3C\x3C std::endl;
    return 0;
}
EOF

# Run through ROSE (source-to-source transformation)
docker exec -w /tmp rose-cmake /rose/build/bin/rose-compiler factorial.cpp

# Compile and run the transformed code
docker exec -w /tmp rose-cmake g++ rose_factorial.cpp -o factorial_test
docker exec -w /tmp rose-cmake ./factorial_test

Expected output:

factorial(0) = 1
factorial(1) = 1
...
factorial(10) = 3628800
安全使用建议
This appears to be a coherent, developer-focused Docker build guide. Before running anything: - Inspect the Dockerfiles included in the SKILL.md (they are shown inline) to ensure you are comfortable with the apt packages and added repo. - Be aware the CMake Dockerfile adds Kitware's apt repo by piping a remote key to apt-key add; verify the key URL and consider alternatives if you prefer not to add external repos. - The workflow mounts your local source directory into the container (docker -v); only mount trusted code and check for sensitive files in the directory before mounting. - The git clone uses an SSH URL ([email protected]...), so it will use your SSH keys if you run those steps; ensure you understand which keys are used and whether the repository is public/private. - The build may download EDG binaries from edg-binaries.rosecompiler.org; verify that server if you need to trust its contents. If you prefer, fetch and vet EDG tarballs yourself and place them in the source tree before building. - Run the build steps manually rather than automating unseen commands, and monitor resource usage (compilation is heavy).
功能分析
Type: OpenClaw Skill Name: rose-docker-build-skill Version: 0.1.1 The skill is designed to build the ROSE compiler within a Docker container. All instructions and Dockerfile contents are aligned with this stated purpose, involving standard build tools, legitimate dependency fetching (e.g., CMake from Kitware, EDG binaries from edg-binaries.rosecompiler.org), and Docker commands. There is no evidence of data exfiltration, malicious execution, persistence mechanisms, prompt injection attempts against the agent, or obfuscation. The external network calls are for acquiring necessary build components from seemingly legitimate sources related to the ROSE compiler project.
能力评估
Purpose & Capability
Name and description match the SKILL.md: all instructions, Dockerfiles, and commands are focused on building the ROSE compiler in containers. Required binaries/env/credentials are correctly minimal (none declared), which aligns with an instruction-only, developer-focused build guide.
Instruction Scope
Instructions stay within build/setup scope (git clone, docker build/run, docker exec). Two actionable items to be aware of: the workflow mounts a host source directory into containers (expected for edit-on-host builds) and may download EDG binaries from edg-binaries.rosecompiler.org if not present in the source tree. These are normal for this developer workflow but worth reviewing before running.
Install Mechanism
The skill is instruction-only (no install spec). Dockerfiles in the instructions install packages via apt-get and (for CMake) add Kitware's apt repository by piping a remote key into apt-key add. This is standard for obtaining newer CMake but does involve adding an external apt repo and network fetches inside the image—inspect the Dockerfile and upstream URLs before use.
Credentials
No environment variables, credentials, or config paths are requested by the skill. The SSH-style git clone ([email protected]:...) implies the user must have their own SSH key configured, which is expected for cloning private repos via SSH.
Persistence & Privilege
Skill is instruction-only, has no install actions, and is not set to always:true. It does not request elevated or persistent platform privileges beyond normal Docker usage by the user.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install rose-docker-build-skill
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /rose-docker-build-skill 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.1
- Added full support and documentation for both Autotools and CMake-based Docker builds of ROSE, including step-by-step instructions and troubleshooting. - Introduced a new Dockerfile.cmake with instructions to install CMake 4.x required for CMake builds. - Expanded Quick Start section to separately detail build and usage steps for Autotools and CMake. - Added comparison table between Autotools and CMake workflows, clarifying key differences. - Improved guidance on EDG binary handling and troubleshooting for both build systems. - Removed legacy script references (references/build-rose.sh, references/docker-compose.yml) from the project.
v0.1.0
Initial release. Provides Docker environment for building the ROSE compiler. - Offers a ready-to-use Dockerfile targeting Ubuntu 20.04 with all required dependencies. - Guides on mounting the ROSE source and running all build steps inside the container. - Handles GCC version constraints and binary requirements for successful ROSE builds. - Includes troubleshooting tips and common Docker operation commands.
元数据
Slug rose-docker-build-skill
版本 0.1.1
许可证
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Rose Docker Build 是什么?

Build the ROSE compiler in a Docker container using autotools or CMake. Use when setting up ROSE development environment, building ROSE from source, or troubleshooting ROSE build issues. ROSE requires GCC 7-10 which most modern hosts don't have, so Docker is the recommended approach. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1311 次。

如何安装 Rose Docker Build?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install rose-docker-build-skill」即可一键安装,无需额外配置。

Rose Docker Build 是免费的吗?

是的,Rose Docker Build 完全免费(开源免费),可自由下载、安装和使用。

Rose Docker Build 支持哪些平台?

Rose Docker Build 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Rose Docker Build?

由 Chunhua Liao(@chunhualiao)开发并维护,当前版本 v0.1.1。

💬 留言讨论