Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Zhoucaijie opened this issue Nov 23, 2023 · 2 comments
Open

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

Zhoucaijie opened this issue Nov 23, 2023 · 2 comments

Comments

@Zhoucaijie
Copy link

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:
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<hellomake.h>
      |         ^~~~~~~~~~~~~
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?

@nqcuongit95
Copy link

nqcuongit95 commented Nov 27, 2023

Have you specific the depsscanner_address in the reproxy config file? If you haven't you have to set it in the config file like so: depsscanner_address=exec://$absolute_path_to_reclient_dir/scandeps_server

@Zhoucaijie
Copy link
Author

Have you specific the depsscanner_address in the reproxy config file? If you haven't you have to set it in the config file like so: depsscanner_address=exec://$absolute_path_to_reclient_dir/scandeps_server

Thanks a lot, this issue can be solved by placing the scandeps_server binary in the same dir of reproxy。However, there is another issue that the scandeps_server binary can't find the system headers.

A system headers in the path of clang toolchain clang/linux-x86_64/llvm/lib/clang/15.0.4/include/stdint.h by #include <stdint.h> can not be found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants