Skip to contentSkip to conversation

Cross-compilation check broken

DISCUSSION Pavel Roskin 2 participants 4 messages Jan 29, 2009 – Feb 7, 2009

lore
Share & tools
lore
#0 lore raw

Hello, Robert!

Your commit 1955 breaks my script for testing PowerPC. That's the script:

#!/bin/sh
set -e CROSS_PATH=/home/proski/src/buildroot/build_powerpc/staging_dir/usr/bin PATH=$CROSS_PATH:$PATH
./configure --with-platform=ieee1275 --target=powerpc-linux make -j2
./grub-mkrescue --grub-mkimage=./grub-mkelfimage --pkglibdir=. grub.iso qemu-system-ppc -nographic -cdrom grub.iso -boot d

I compile for target "powerpc-linux" and I have powerpc-linux-gcc in the PATH. However, I'm using native tools. I'm not interested in running tools in an emulator (actually, I have another script that does it). Therefore, build and host are the same, so TARGET_CC is set to gcc.

The new check must be wrong. TARGET_CC is used to build executables for the target system. It should be found using the specified target even if the tools are compiled natively.

Actually, the original check wasn't particularly good. Maybe we could check if target_alias is defined? Or maybe we could always check for TARGET_CC?

Signature · 2 lines
Regards,
Pavel Roskin
#1 lore raw
Quoted 19 lines · Pavel Roskin

Hello, Robert!

Your commit 1955 breaks my script for testing PowerPC. That's the script:

#!/bin/sh
set -e CROSS_PATH=/home/proski/src/buildroot/build_powerpc/staging_dir/usr/bin PATH=$CROSS_PATH:$PATH
./configure --with-platform=ieee1275 --target=powerpc-linux make -j2
./grub-mkrescue --grub-mkimage=./grub-mkelfimage --pkglibdir=. grub.iso qemu-system-ppc -nographic -cdrom grub.iso -boot d

I compile for target "powerpc-linux" and I have powerpc-linux-gcc in the PATH. However, I'm using native tools. I'm not interested in running tools in an emulator (actually, I have another script that does it). Therefore, build and host are the same, so TARGET_CC is set to gcc.

Quoted 7 lines

The new check must be wrong. TARGET_CC is used to build executables for the target system. It should be found using the specified target even if the tools are compiled natively.

Actually, the original check wasn't particularly good. Maybe we could check if target_alias is defined? Or maybe we could always check for TARGET_CC?

Hi Pavel,

This check looks really confusing. I naively assumed it was checking if we're cross-compiling like the comment said ;-)

But if it really meant to compare target with host, I think it should be:

if test "x$target_cpu" != "x$host_cpu"; then

rather than what was before:

if test "x$target" != "x$host"; then

Since "$target_os" has no real meaning. Does that work for you?

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw
Quoted 2 lines · Robert Millan

This check looks really confusing. I naively assumed it was checking if we're cross-compiling like the comment said ;-)

I agree, the comment is misleading. We actually check for the second set of tools there, which is used to build files for the target. The first set is used to build for the host, and it can be a cross-compiler as well.

Quoted 9 lines

But if it really meant to compare target with host, I think it should be:

if test "x$target_cpu" != "x$host_cpu"; then

rather than what was before:

if test "x$target" != "x$host"; then

Since "$target_os" has no real meaning. Does that work for you?

I understand that you are trying to exorcise "$target_os" by all means. By from the user standpoint, the second set of tools is needed if the "--target" option was specified and its argument is different from the one for the "--host" option.

I would also like to get rid of ac_tool_prefix. I'll have a look. I assume we can always look for $target_alias-gcc without falling back to $target_alias-cc and $target_alias-egcs.

Signature · 2 lines
Regards,
Pavel Roskin
#3 lore raw
Quoted 6 lines · Pavel Roskin
Quoted 6 lines

But if it really meant to compare target with host, I think it should be:

if test "x$target_cpu" != "x$host_cpu"; then

rather than what was before:

Quoted 8 lines
Quoted 3 lines

if test "x$target" != "x$host"; then

Since "$target_os" has no real meaning. Does that work for you?

I understand that you are trying to exorcise "$target_os" by all means. By from the user standpoint, the second set of tools is needed if the "--target" option was specified and its argument is different from the one for the "--host" option.

Could you give an example situation in which this is needed? Currently I just see that user might do misleading things like:

  --host=powerpc-unknown-foo --target=powerpc-unknown-bar

and then the check will think that host != target because foo != bar, without taking into account that "bar" is meaningless here.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."