[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Request for help: slashem



Hi Nilesh,

On Wed, Mar 17, 2021 at 06:40:17PM +0530, Nilesh Patra wrote:
> Hmm, I wish to confirm if I get you correctly here. When compiled
> natively here, the binaries will be able to execute, thus not giving the
> exec format or syntax error or something similar and we can then easily
> cross compile once that does not cause any problems. Is that what you
> mean?

The devil is in the detail here. Very often such binaries run during
build are used to examine the system and embed observations in the final
binary. Observing the build architecture system is not the right thing
to do. So while changing the compiler to the native one for this tool is
a step in the right direction, the generated file may be wrong for the
host architecture.

When in doubt, a good way is to generate this file for multiple
architectures (particular 32bit vs 64bit and little endian vs big
endian) and see whether there are any differences.

> I'm not sure of a way to implement this, would you have any examples, or
> something similar?

dpkg's buildtools.mk sets a number of tool variables. For most tools,
there are separate _FOR_BUILD variants such as CC_FOR_BUILD.

When using autotools, there is AX_CC_FOR_BUILD in the autoconf archive.

For meson there is a flag called "native".

When using CMake, you find yourself between a rock and a hard place.
https://stackoverflow.com/q/36173840/1626632

When looking for concrete examples, I suggest using these terms with
https://codesearch.debian.net.

Helmut


Reply to: