-fno-strict-aliasing turned off when cross compiling

S

Squat'n Dive

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
 
M

Martin v. Löwis

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
 
S

Squat'n Dive

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
 
M

Martin v. Löwis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top