记distcc的超级加倍

@vrqq  September 8, 2021

Step

  • 两机器装好差不多的文件
  • 服务器端安装distccd并运行,设置绑定端口
  • 客户端在编译指令前加distcc,例如distcc clang++ a.cpp -o a

使用者:一份remote优先的配置文件

# --- /etc/distcc/hosts -----------------------
127.0.0.1:6666/16,lzo localhost/1

我用了ssh tunnel转发到了本机6666端口,~/.ssh/config 如下(证书登录)

[vrqq@rhel out]$ cat ~/.ssh/config
Host ali26
        HostName 1.2.3.4
        User root
        Port 22
        LocalForward 6666 127.0.0.1:3632

服务端:打开clang支持
在 /etc/distcc/commands.allow.sh 中仿造添加

  /usr/bin/clang
  /usr/bin/clang++
  /usr/lib64/ccache/clang
  /usr/lib64/ccache/clang++

连不上
设置环境变量开启debug输出 使用方法详见man distcc
Server side

touch /var/log/distccd.log
chown distcc:distcc /var/log/distccd.log
distccd --verbose --log-file=/var/log/distccd.log --daemon --allow=0.0.0.0/0 --user distcc -j4

Client side

export DISTCC_VERBOSE=1
export DISTCC_FALLBACK=0

注意关掉FALLBACK 否则当remote编译失败时会在本地重试,并且不输出remote的编译失败信息。。
若是本地成功了 那可就真是找不到问题了

客户端lldb调试器配置source-map
我刚以为是个独立的文件,其实不然,是每次设定的对应关系

(lldb) settings set -- target.source-map / /project/fable
(lldb) settings show target.source-map
target.source-map (path-map) =
[0] "/" -> "/project/fable"

retried locally and got a different result
和上面一样,先关掉DISTCC_FALLBACK,然后编译看远程的输出结果是啥,比如我的

distcc[113780] (dcc_build_somewhere) ERROR: failed to distribute and fallbacks are disabled
distcc[113780] (dcc_pump_sendfile) decided to use read/write rather than sendfile
clang-11: error: no such file or directory: '../gn_build/sanitizers/asan/blacklist.txt'
clang-11: error: no such file or directory: '../gn_build/sanitizers/ubsan/blacklist.txt'
distcc[113780] elapsed compilation time 0.549213s

我的编译参数里面有-fsanitize-blacklist=../gn_build/sanitizers/asan/blacklist.txt
同理@rspfile也要当心不展开直接调用distcc时不会被传到remote

ccache权限不足

在container里默认为root,设置其环境变量,然后看看结果

export CCACHE_DIR="/tmp/ccache/"
rm -rf /root/.ccache
ccache -ps

Reference:

GDB to LLDB command map
https://lldb.llvm.org/use/map.html

Troubleshooting
https://wiki.gentoo.org/wiki/Distcc/Cross-Compiling/en
https://manpages.debian.org/stretch/distcc-pump/include_server.1.en.html


添加新评论