Giter Club home page Giter Club logo

krte's Introduction

Introduction

KRTE (Kan's RunTime Environment) is a suite of glibc, gcc toolchain, and optionally a set of statically compiled libraries. The main goal of KRTE is to provide a bazel-friendly development/deployment cycle.

What makes KRTE special is it is installed at a fixed location (/opt/krte) and the binary it generates looks for libc under /opt/krte, and all other libraries are statically linked. There are several benefits for this:

  1. Bazel requires all third-party libraries being checked into the source tree, including the config.h generated by configure scripts and a manually written BUILD file. This is basically impractical for most third-party libraries as you have to be familiar with the library, to put the correct source files into cc_library, and to generate the correct config.h which is different under different platforms. By having a fixed toolchain, KRTE provides a reproduciable environment to generate the correct config.h;
    • KRTE comes with a growing set of pre-built third-party libraries so you don't even need to check in the libraries into source tree yourself;
  2. Binary generated by KRTE toolchain looks for libc under KRTE installation directory, which means if you compile the project on development machine and deploy to a production machine with KRTE installed, the binary will run properly. Of course, both development and production machine has to be Linux x86_64, which is the norm for most developers;
  3. Libraries come with KRTE are built with -flto -ffat-flto-objects, so they contain AST. This means:
    • The libraries are compiled with -fPIC, allowing them to be linked into dynamic libraries; on the other hand, when building binaries, non-PIC code will be regenerated from AST to provide better performance;
    • The libraries are compiled with -march=k8 to provide best compatibility; on the other hand, when building with -c opt, code will be regenerated to make use of instructions on build machine, together with whole program optimzation, to provide best performance.

Installation

  1. Install the KRTE: you need to create /opt/krte yourself and make sure it is writable to current user, then run ./install.sh, which will download the tarballs and unpack to it;
  2. Configure your bazel project:
    • Put the CROSSTOOL and BUILD into a directory you like (by either git submodule or git subtree) and build with --crosstool_top=//<directory>:toolchain;

    • Put the following lines in the WORKSPACE file so libraries will be available:

      local_repository(
          name = "third_party",
          path = "/opt/krte/libs",
      )

krte's People

Contributors

likan999 avatar

Watchers

 avatar  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.