← Back to Skills Marketplace
chunhualiao

Build ROSE tools using a container

by Chunhua Liao · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
819
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install rose-container-tools
Description
Build and run ROSE compiler tools using ROSE installed in a Docker container. Use when developing source-to-source translators, call graph analyzers, AST processors, or any tool that links against librose.so. Triggers on "ROSE tool", "callgraph", "AST traversal", "source-to-source", "build with ROSE", "librose".
README (SKILL.md)

ROSE Container Tools

Build and run ROSE-based source code analysis tools using ROSE installed in a container.

⚠️ ALWAYS Use Makefile

Never use ad-hoc scripts or command-line compilation for ROSE tools.

  • Use Makefile for all builds
  • Enables make -j parallelism
  • Ensures consistent flags
  • Supports make check for testing

Why Container?

ROSE requires GCC 7-10 and specific Boost versions. Most modern hosts don't have these. The container provides:

  • Pre-installed ROSE at /rose/install
  • Correct compiler toolchain
  • All dependencies configured

Quick Start

1. Start the Container

# If container exists
docker start rose-tools-dev
docker exec -it rose-tools-dev bash

# Or create new container
docker run -it --name rose-tools-dev \
  -v /home/liao/rose-install:/rose/install:ro \
  -v $(pwd):/work \
  -w /work \
  rose-dev:latest bash

2. Build with Makefile

Always use Makefile to build ROSE tools. Never use ad-hoc scripts.

# Inside container
make        # Build all tools
make check  # Build and test

3. Run the Tool

./build/my_tool -c input.c

Makefile (Required)

Create Makefile for your tool:

ROSE_INSTALL = /rose/install

CXX      = g++
CXXFLAGS = -std=c++14 -Wall -g -I$(ROSE_INSTALL)/include/rose
LDFLAGS  = -L$(ROSE_INSTALL)/lib -Wl,-rpath,$(ROSE_INSTALL)/lib
LIBS     = -lrose

