Subject: bug#32762: Bug at coreutils compile

From: Assaf Gordon <[email-masked]>
Date: Tue, 18 Sep 2018 12:24:01 -0600

tag -1 notabug
close -1
thanks

Hello,

On 18/09/18 02:49 AM, vvcfee wrote:
> Hi GNU team,Thanks for your great job!

Thank you for the kind words.

> recently I try to compile gnu coreutils manually on Centos7.3,and got some error when try to make:
> [root@localhost coreutils]# make
> make  all-recursive
> make[1]: Entering directory `/coreutils'
> Making all in po
> make[2]: Entering directory `/coreutils/po'
> make[2]: Nothing to be done for `all'.
> make[2]: Leaving directory `/coreutils/po'
> Making all in .
> make[2]: Entering directory `/coreutils'
>    CC       lib/acl-internal.o
> lib/acl-internal.c: In function 'free_permission_context':
> lib/acl-internal.c:479:1: error: function might be candidate for attribute 'cons
> t' [-Werror=suggest-attribute=const]
>   free_permission_context (struct permission_context *ctx)
>   ^
> cc1: all warnings being treated as errors

This is not a bug per-se, but a combination of two factors:

1. The compile issues a warning that a certain function
could be modified for improved performance.
2. The build process treats all warnings as errors.

This typically happens when one builds coreutils
directly from the git repository.

It should never happen when building from an official tarball.

===

If you did use a tarball (i.e. one of the files in 
https://ftp.gnu.org/gnu/coreutils/ ) and still encountered this problem 
- please do tell
which version of tarball and which version of gcc you are using.

If you are building from git (e.g. "git clone 
git://git.sv.gnu.org/coreutils.git") and still want to proceed, you can 
disable these warnings like so:

   git clone git://git.sv.gnu.org/coreutils.git
   cd coreutils
   ./bootstrap
   ./configure --disable-gcc-warnings
   make

As a last resort, not very recommended, you can temporarily override
the CFLAGS to compile just that one file without warnings, like so:

    [... after the build failure of acl-internal.o ...]
    $ make CFLAGS="" ./lib/acl-internal.o
    CC       lib/acl-internal.o
    [... then resume build as before ...]
    $ make
    ...
    ...

===

Hope this helps. If not, please do reply and send more details.
I'm closing this as "not a bug", but discussion can continue by replying 
to this thread.

regards,
  - assaf