Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Issues related to applications and software problems
darksniperx
Posts: 8
Joined: 2017/10/10 16:09:26

Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by darksniperx » 2017/10/10 16:13:27

As soon as i upgraded to centos 7.4, i was not able to compile any packages. Whether it was python package , ffmpeg, gcc,..

The issue is generally on fresh install of 7.4


All packages give the same error: "error: expected ‘,’ or ‘;’ before ‘typedef’"

sample output when trying to compile ffmpeg:

sudo make V=1
gcc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I./compat/float -I./compat/atomics/gcc -DZLIB_CONST -DHAVE_AV_CONFIG_H -std=c11 -fomit-frame-pointer -pthread -D_REENTRANT -I/usr/include/SDL2 -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wno-maybe-uninitialized -MMD -MF libavdevice/alldevices.d -MT libavdevice/alldevices.o -c -o libavdevice/alldevices.o libavdevice/alldevices.c
In file included from /usr/include/math.h:46:0,
from ./libavutil/common.h:36,
from ./libavutil/avutil.h:296,
from ./libavutil/log.h:25,
from libavdevice/avdevice.h:48,
from libavdevice/alldevices.c:23:
/usr/include/bits/mathdef.h:28:1: error: expected ‘,’ or ‘;’ before ‘typedef’
typedef float float_t; /* `float' expressions are evaluated as `float'. */
^
make: *** [libavdevice/alldevices.o] Error 1
Last edited by darksniperx on 2017/10/10 18:25:30, edited 1 time in total.

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by avij » 2017/10/10 16:26:46

Please provide the output of

rpm -q glibc-headers
rpm -V glibc-headers (this may be empty)

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by avij » 2017/10/10 16:32:04

Also, unable to reproduce:

Code: Select all

$ cat test.c
#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[]) {
	printf("Hello world\n");
	return 0;
}
$ make test
cc     test.c   -o test
$ ./test
Hello world
$ rpm -q glibc glibc-headers gcc make
glibc-2.17-196.el7.x86_64
glibc-headers-2.17-196.el7.x86_64
gcc-4.8.5-16.el7.x86_64
make-3.82-23.el7.x86_64

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by TrevorH » 2017/10/10 16:33:39

I tried to reproduce too and failed though mine helloworld.c also included the same typedef float float_t; line from the original report.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

darksniperx
Posts: 8
Joined: 2017/10/10 16:09:26

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by darksniperx » 2017/10/10 18:18:19

Forgot to mention, the issue is generally on fresh install of 7.4

rpm -q glibc-headers: glibc-headers-2.17-196.el7.x86_64

rpm -V glibc-headers: (blank)

rpm -q glibc glibc-headers gcc make:
glibc-2.17-196.el7.x86_64
glibc-2.17-196.el7.i686
glibc-headers-2.17-196.el7.x86_64
gcc-4.8.5-16.el7.x86_64
make-3.82-23.el7.x86_64
Last edited by darksniperx on 2017/10/10 18:25:06, edited 1 time in total.

zovs66
Posts: 50
Joined: 2017/09/29 14:55:01

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by zovs66 » 2017/10/10 18:19:22

Just trying to help, found this thread interesting my default 7.4 shows following:

Code: Select all

[dlazov@zovs-centos7 hello]$ make test
cc     test.c   -o test
[dlazov@zovs-centos7 hello]$ ./test
Hello world
[dlazov@zovs-centos7 hello]$ rpm -q glibc glibc-headers gcc make
glibc-2.17-196.el7.x86_64
glibc-headers-2.17-196.el7.x86_64
gcc-4.8.5-16.el7.x86_64
make-3.82-23.el7.x86_64
Not sure if this helps or not.
Red, Green, Refactor...

darksniperx
Posts: 8
Joined: 2017/10/10 16:09:26

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by darksniperx » 2017/10/10 18:31:27

if i follow the hello world example, there is no issue, although gcc still fails to make whole app like ffmpeg :

steps to repro the issue:

Code: Select all

wget http://ffmpeg.org/releases/ffmpeg-3.3.4.tar.bz2
tar -xvjf ffmpeg-3.3.4.tar.bz2
cd ffmpeg-3.3.4
./configure
make 
========
CC      libavdevice/alldevices.o
In file included from /usr/include/math.h:46:0,
                 from ./libavutil/common.h:36,
                 from ./libavutil/avutil.h:296,
                 from ./libavutil/log.h:25,
                 from libavdevice/avdevice.h:48,
                 from libavdevice/alldevices.c:23:
/usr/include/bits/mathdef.h:28:1: error: expected ‘,’ or ‘;’ before ‘typedef’
 typedef float float_t;  /* `float' expressions are evaluated as `float'.  */
 ^
make: *** [libavdevice/alldevices.o] Error 1
==============

make V=1
gcc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -I./compat/float -I./compat/atomics/gcc -DZLIB_CONST -DHAVE_AV_CONFIG_H -std=c11 -fomit-frame-pointer -pthread -D_REENTRANT -I/usr/include/SDL2  -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto -Wno-maybe-uninitialized  -MMD -MF libavdevice/alldevices.d -MT libavdevice/alldevices.o -c -o libavdevice/alldevices.o libavdevice/alldevices.c
In file included from /usr/include/math.h:46:0,
                 from ./libavutil/common.h:36,
                 from ./libavutil/avutil.h:296,
                 from ./libavutil/log.h:25,
                 from libavdevice/avdevice.h:48,
                 from libavdevice/alldevices.c:23:
/usr/include/bits/mathdef.h:28:1: error: expected ‘,’ or ‘;’ before ‘typedef’
 typedef float float_t;  /* `float' expressions are evaluated as `float'.  */
 ^
make: *** [libavdevice/alldevices.o] Error 1
Last edited by darksniperx on 2017/10/10 18:58:44, edited 1 time in total.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by TrevorH » 2017/10/10 18:52:38

Is this just ffmpeg?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

darksniperx
Posts: 8
Joined: 2017/10/10 16:09:26

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by darksniperx » 2017/10/10 18:55:01

The issue is with everything that i try to compile, gcc, pip packages, locust, etc,...

example compiling gcc 7.2:

Code: Select all

make
...
configure: updating cache ./config.cache
configure: creating ./config.status
config.status: creating Makefile
config.status: creating testsuite/Makefile
config.status: creating config.h
config.status: executing default commands
make[3]: Entering directory `/tmp/gcc-7.2.0/host-x86_64-pc-linux-gnu/libiberty'
if [ x"-fpic" != x ] && [ ! -d pic ]; then \
  mkdir pic; \
else true; fi
touch stamp-picdir
if [ x"" != x ] && [ ! -d noasan ]; then \
  mkdir noasan; \
else true; fi
touch stamp-noasandir
if [ x"-fpic" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -g  -I. -I../.././libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  -D_GNU_SOURCE -fpic ../.././libiberty/regex.c -o pic/regex.o; \
else true; fi
In file included from ../.././libiberty/../include/xregex.h:27:0,
                 from ../.././libiberty/regex.c:194:
../.././libiberty/../include/xregex2.h:45:1: error: expected ‘,’ or ‘;’ before ‘typedef’
 typedef long int s_reg_t;
 ^
make[3]: *** [regex.o] Error 1
make[3]: Leaving directory `/tmp/gcc-7.2.0/host-x86_64-pc-linux-gnu/libiberty'
make[2]: *** [all-stage1-libiberty] Error 2
make[2]: Leaving directory `/tmp/gcc-7.2.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/tmp/gcc-7.2.0'
make: *** [all] Error 2
example compiling vlc:

Code: Select all

[amaximovskih@abstrusenesses vlc-2.2.6]$ make
make  all-recursive
make[1]: Entering directory `/tmp/vlc-2.2.6'
Making all in compat
make[2]: Entering directory `/tmp/vlc-2.2.6/compat'
make  all-am
make[3]: Entering directory `/tmp/vlc-2.2.6/compat'
  CC       dummy.lo
  CC       atof.lo
In file included from ../include/vlc_fixups.h:70:0,
                 from ../config.h:801,
                 from atof.c:22:
/usr/include/dirent.h:263:1: error: expected ‘,’ or ‘;’ before ‘extern’
 extern int __REDIRECT (scandir,
 ^
.....
Last edited by darksniperx on 2017/10/10 19:28:18, edited 1 time in total.

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: Unable to compile on centos 7.4 : error: expected ‘,’ or ‘;’ before ‘typedef’

Post by avij » 2017/10/10 19:27:49

I used your "steps to reproduce" on my usual fully updated CentOS 7.4 build machine, and ffmpeg built just fine (with a few warnings).

Even though you have the normal CentOS C compiler installed, are you actually using it? What does which gcc show?

Post Reply