Fix build error on OSX

View: New views
11 Messages — Rating Filter:   Alert me  

Fix build error on OSX

by Masaki MURANAKA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello maintainers,

I got sources via official git repository and tried to build on Snow Leopard.
Unfortunately it was failed.

Error message is like this:
cc1: warnings being treated as errors
../../binutils/binutils/strings.c: In function ‘strings_file’:
../../binutils/binutils/strings.c:419: warning: ‘stat64’ is deprecated (declared at /usr/include/sys/stat.h:465)

stat64 is defined as deprecated since Leopard (10.5). So the use of stat64 causes error on build stage.
I think it should be added -Werror to CFLAGS in configure.

My patch is attached. Could someone review this?

--
Masaki Muranaka
Monami software



binutils-osx.patch (5K) Download Attachment

Re: Fix build error on OSX

by Alan Modra :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 05, 2009 at 01:58:33PM +0900, Masaki Muranaka wrote:
> My patch is attached. Could someone review this?

Why are you posting patches that you haven't tested?

--
Alan Modra
Australia Development Lab, IBM

Re: Fix build error on OSX

by Masaki MURANAKA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Alan,

Why are you concluding I didn't test? ;-)

I've tested on Debian Lenny (host,build.target=x86_64-unknown-linux-gnu) and there seems be no side effect.

Of course I've tested on Snow Leopard (host,build.target=x86_64-apple-darwin10.0.0)
The one build is patched. The another build is commented out HAVE_STAT64 by hand.
The results of "make check-binutils" are same.

I found some unexpected failures in each results but they are not caused by my patch.


On 2009/11/06, at 8:17, Alan Modra wrote:

> On Thu, Nov 05, 2009 at 01:58:33PM +0900, Masaki Muranaka wrote:
>> My patch is attached. Could someone review this?
>
> Why are you posting patches that you haven't tested?
>
> --
> Alan Modra
> Australia Development Lab, IBM
>


Re: Fix build error on OSX

by Alan Modra :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 06, 2009 at 01:47:57PM +0900, Masaki Muranaka wrote:
> Why are you concluding I didn't test? ;-)

Your patch sets -Werror in CFLAGS.  How can setting -Werror avoid an
error caused by -Werror?

--
Alan Modra
Australia Development Lab, IBM

Re: Fix build error on OSX

by Tristan Gingold-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 6, 2009, at 7:15 AM, Alan Modra wrote:

> On Fri, Nov 06, 2009 at 01:47:57PM +0900, Masaki Muranaka wrote:
>> Why are you concluding I didn't test? ;-)
>
> Your patch sets -Werror in CFLAGS.  How can setting -Werror avoid an
> error caused by -Werror?

I think this is a wrong patch for a real issue.
autoconf tests wether stat64 is usable but even with --enable-werror,  
it didn't check that warnings are
generated.
As a consequence, compilation of strings.c fails.

Adding unconditionally -Werror is wrong because this should at least  
be handled with --enable-werror.
Looks like there is something to do within autoconf but I am not an  
expert at all in it.

My two cents,
Tristan.


Re: Fix build error on OSX

by Masaki MURANAKA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

The issue is quite simple.
It should be commented out HAVE_STAT64 on OSX >= 10.5 targets.

In addision above, there have some issues.
There are not considered warnings in configure stage.
But they are built with -Werror on build stage.

Okay, it might be wrong my patch. then, how do we fix the build
option inconsistency between configure stage and build stage?
 

On 2009/11/06, at 15:15, Alan Modra wrote:

> On Fri, Nov 06, 2009 at 01:47:57PM +0900, Masaki Muranaka wrote:
>> Why are you concluding I didn't test? ;-)
>
> Your patch sets -Werror in CFLAGS.  How can setting -Werror avoid an
> error caused by -Werror?
>
> --
> Alan Modra
> Australia Development Lab, IBM
>


Re: Fix build error on OSX

by Tristan Gingold-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 6, 2009, at 4:24 PM, Masaki Muranaka wrote:

> Hello,
>
> The issue is quite simple.
> It should be commented out HAVE_STAT64 on OSX >= 10.5 targets.
>
> In addision above, there have some issues.
> There are not considered warnings in configure stage.
> But they are built with -Werror on build stage.
>
> Okay, it might be wrong my patch. then, how do we fix the build
> option inconsistency between configure stage and build stage?

One easy workaround is to build with --disable-werror.


Re: Fix build error on OSX

by Masaki MURANAKA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Exactly it's easy. And it is an un-cool solution I think.
Adding -Werror is useful to keep the quality high.
That's a reason why we added it, right?

On 2009/11/07, at 0:44, Tristan Gingold wrote:

>
> On Nov 6, 2009, at 4:24 PM, Masaki Muranaka wrote:
>
>> Hello,
>>
>> The issue is quite simple.
>> It should be commented out HAVE_STAT64 on OSX >= 10.5 targets.
>>
>> In addision above, there have some issues.
>> There are not considered warnings in configure stage.
>> But they are built with -Werror on build stage.
>>
>> Okay, it might be wrong my patch. then, how do we fix the build
>> option inconsistency between configure stage and build stage?
>
> One easy workaround is to build with --disable-werror.
>
>


Re: Fix build error on OSX

by Masaki MURANAKA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

This is the another plan.

How about adding -Wno-deprecated-declarations to GCC_WARN_CFLAGS
in bfd/warning.m4 ?
I tested OSX (Snow Leopard) and it passed 'make check.'
I've not tested on Debian5 but I guess there are no side effects.

Maybe functions marked as deprecated work with no troubles on almost all runtimes.
But it is also reasonable that mainainers think all of warnings should be rejected on build stage.
It's depends on how maintainers think about the deprecation attribute whether this
suggestion is acceptable or not.

I'll generate patches again if the mainainers accepts my suggestion.



On 2009/11/06, at 15:15, Alan Modra wrote:

> On Fri, Nov 06, 2009 at 01:47:57PM +0900, Masaki Muranaka wrote:
>> Why are you concluding I didn't test? ;-)
>
> Your patch sets -Werror in CFLAGS.  How can setting -Werror avoid an
> error caused by -Werror?
>
> --
> Alan Modra
> Australia Development Lab, IBM
>


Re: Fix build error on OSX

by Alan Modra :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 07, 2009 at 11:19:41PM +0900, Masaki Muranaka wrote:
> How about adding -Wno-deprecated-declarations to GCC_WARN_CFLAGS
> in bfd/warning.m4 ?

Jan should commit a patch soon that ought to fix this without your
proposed workaround.

--
Alan Modra
Australia Development Lab, IBM

Re: Fix build error on OSX

by Masaki MURANAKA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

You mean I don't need to create patches because Jan will fix soon?
OK. I look forward to fixing this issue.

On 2009/11/10, at 10:55, Alan Modra wrote:

> On Sat, Nov 07, 2009 at 11:19:41PM +0900, Masaki Muranaka wrote:
>> How about adding -Wno-deprecated-declarations to GCC_WARN_CFLAGS
>> in bfd/warning.m4 ?
>
> Jan should commit a patch soon that ought to fix this without your
> proposed workaround.
>
> --
> Alan Modra
> Australia Development Lab, IBM
>