BUILDDIR = build
SOURCES  = $(wildcard tools/*.cpp)
TOOLS    = $(patsubst tools/%.cpp,$(BUILDDIR)/%,$(SOURCES))

.PHONY: all clean check

all: $(TOOLS)

$(BUILDDIR)/%: tools/%.cpp
	@mkdir -p $(BUILDDIR)
	$(CXX) $(CXXFLAGS) $\x3C -o $@ $(LDFLAGS) $(LIBS)

check: all
	@for tool in $(TOOLS); do \
		echo "Testing $$tool..."; \
		LD_LIBRARY_PATH=$(ROSE_INSTALL)/lib $$tool -c tests/hello.c; \
	done

clean:
	rm -rf $(BUILDDIR)

Example: Identity Translator

Minimal ROSE tool that parses and unparses code:

// tools/identity.cpp
#include "rose.h"

int main(int argc, char* argv[]) {
    SgProject* project = frontend(argc, argv);
    if (!project) return 1;
    
    AstTests::runAllTests(project);
    return backend(project);
}

Build and run:

make
./build/identity -c tests/hello.c
# Output: rose_hello.c (unparsed)

Example: Call Graph Generator

// tools/callgraph.cpp
#include "rose.h"
#include \x3CCallGraph.h>

int main(int argc, char* argv[]) {
    ROSE_INITIALIZE;
    SgProject* project = new SgProject(argc, argv);
    
    CallGraphBuilder builder(project);
    builder.buildCallGraph();
    
    AstDOTGeneration dotgen;
    dotgen.writeIncidenceGraphToDOTFile(
        builder.getGraph(), "callgraph.dot");
    
    return 0;
}

Example: AST Node Counter

// tools/ast_stats.cpp
#include "rose.h"
#include \x3Cmap>

class NodeCounter : public AstSimpleProcessing {
public:
    std::map\x3Cstd::string, int> counts;
    
    void visit(SgNode* node) override {
        if (node) counts[node->class_name()]++;
    }
};

int main(int argc, char* argv[]) {
    SgProject* project = frontend(argc, argv);
    
    NodeCounter counter;
    counter.traverseInputFiles(project, preorder);
    
    for (auto& [name, count] : counter.counts)
        std::cout \x3C\x3C name \x3C\x3C ": " \x3C\x3C count \x3C\x3C "\
";
    
    return 0;
}

Common ROSE Headers

Header Purpose
rose.h Main header (includes most things)
CallGraph.h Call graph construction
AstDOTGeneration.h DOT output for AST/graphs
sageInterface.h AST manipulation utilities

AST Traversal Patterns

Simple Traversal (preorder/postorder)

class MyTraversal : public AstSimpleProcessing {
    void visit(SgNode* node) override {
        // Process each node
    }
};

MyTraversal t;
t.traverseInputFiles(project, preorder);

Top-Down with Inherited Attributes

class MyTraversal : public AstTopDownProcessing\x3Cint> {
    int evaluateInheritedAttribute(SgNode* node, int depth) override {
        return depth + 1;  // Pass to children
    }
};

Bottom-Up with Synthesized Attributes

class MyTraversal : public AstBottomUpProcessing\x3Cint> {
    int evaluateSynthesizedAttribute(SgNode* node, 
        SynthesizedAttributesList childAttrs) override {
        int sum = 0;
        for (auto& attr : childAttrs) sum += attr;
        return sum + 1;  // Return to parent
    }
};

Testing in Container

# Run from host
docker exec -w /work rose-tools-dev make check

# Or interactively
docker exec -it rose-tools-dev bash
cd /work
make && make check

Troubleshooting

"rose.h not found"

# Check include path
echo $ROSE/include/rose
ls $ROSE/include/rose/rose.h

"cannot find -lrose"

# Check library path
ls $ROSE/lib/librose.so

Runtime: "librose.so not found"

# Set library path
export LD_LIBRARY_PATH=$ROSE/lib:$LD_LIBRARY_PATH

Segfault on large files

# Increase stack size
ulimit -s unlimited

Container Reference

Path Contents
/rose/install ROSE installation (headers, libs, bins)
/rose/install/include/rose Header files
/rose/install/lib librose.so and dependencies
/rose/install/bin ROSE tools (identityTranslator, etc.)
/work Mounted workspace (your code)
Usage Guidance
This skill appears to be a set of instructions for using a Docker image to build ROSE-based tools, but there are inconsistencies you should resolve before running anything: - Confirm you have Docker installed; the skill does not declare this but the commands require it. Install and test 'docker' locally first. - The image name 'rose-dev:latest' is unspecified (no registry or digest). Only run/pull container images from a trusted registry or use an explicit image digest, or build the image locally from a trusted Dockerfile. - The example mounts a host path '/home/liao/rose-install' — replace this with your actual path. Avoid mounting sensitive host directories into containers and prefer read-only mounts where possible. - The SKILL.md refers to $ROSE in troubleshooting but the Makefile uses ROSE_INSTALL=/rose/install. Decide which variable you will actually use and set it explicitly when running the container to avoid confusion. - Be cautious about running containers as root or with elevated privileges; consider running with reduced capabilities, a user mapping, or appropriate security flags (e.g., --security-opt, --cap-drop) if the image is untrusted. - The instruction to set ulimit -s unlimited can impact the host; only do this if you understand the implications. If you cannot verify the origin of the 'rose-dev:latest' image or prefer tighter control, obtain/build the container image from a trusted source (or inspect its Dockerfile) and update the skill instructions to declare Docker as a required binary and to use explicit, non-host-specific paths and environment variables.
Capability Analysis
Type: OpenClaw Skill Name: rose-container-tools Version: 1.0.0 The skill bundle provides instructions and example code for building and running ROSE compiler tools within a Docker container. All commands, including `docker run`, `docker exec`, and the provided `Makefile` content, are standard for setting up a development environment and compiling C++ code. There is no evidence of prompt injection attempts against the AI agent, data exfiltration, persistence mechanisms, or other malicious payloads. The skill's functionality is clearly aligned with its stated purpose.
Capability Assessment
Purpose & Capability
The skill's purpose (build/run ROSE tools in a container) is plausible, but the metadata declares no required binaries while the runtime instructions clearly require Docker (docker run/exec/start). Example commands also mount a hard-coded host path (/home/liao/rose-install) which is host-specific and surprising for a general skill. The skill should have declared Docker and clarified how the 'rose-dev:latest' image is obtained.
Instruction Scope
SKILL.md instructs the agent/user to run Docker containers, mount host directories (including a hard-coded /home/liao path), run make, set LD_LIBRARY_PATH/ulimit, and exec into containers. It also references an environment variable $ROSE in troubleshooting that is never defined elsewhere (Makefile uses ROSE_INSTALL=/rose/install). The instructions therefore reference host paths and env vars beyond what the skill declares and give the agent implicit permission to mount host files into a container.
Install Mechanism
This is an instruction-only skill (no install spec), which minimizes on-disk installs. However it relies on a container image named 'rose-dev:latest' with no source or registry referenced — pulling or running that image could execute arbitrary code. The lack of an install spec is low-risk by itself but combined with an unspecified image is a noteworthy gap.
Credentials
The skill declares no required environment variables or credentials, which fits a local build helper. Still, the instructions reference $ROSE and suggest exporting LD_LIBRARY_PATH and using ulimit; those env/path manipulations are reasonable for native builds but the use of an undefined $ROSE variable and the hard-coded host mount path are incongruent with the declared requirements.
Persistence & Privilege
The skill does not request persistent presence (always:false) and it is instruction-only, so it does not attempt to modify other skills or agent-wide configuration. Autonomous invocation is allowed by default but not combined with broad credential access here.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install rose-container-tools
  3. After installation, invoke the skill by name or use /rose-container-tools
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of rose-container-tools. - Provides a Docker-based environment with ROSE and all dependencies pre-installed. - Requires Makefile-based builds for consistency, parallelism, and testing. - Includes sample Makefile and example ROSE tools (identity translator, call graph generator, AST node counter). - Offers troubleshooting guidance and container usage instructions. - Documents common ROSE AST traversal patterns and headers.
Metadata
Slug rose-container-tools
Version 1.0.0
License
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Build ROSE tools using a container?

Build and run ROSE compiler tools using ROSE installed in a Docker container. Use when developing source-to-source translators, call graph analyzers, AST processors, or any tool that links against librose.so. Triggers on "ROSE tool", "callgraph", "AST traversal", "source-to-source", "build with ROSE", "librose". It is an AI Agent Skill for Claude Code / OpenClaw, with 819 downloads so far.

How do I install Build ROSE tools using a container?

Run "/install rose-container-tools" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Build ROSE tools using a container free?

Yes, Build ROSE tools using a container is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Build ROSE tools using a container support?

Build ROSE tools using a container is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Build ROSE tools using a container?

It is built and maintained by Chunhua Liao (@chunhualiao); the current version is v1.0.0.

💬 Comments