bazelbuild / bazelbuild/reclient

How to use scandeps_server to auto-get the c/c++ includes

Open
#21 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
114
Forks
25
PR merge metrics
No merged PRs in 30d

Description

Hello everyone! I want to use reclient as an client and connect to buildfarm for remote execution.

- Start the reproxy:

```
./bootstrap -cfg=/path/to/reproxy.cfg
```
The reproxy.cfg is:
```
service=xx.xxx.xxx.xxx:xxx
server_address=unix:///tmp/reproxy.sock
instance=main
fail_early_min_action_count=4000
fail_early_min_fallback_ratio=0.5
service_no_security=true
service_no_auth=true
use_rpc_credentials=false
use_gce_credentials=false
use_application_default_credentials=false
output_dir=/path/to/out
proxy_log_dir=/path/to/out
```
- Wrap the gcc:

```makefile
CC=$(rewrapper_path) -cfg=$(rewrapper_cfg_path) gcc

CFLAGS=-I. -I/usr/lib/gcc/x86_64-linux-gnu/11/include
OBJ = hellomake.o hellofunc.o

%.o:%.c
$(CC) -c $(CFLAGS) -o $@ $<
hellomake: $(OBJ)
$(CC) -o $@ $^
```
The rewrapper.cfg is:
```
exec_strategy=remote
server_address=unix:///tmp/reproxy.sock
exec_root=/path/to/reclient_test
inputs=hellofunc.c,hellomake.c
output_files=hellofunc.o,hellomake.o
download_outputs=true
```
I hope that the scandeps_server in the same directory as reproxy can search and upload the includes of `.c` files to buildfarm. However, the remote execution returns error as:
```
hellomake.c:1:9: fatal error: hellomake.h: No such file or directory
1 | #include
| ^~~~~~~~~~~~~
compilation terminated.
make: *** [makefile:11: hellomake.o] Error 1
```
where, hellomake.h is in the exec_root. If I want to successfully implement a remote build, I have to add all needed srcs and headers to the `-inputs`, but the included headers are often difficult to obtain in advance. The directory structure of the demo is as follows:
```
|-- hellofunc.c
|-- hellomake.c
|-- hellomake.h
|-- makefile
|-- out
`-- rbe
|-- bin
| |-- bigquery
| |-- bootstrap
| |-- downloadmismatch
| |-- dumpstats
| |-- logdump
| |-- metricsuploader
| |-- reclientreport
| |-- reproxy
| |-- reproxystatus
| |-- reproxytool
| |-- rewrapper
| |-- rpl2cloudtrace
| |-- rpl2trace
| `-- scandeps_server
`-- configs
|-- reproxy.cfg
`-- rewrapper.cfg
```

How to use reclient without setting rewrapper's `-inputs` and `-output_files` parameters?

Contributor guide

Open the contributing guide

Research direction

Reproduce the remote build described by the Makefile and the reproxy.cfg and rewrapper.cfg files, starting with the scandeps_server entry point and the rewrapper inputs and output_files settings. Done should establish whether included headers can be discovered and uploaded automatically without manually listing those parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp, go
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.