[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

-fno-strict-aliasing turned off when cross compiling

sndive

1/16/2008 10:45:00 PM

Does anyone have an idea why -fno-strict-aliasing is turned off when
cross compiling?

in configure generated for 2.4.4:

case $GCC in
yes)
# Python violates C99 rules, by casting between incompatible
# pointer types. GCC may generate bad code as a result of that,
# so use -fno-strict-aliasing if supported.
echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-
aliasing" >&5
echo $ECHO_N "checking whether $CC accepts -fno-strict-aliasing...
$ECHO_C" >&6
ac_save_cc="$CC"
CC="$CC -fno-strict-aliasing"
if test "$cross_compiling" = yes; then
ac_cv_no_strict_aliasing_ok=no
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ why?

else
3 Answers

Martin v. Loewis

1/17/2008 4:57:00 AM

0

> Does anyone have an idea why -fno-strict-aliasing is turned off when
> cross compiling?

Because detection of -fno-strict-aliasing is made through running
the compiler output (AC_TRY_RUN, see configure.in instead). For
cross-compilation, running the program isn't actually possible,
so a default must be specified. Since we can't know whether the
cross-compiler accepts -fno-strict-aliasing, we leave it out.

Regards,
Martin

sndive

1/17/2008 7:04:00 PM

0

On Jan 16, 10:56 pm, "Martin v. Löwis" <mar...@v.loewis.de> wrote:
> > Does anyone have an idea why -fno-strict-aliasing is turned off when
> > cross compiling?
>
> Because detection of -fno-strict-aliasing is made through running
> the compiler output (AC_TRY_RUN, see configure.in instead). For
> cross-compilation, running the program isn't actually possible,
> so a default must be specified. Since we can't know whether the
> cross-compiler accepts -fno-strict-aliasing, we leave it out.
>
This makes some sense. Thank you. As for this:

def detect_modules(self):
# Ensure that /usr/local is always used
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/
include')

it looks like a recipe for a disaster when cross compiling:
cc1: warning: include location "/usr/local/include" is unsafe for
cross-compilation

Martin v. Loewis

1/17/2008 8:27:00 PM

0

> This makes some sense. Thank you. As for this:
>
> def detect_modules(self):
> # Ensure that /usr/local is always used
> add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
> add_dir_to_list(self.compiler.include_dirs, '/usr/local/
> include')
>
> it looks like a recipe for a disaster when cross compiling:
> cc1: warning: include location "/usr/local/include" is unsafe for
> cross-compilation

Yes, Python doesn't really support cross-compilation. So you are
on your own.

Of course, in true cross-compilation, you won't get a chance to run
setup.py, since python will only run on the target system, not on
the host system, therefore setup.py won't even start, and it doesn't
matter that it won't support cross-compilation.

Regards,
Martin