# secc

> Distributed compiler with modern web technology

Latest version **0.2.112** (published 2016-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install secc
pnpm add secc
yarn add secc
bun add secc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.112 |
| Published | 2016-06-27 |
| First published | 2015-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Known vulnerabilities | 0 (+38 in 9 direct dependencies) |
| Install scripts | no |
| GitHub stars | 13 |
| Author | HoYong Jung |
| Maintainers | ivere27 |
| Keywords | secc, distcc, icecc, distributed, compiler, gcc, clang |

## Links

- npm: https://www.npmjs.com/package/secc
- Repository: https://github.com/ivere27/secc
- Homepage: https://github.com/ivere27/secc#readme
- Issues: https://github.com/ivere27/secc/issues
- npm.io page: https://npm.io/package/secc

## Dependencies (15)

- [ejs](https://npm.io/package/ejs.md) 2.3.4
- [tar](https://npm.io/package/tar.md) 2.2.1
- [async](https://npm.io/package/async.md) 1.4.2
- [debug](https://npm.io/package/debug.md) 2.2.0
- [redis](https://npm.io/package/redis.md) 2.0.1
- [mkdirp](https://npm.io/package/mkdirp.md) 0.5.1
- [morgan](https://npm.io/package/morgan.md) 1.6.1
- [multer](https://npm.io/package/multer.md) 1.0.3
- [express](https://npm.io/package/express.md) 4.13.3
- [form-data](https://npm.io/package/form-data.md) 1.0.0-rc3
- [socket.io](https://npm.io/package/socket.io.md) 1.3.6
- [tar-stream](https://npm.io/package/tar-stream.md) 1.2.1
- [body-parser](https://npm.io/package/body-parser.md) 1.13.3
- [compression](https://npm.io/package/compression.md) 1.5.2
- [socket.io-client](https://npm.io/package/socket.io-client.md) 1.3.6

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.2.112 (latest) — 2016-06-27
- 0.2.108 — 2016-06-14
- 0.2.97 — 2016-05-31
- 0.2.84 — 2016-05-17
- 0.2.71 — 2016-05-12
- 0.2.64 — 2016-05-10
- 0.2.58 — 2016-05-08
- 0.2.45 — 2016-04-23
- 0.2.36 — 2016-04-16
- 0.2.35 — 2016-04-06
- 0.2.26 — 2016-03-22
- 0.2.24 — 2016-03-22
- 0.2.22 — 2016-03-19
- 0.2.21 — 2016-03-18
- 0.2.10 — 2016-02-01
- … 19 more at https://npm.io/package/secc/versions

## README

# secc - Distributed compiler with modern web technology.

a project of 'Second Compiler'.

## Key Features

- RESTful API in Daemon/Scheduler
- Preprocessed and Pump Mode
- Memory Cache(works like remote Ccache)
- Debug fission(-gsplit-dwarf option) supports.
- Monitoring by Browser(Navigate to http://SCHEDULER:PORT)
- Cross-compile(Various version/machine of compiler in network) supports
- Gcc / Clang support

## Quick Start
  - [use DOCKER to start a scheduler and daemons](https://github.com/ivere27/secc/blob/master/doc/DOCKER.md)

## How to use

install by git clone (then npm install)

```sh
git clone https://github.com/ivere27/secc.git
cd secc
npm install
```

make sure you've already installed node.js, npm and (optionally) redis
* Ubuntu $ sudo apt-get install nodejs npm nodejs-legacy redis-server
* Mac $ brew install nodejs redis


### Client - your PC

set PATH and NUMBER_OF_PROCESSORS(-jX)
> edit "client" part in 'settings.json' file.
> set scheduler's address and port.
```sh
$ export PATH=/path/to/secc/bin:$PATH
$ export NUMBER_OF_PROCESSORS="8"
$ # then,
$ clang -c test.c
```
```

or just use CC, CXX and NUMBER_OF_PROCESSORS env
```sh
$ SECC_ADDRESS=172.17.42.1 SECC_CACHE=1 SECC_CROSS=0 \
CC=/path/to/secc/bin/clang CXX=/path/to/secc/bin/clang++ ./configure
$ SECC_ADDRESS=172.17.42.1 SECC_CACHE=1 SECC_CROSS=0 \
CC=/path/to/secc/bin/clang CXX=/path/to/secc/bin/clang++ make -j8
```

upload your compiler archive by ./tool/secc-upload-archive.js

```sh
$ # for clang
$ node secc-upload-archive.js --clang /path/to/clang /path/to/clang++ archivetool.js http://SCHEDULER:PORT
$ # for gcc
$ node secc-upload-archive.js --gcc /path/to/gcc /path/to/g++ archivetool.js http://SCHEDULER:PORT
```

in linux case(you can use the specific compiler version),

     node secc-upload-archive.js --gcc /usr/bin/gcc-5 /usr/bin/g++-5 ./secc-create-archive-linux.js http://172.17.42.1:10509

     node secc-upload-archive.js --clang /usr/bin/clang /usr/bin/clang++ ./secc-create-archive-linux.js http://172.17.42.1:10509


### Daemon - n PC

edit "daemon" part in 'settings.json' file.
set scheduler's address and port.

if you want to use cache, go #Caches section.

run 'node secc-daemon.js' as root for chroot-jail.

```sh
$ sudo DEBUG=secc* node secc-daemon.js
```

### Scheduler - 1 PC

```sh
$ DEBUG=secc* node secc-scheduler.js
```

## Modes

MODE 1 - Preprocessed Mode(default)
  send one preprocessed source to daemon. (cause CPU load)

MODE 2 - Pump Mode
  send headers and source to daemon. (cause Memory/Bandwidth load)

MODE 3 - Git Mode(not yet supported.)

## Debug

- DEBUG=* to watch every verbose logs.
- DEBUG=secc* to watch only SECC's log.
- SECC_LOG=/path/to/log.txt - redirect logs to a file

```sh
$ DEBUG=* SECC_MODE=1 SECC_CACHE=1 /path/to/secc/bin/gcc -c test.c
```

## Caches

install REDIS in a daemon computer. then,
enable "cache" in "daemon" part of 'settings.json' file.

## Environment Variable

| ENV                 | secc-client            | secc-daemon        | secc-scheduler |
| :-------------      | :---------------:      | :----------------: | :------------: |
| SECC_ADDRESS        | scheduler address      | scheduler address  | -              |
| SECC_PORT           | scheduler port         | scheduler port     | listening port |
| DEBUG               | log level              | log level          | log level      |
| SECC_LOG            | log file path          | log file path      | log file path  |
| SECC_CMDLINE        | log command line       | -                  | -              |
| SECC_MODE           | processed or pump      | -                  | -              |
| SECC_CACHE          | cache prefer           | cache enable       | -              |
| SECC_CROSS          | cross-compiling prefer | -                  | -              |
| SECC_CC             | c compiler path        | -                  | -              |
| SECC_CXX            | c++ compiler path      | -                  | -              |
| REDIS_ADDRESS       | -                      | redis address      | -              |
| REDIS_PORT          | -                      | redis port         | -              |
| SECC_EXPOSE_ADDRESS | -                      | address for client | -              |
| SECC_EXPOSE_PORT    | -                      | port for client    | -              |


## How It Works
* Scheduler - RESTful/WebSocket/Monitoring WebServer
* Daemon - RESTful WebServer + WebSocket Client + Cache Server(redis)
* Client - http client

- (once) Client uploads a Compiler Archive to Scheduler
- Scheduler and Daemons are connected by WebSocket
- Client asks to Scheduler which daemon is available by REST API
- (Optional) Client tries to get caches if possible
- Client sends a source or/and dependencies to a Daemon by REST API
- (once) Daemon downloads the archive from Scheduler if not exists
- Daemon compiles the sources by Client's Compiler Archive
- Daemon responds to Client with a object(+@)
- (Optional) Objects are stored in Daemon's MemoryDB(redis)

# License

MIT

---
_Source: https://npm.io/package/secc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
