Bug 989 - [Cross-compiling] code generators are being built for target
[Cross-compiling] code generators are being built for target
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Configure
1.9.7
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-19 06:01 MDT by Marcus K
Modified: 2021-09-13 10:25 MDT (History)
0 users

See Also:


Attachments
Configure summary (3.47 KB, text/plain)
2021-08-19 06:01 MDT, Marcus K
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus K 2021-08-19 06:01:23 MDT
Created attachment 558 [details]
Configure summary

While compiling sudo 1.9.7p2 for aarch64 (Raspberry Pi 4), I encountered the following problem:
./mksigname > signame.c
/bin/sh: line 1: ./mksigname: cannot execute binary file: Exec format error

This seems to be caused by the Makefile using the CC variable for the actual target libraries & programs as well as for the generators, which need to run on the build host.

I managed to get around this issue by registering qemu-aarch64 via the kernel's binfmt_misc functionality to run the executables anyway, but this is a lot of work and requires a ton of additional setup. 
Perhaps this can be alleviated via a HOSTCC variable in autoconf or similar which points to the build host's system compiler and using that to build the generators.

Configure command:
./configure --build=x86_64-pc-linux-gnu --host=aarch64-linux-musleabi --prefix=/usr --with-gnu-ld --disable-shadow \
 --with-passwd --with-env-editor --without-pam --enable-openssl \
 --with-insults --with-passprompt='[sudo] Password:'
Comment 1 Todd C. Miller 2021-08-19 07:02:08 MDT
I have a patch to address this in https://github.com/sudo-project/sudo/pull/109
Would you be able to give that a try?  I can create a tarball for you if that is easier.
Comment 2 Marcus K 2021-08-19 09:32:46 MDT
Seems to work perfectly, thank you so much!

Will that be included in the next release of sudo?
Comment 3 Todd C. Miller 2021-08-19 09:33:34 MDT
Now that I have confirmation that it works in a real environment, yes :-)
Comment 4 Todd C. Miller 2021-09-13 10:25:55 MDT
Fixed in sudo 1.9.8