Git Product home page Git Product logo

cbc-ubuntu-64bit's Introduction

CbC - Cflat Compiler (the ubuntu 64bit version)

《自制编译器》一书中实现的cbc编译器的ubuntu64位版本。这个项目主要解决64位机器上无法正常编译和运行cbc的问题。

直接安装使用(在ubuntu 64位系统上)

安装依赖

注意:不同ubuntu发行版可能依赖库名称不一致。此处代码为ubuntu 16.04版本上的安装命令

apt-get update && apt-get install -y \
        gcc-multilib g++-multilib libc6-i386 lib32ncurses5 lib32stdc++6 \
        openjdk-8-jre \
        git

下载&安装cbc

git clone https://github.com/leungwensen/cbc-ubuntu-64bit.git
cd cbc-ubuntu-64bit && ./install.sh

使用

和原始的cbc不同,在64位系统里需要增加-Wa,"--32" -Wl,"-melf_i386"执行参数。

cbc -Wa,"--32" -Wl,"-melf_i386" test/hello.cb
./hello
> Hello, World!

使用docker镜像(在任意64位宿主环境上)

大致的原理就是基于ubuntu 16.04的64位系统构建了一个可供cbc编译、执行的环境。用户只需把打包好的镜像下载到本地就可以得到可执行的cbc,免去配置和编译cbc的麻烦。

安装docker:详见Docker 中文指南

启动docker daemon进程

eval $(docker-machine env default)
docker pull leungwensen/cbc-ubuntu-64bit

执行镜像

docker run -t -i leungwensen/cbc-ubuntu-64bit

执行cbc

镜像里的cbc命令为cbc -Wa,--32 -Wl,-melf_i386的别名,可以直接执行。

cbc cbc-ubuntu-64bit/test/hello.cb

共建/bug报告

有任何使用上的问题,可以搜索已有issue或者新建一个issue

更希望大家可以一起完善这个项目,给我提pull request

参考

cbc-ubuntu-64bit's People

Contributors

aamine avatar leungwensen avatar chenzl25 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.