Jim Meyering wrote:
> coreutils began the switch to C99 years ago, and that sort of
> initialization is a new addition. We did debate whether to use the
> new-to-coreutils construct. However, if that's the only bit of code
> that causes build failure for this compiler, I may accommodate it with
> the attached patch:
thanx for the quick response.
Side note: according to the help output, this compiler supports C99
syntax:
-xc99[=<a>] Enable ISO C99 features, <a>={%all,%none}
but using that option doesn't make any difference.
Changing the code using your patch makes `make` work.
Unfortunately, `make check` also fails:
CC stdbuf.o
"stdbuf.c", line 214: warning: non-constant initializer: op "NAME"
"stdbuf.c", line 214: left operand must be modifiable lvalue: op "="
"stdbuf.c", line 261: cannot recover from previous errors
cc: acomp failed for stdbuf.c
I guess it hit on the const declarations.
The source stdbuf.c compiles if I change this:
diff stdbuf.c-ORIG stdbuf.c
213c213
< char const *const search_path[] = {
---
> char* search_path[] = {
After that, the linker complains about this:
CCLD libstdbuf.so
cc: Warning: illegal option -fPIC
cc: Warning: -s conflicts with -g. -s turned off
ild: calling ld to finish link -- cannot handle argument -h
ld: fatal: option -h and building a dynamic executable are
incompatible
ld: fatal: Flags processing errors
*** Error code 1
The following command caused the error:
echo " CCLD " libstdbuf.so;cc -fPIC -g -shared
-Wl,-z,ignore \
-o libstdbuf.so libstdbuf_so- libstdbuf.o
make: Fatal error: Command failed for target `libstdbuf.so'
I'll try to make it work and report it to you.
Have a nice day,
Berny