Firefox build: stdio.h:63:17: error: 'long type-name' is invalid
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
People
(Reporter: dan76, Unassigned)
Details
Attachments
(8 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Steps to reproduce:
./mach configure
Linux 5.18.10 (x86-64)
glibc 2.35
clang 14.0.6
Actual results:
0:09.62 checking for valid C compiler optimization flags... no
0:09.62 configure: error: These compiler flags for C are invalid: -O2
0:09.63 DEBUG: <truncated - see config.log for full output>
0:09.63 DEBUG: configure:4879: checking for _aligned_malloc in malloc.h
0:09.63 DEBUG: configure:4960: checking if app-specific confvars.sh exists
0:09.63 DEBUG: configure:5033: checking for valid C compiler optimization flags
0:09.63 DEBUG: configure:5044: /usr/bin/ccache /usr/bin/clang -std=gnu99 -c -march=native -O3 -pipe -fPIC -ffunction-sections -fdata-sections -fno-math-errno -pthread -O2 -Qunused-arguments -I/usr/xorg/include conftest.c 1>&5
0:09.63 DEBUG: In file included from configure:5038:
0:09.63 DEBUG: /usr/local/include/stdio.h:63:17: error: 'long type-name' is invalid
0:09.63 DEBUG: typedef __off_t off_t;
0:09.63 DEBUG: ^
0:09.63 DEBUG: ./confdefs.h:3:15: note: expanded from macro 'off_t'
0:09.63 DEBUG: #define off_t long
0:09.63 DEBUG: ^
0:09.63 DEBUG: 1 error generated.
0:09.63 DEBUG: configure: failed program was:
0:09.63 DEBUG: #line 5037 "configure"
0:09.63 DEBUG: #include "confdefs.h"
0:09.63 DEBUG: #include <stdio.h>
0:09.63 DEBUG: int main() {
0:09.63 DEBUG: printf("Hello World\n");
0:09.63 DEBUG: ; return 0; }
0:09.63 DEBUG: configure: error: These compiler flags for C are invalid: -O2
0:09.63 ERROR: old-configure failed
*** Fix above errors and then restart with "./mach build"
Expected results:
The test should be passed without errors.
A possible workaround is:
sed -i 's|off_t, long|off_t, off_t|' build/autoconf/acspecific.m4
At least until it's fixed. Thanks.
Comment 2•3 years ago
|
||
Can you attach the full contents of the config.log file?
Updated•3 years ago
|
Comment 4•3 years ago
|
||
Can you also attach the standard output from configure?
(In reply to Mike Hommey [:glandium] from comment #4)
Can you also attach the standard output from configure?
Yes, configure.txt attached.
Comment 6•3 years ago
|
||
So, something is going wrong much earlier:
0:08.90 checking for mode_t... no
0:08.92 checking for off_t... no
0:08.94 checking for pid_t... no
0:08.96 checking for size_t... no
0:09.08 checking whether 64-bits std::atomic requires -latomic... do not know; assuming no
0:09.12 checking for dirent.h that defines DIR... no
these should all be yes. Unfortunately, config.log doesn't give much information about it.
Try without setting CPPFLAGS. If that doesn't help for those checks, try adding set -x before AC_TYPE_MODE_T in old-configure.in and see what the output looks like.
(In reply to Mike Hommey [:glandium] from comment #6)
Try without setting
CPPFLAGS. If that doesn't help for those checks, try addingset -xbeforeAC_TYPE_MODE_Tinold-configure.inand see what the output looks like.
Unsetting CPPFLAGS didn't help. I attached the full configure output with set -x. Here's an extract:
0:07.75 + echo -n 'checking for mode_t... '
0:07.75 checking for mode_t... + echo 'configure:3421: checking for mode_t'
0:07.75 ++ echo '${ac_cv_type_mode_t+set}'
0:07.75 + eval 'test "${ac_cv_type_mode_t+set}" = set'
0:07.75 ++ test '' = set
0:07.75 + cat
0:07.75 + egrep '(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]'
0:07.77 + rm -rf conftest.c
0:07.77 + ac_cv_type_mode_t=no
0:07.77 + rm -f 'conftest*'
0:07.77 + echo no
0:07.77 no
Comment 8•3 years ago
|
||
It's using the cached version of the check result, can you try again after removing config.cache?
(In reply to Mike Hommey [:glandium] from comment #8)
It's using the cached version of the check result, can you try again after removing
config.cache?
Sorry about that. Attached the correct one.
Comment 10•3 years ago
|
||
Err, actually I misread the previous one, they both are not using the cached version, but there's still not enough to debug. You'll have to debug this manually, unfortunately:
Create a conftest.c file with the following contents:
#line 3426 "configure"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
Then run /usr/bin/ccache /usr/bin/clang -std=gnu99 -E conftest.c, check if mode_t appears in the output, and if it doesn't, figure out why.
| Reporter | ||
Comment 11•3 years ago
|
||
Ok, I attached the conftest.c output and it shows mode_t
typedef unsigned int __mode_t;
typedef __mode_t mode_t;
Comment 12•3 years ago
|
||
Let's try something else. Can you apply the following patch, run ./mach configure, then attach the output as well as the foo file that it creates?
--- a/old-configure.in
+++ b/old-configure.in
@@ -620,6 +620,31 @@ if test -z "$SKIP_COMPILER_CHECKS"; then
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ========================================================
AC_C_CONST
+set -x
+echo $ac_n "checking for mode_t""... $ac_c" 1>&6
+echo "configure:3420: checking for mode_t" >&5
+ cat > conftest.$ac_ext <<EOF
+#line 3425 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+eval echo "$ac_cpp conftest.$ac_ext"
+if (eval "$ac_cpp conftest.$ac_ext") | tee foo |
+ egrep "(^|[[^a-zA-Z_0-9]])mode_t[[^a-zA-Z_0-9]]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_mode_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_mode_t=no
+fi
+rm -f conftest*
+echo "$ac_t""$ac_cv_type_mode_t" 1>&6
+
+exit
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
| Reporter | ||
Comment 13•3 years ago
|
||
Ok, here's the output with the old-configure.in patched.
| Reporter | ||
Comment 14•3 years ago
|
||
Here is the "foo" file.
Updated•3 years ago
|
Comment 15•3 years ago
|
||
Can you try again after replacing
egrep "(^|[[^a-zA-Z_0-9]])mode_t[[^a-zA-Z_0-9]]" >/dev/null 2>&1; then
with
egrep "(^|[[^a-zA-Z_0-9]])mode_t[[^a-zA-Z_0-9]]"; then
and attach the output from ./mach configure (no need for foo this time)
| Reporter | ||
Comment 16•3 years ago
|
||
Ok, ./mach configure output with patch without /dev/null attached.
| Reporter | ||
Comment 17•3 years ago
|
||
I think you found the issue! The problem was with egrep.
I was using version (e)grep 3.7, installed last year. For some unknown reason it was causing this bug. I reinstalled it and now it works. Amazing!
Thank you!
Ps: so I'm closing this, since the issue was with grep and not with Firefox.
Description
•