Can't cross-compile CMake project with distcc and makepkg

This forum is for discussion about general software issues.

Can't cross-compile CMake project with distcc and makepkg

Postby snack » Sun Sep 26, 2021 5:45 pm

I set up a distcc cross-compiling infrastructure with armv8 on RPI4 as the distcc client and an x86_64 Archlinux as distcc volunteer. On the volunteer I installed distccd-alarm-armv8 and started the distccd-armv8 systemd unit, and on the client I modified /etc/makepkg.conf as follows:
$this->bbcode_second_pass_code('', '
BUILDENV=(distcc color !ccache check !sign)
DISTCC_HOSTS="192.168.1.162:3636,cpp,lzo"
')
As a noob I expected that at this point I could dist-cross-compile a CMake project (specifically, plasma-bigscreen-git from AUR) using makepkg, but I'm facing two issues:
1) the CMake configuration done by makepkg seems to not use distcc. No compilation job is sent to the volunteer and if I stop the makepkg run with Ctrl-C and then run make from the build folder I see that distcc is not invoked at all:
$this->bbcode_second_pass_code('', '
cd /home/myuser/build/.... && /usr/bin/c++ -DKCOREADDONS_LIB ...
')
When manually configuring CMake, the use of distcc can be configured as:
$this->bbcode_second_pass_code('', '
cmake -DCMAKE_C_COMPILER_LAUNCHER=distcc -DCMAKE_CXX_COMPILER_LAUNCHER=distcc /path/to/source
')
and I thought that makepkg would automatically add the above variables to cmake invocations specified in the PKGBUILD, but now I guess I was wrong. So how does makepkg is supposed to handle distcc with CMake projects?

2) when bypassing makepkg and configuring distcc manually as in 1), the compilation jobs are sent to my volunteer but then fail. I tracked down the problem to CMake invoking the compilation as:
$this->bbcode_second_pass_code('', '
distcc /usr/bin/c++ -DKCOREADDONS_LIB ...
')
so I guess that distcc executes /usr/bin/c++ on the volunteer, generating a compiler mismatch with the client and thus the error. I verified this hypothesis by manually launching a single compilation job from the launcher with:
$this->bbcode_second_pass_code('', '
distcc c++ -DKCOREADDONS_LIB ...
')
This succeeds, so I think that the distccd environment is correctly configured on the volunteer, and that the absolute path in the compiler name is the culprit.

Can anyone help me in solving the above issues?
Sorry for the long post, and thanks in advance for any help.
snack
 
Posts: 11
Joined: Mon Mar 19, 2018 3:24 pm

Re: Can't cross-compile CMake project with distcc and makepk

Postby graysky » Sun Sep 26, 2021 5:50 pm

$this->bbcode_second_pass_quote('snack', '
')$this->bbcode_second_pass_code('', '
BUILDENV=(distcc color !ccache check !sign)
DISTCC_HOSTS="192.168.1.162:3636,cpp,lzo"
')


That is for pump mode which I have never been able to get to work right and when it does work, in my tests it performed worse than regular mode. Drop the ',cpp,lzo' bit.

Also see the readme: https://github.com/graysky2/distccd-arch-arm
graysky
Developer
 
Posts: 1728
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: Can't cross-compile CMake project with distcc and makepk

Postby snack » Sun Sep 26, 2021 6:08 pm

Hi graysky, I removed the pump mode flags but this did not improve anything.

So I read the README you linked, and that rised again one of the doubts I have not been able to resolve in these my initial tests with distcc: is distccd needed to run on the client? I want to compile only on the volunteer, and in my limited understanding I thought that this means that I can avoid running distccd on the client. So I'm not running it, and indeed I have no problem in compiling (at least when doing it manually as described in point 2 of my original post). So should I really set up distccd on client? I cannot figure out how this can help with my CMake issues, but if you confirm that it's needed then I'll try.

Thank you for you support.
snack
 
Posts: 11
Joined: Mon Mar 19, 2018 3:24 pm


Return to General

Who is online

Users browsing this forum: No registered users and 7 guests