mainAutoconf - Support: sr #110687, AC_C_BIGENDIAN fails when...

 
 

sr #110687: AC_C_BIGENDIAN fails when cross-compiling with -std=c11 and -flto

Submitter:  None
Submitted:  Wed 27 Jul 2022 01:27:11 PM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Closed Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 27 Jul 2022 04:01:59 PM UTC, comment #5: 

Thanks for the bug report. I enjoyed looking into this bug: it felt like I was wrestling one-on-one against GCC and managed to pin it to the mat. I installed a patch into Savannah that worked for me; please give it a try when you get a chance.

Paul Eggert <eggert>
Group administrator
Wed 27 Jul 2022 02:35:03 PM UTC, comment #4: 


> Can we see the config.log for -std=c11 only, please?


Should be attached. Invocation was:

autoheader && autoconf && rm -Rf config.status autom4te.cache/ && ./configure --host=aarch64-linux-gnu CFLAGS="-std=c11"
checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether aarch64-linux-gnu-gcc accepts -g... yes
checking for aarch64-linux-gnu-gcc option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
configure: creating ./config.status
config.status: creating issue618config.h
config.status: issue618config.h is unchanged

(file #53474)

Anonymous
Wed 27 Jul 2022 02:31:44 PM UTC, comment #3: 

Can we see the config.log for -std=c11 only, please?

Zack Weinberg <zackw>
Group administrator
Wed 27 Jul 2022 02:27:59 PM UTC, comment #2: 


> It appears to me that this is an issue with cross compilation and strict conformance mode (-std=c11), not with -flto.  Could you please report what happens, using the same cross-compilation toolchain, if you run the same configure command but using CFLAGS="-std=c11" LDFLAGS="" ?


In that case (only -std=c11) everything works as expected.

checking for unistd.h... yes
checking whether byte ordering is bigendian... no
configure: creating ./config.status
config.status: creating issue618config.h


The issue only occurs when using -flto.

> It would also be helpful to know which C library is in use in the target environment, and its version number.


The system is Ubuntu 22.04. glibc 2.35. The cross-compiler is aarch64-linux-gnu-g++ (Ubuntu 11.2.0-17ubuntu1) 11.2.0.

Anonymous
Wed 27 Jul 2022 02:22:40 PM UTC, comment #1: 

It appears to me that this is an issue with cross compilation and strict conformance mode (-std=c11), not with -flto.  Could you please report what happens, using the same cross-compilation toolchain, if you run the same configure command but using CFLAGS="-std=c11" LDFLAGS="" ?

It would also be helpful to know which C library is in use in the target environment, and its version number.

FYI, it is pointless to use -std=c11 if you're not also going to use -Wall and -Wpedantic.  Only the combination of all three of those options gives you all of the diagnostics required by the standard.  If you just want to ensure C2011 semantics when compiling code you didn't write, and you don't want to spend hours and hours fixing all the issues like these, it is better to use -std=gnu11 and leave warnings options to the authors of the program.

(To be clear, Autoconf should work regardless -- but there might not be any practical way for Autoconf to detect endianness when cross compiling to an environment that provides no extensions beyond ISO C.)

Zack Weinberg <zackw>
Group administrator
Wed 27 Jul 2022 01:27:11 PM UTC, original submission:  

Using the following configure.ac:

AC_INIT([issue618], [1.0], [foo@bar.invalid])
AC_CONFIG_HEADERS([issue618config.h])
AC_C_BIGENDIAN
AC_OUTPUT

and the following command:

autoheader && autoconf && rm -Rf config.status autom4te.cache/ && ./configure --host=aarch64-linux-gnu CFLAGS="-std=c11 -flto" LDFLAGS="-flto"

configure fails with:

checking whether byte ordering is bigendian... unknown
configure: error: unknown endianness
 presetting ac_cv_c_bigendian=no (or yes) will help

config.log is attached.
See also: https://github.com/libexpat/libexpat/issues/618/.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #53474:  config.log added by None (13KiB - application/octet-stream)
file #53473:  config.log added by None (13KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-27 eggert StatusNone Done
        Open/ClosedOpen Closed
    2022-07-27 None Attached File- Added config.log, #53474
    2022-07-27 None Attached File- Added config.log, #53473

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code