2010-09-21 16:39:19

by Ben Greear

[permalink] [raw]
Subject: Patch to get iw building on Fedora 8

I need this in order to get iw to build on Fedora 8.

[greearb@fs2 iw]$ git diff
diff --git a/bitrate.c b/bitrate.c
index 8de8839..9b6defc 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -1,4 +1,6 @@
#include <errno.h>
+#define __USE_ISOC99
+#include <stdlib.h>

#include "nl80211.h"
#include "iw.h"

Signed-off-by: Ben Greear<[email protected]>

--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com



2010-09-24 09:31:29

by Johannes Berg

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

On Thu, 2010-09-23 at 16:05 -0700, Ben Greear wrote:
> I notice that you added some code to try to get this working:
>
> #ifndef _ISOC99_SOURCE
> #define _ISOC99_SOURCE
> #endif
>
>
> However, it still will not build for me on Fedora 8. In case I'm doing something
> else strange..were you able to build it on FC8 by any chance?
>
> I can easily carry the fix in my own tree, but thought
> you might want to know...

No, I don't have FC8 anywhere ... Does it build for you with -std=c99?
But that gives me a lot of warnings due to a libnl header file bug
("extern inline").

johannes


2010-09-21 19:49:56

by Andreas Schwab

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

Ben Greear <greearb-my8/[email protected]> writes:

> I need this in order to get iw to build on Fedora 8.
>
> [greearb@fs2 iw]$ git diff
> diff --git a/bitrate.c b/bitrate.c
> index 8de8839..9b6defc 100644
> --- a/bitrate.c
> +++ b/bitrate.c
> @@ -1,4 +1,6 @@
> #include <errno.h>
> +#define __USE_ISOC99

This is wrong. You must never define internal glibc macros.

Andreas.

--
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2010-09-21 17:28:05

by Johannes Berg

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

On Tue, 2010-09-21 at 09:39 -0700, Ben Greear wrote:
> I need this in order to get iw to build on Fedora 8.
>
> [greearb@fs2 iw]$ git diff
> diff --git a/bitrate.c b/bitrate.c
> index 8de8839..9b6defc 100644
> --- a/bitrate.c
> +++ b/bitrate.c
> @@ -1,4 +1,6 @@
> #include <errno.h>
> +#define __USE_ISOC99
> +#include <stdlib.h>

had to add #ifndef guards, but applied it.

johannes


2010-09-22 16:53:16

by Ben Greear

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

On 09/21/2010 02:34 PM, Johannes Stezenbach wrote:
> On Tue, Sep 21, 2010 at 02:09:57PM -0700, Ben Greear wrote:
>> On 09/21/2010 12:49 PM, Andreas Schwab wrote:
>>> Ben Greear<greearb-my8/[email protected]> writes:
>>>
>>>> I need this in order to get iw to build on Fedora 8.
>>>>
> ...
>>>> +#define __USE_ISOC99
>>>
>>> This is wrong. You must never define internal glibc macros.
>>
>> How about this then?
> ...
>> - tmpf = strtof(argv[i],&end);
>> + tmpf = strtod(argv[i],&end);
> ...
>> Seems you don't have to do anything clever to get strtod to work,
>> and I assume it should cast just fine.
>
> I think to use C99 features like strtof() you need to either
> add -std=c99 to CFLAGS, or #define _ISOC99_SOURCE
> (see /usr/include/features.h).

It seems using strtod would be simpler all around, and might work on
more compilers and even more ancient systems.

Thanks,
Ben

>
> HTH,
> Johannes


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com


2010-09-24 13:45:13

by Ben Greear

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

On 09/24/2010 02:31 AM, Johannes Berg wrote:
> On Thu, 2010-09-23 at 16:05 -0700, Ben Greear wrote:
>> I notice that you added some code to try to get this working:
>>
>> #ifndef _ISOC99_SOURCE
>> #define _ISOC99_SOURCE
>> #endif
>>
>>
>> However, it still will not build for me on Fedora 8. In case I'm doing something
>> else strange..were you able to build it on FC8 by any chance?
>>
>> I can easily carry the fix in my own tree, but thought
>> you might want to know...
>
> No, I don't have FC8 anywhere ... Does it build for you with -std=c99?
> But that gives me a lot of warnings due to a libnl header file bug
> ("extern inline").

Any problem with just changing it to 'strtod' ?

That compiles back at least as far as FC5.

Ben

>
> johannes


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

2010-09-21 21:10:10

by Ben Greear

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

On 09/21/2010 12:49 PM, Andreas Schwab wrote:
> Ben Greear<greearb-my8/[email protected]> writes:
>
>> I need this in order to get iw to build on Fedora 8.
>>
>> [greearb@fs2 iw]$ git diff
>> diff --git a/bitrate.c b/bitrate.c
>> index 8de8839..9b6defc 100644
>> --- a/bitrate.c
>> +++ b/bitrate.c
>> @@ -1,4 +1,6 @@
>> #include<errno.h>
>> +#define __USE_ISOC99
>
> This is wrong. You must never define internal glibc macros.

How about this then?

diff --git a/bitrate.c b/bitrate.c
index 8de8839..f0d513f 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -70,7 +70,7 @@ static int handle_bitrates(struct nl80211_state *state,
#endif
else switch (parser_state) {
case S_LEGACY:
- tmpf = strtof(argv[i], &end);
+ tmpf = strtod(argv[i], &end);
if (*end != '\0')
return 1;
if (tmpf < 1 || tmpf > 255 * 2)

Seems you don't have to do anything clever to get strtod to work,
and I assume it should cast just fine.

Thanks,
Ben

>
> Andreas.
>


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com


2010-09-24 13:58:27

by Johannes Berg

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

On Fri, 2010-09-24 at 06:45 -0700, Ben Greear wrote:
> On 09/24/2010 02:31 AM, Johannes Berg wrote:
> > On Thu, 2010-09-23 at 16:05 -0700, Ben Greear wrote:
> >> I notice that you added some code to try to get this working:
> >>
> >> #ifndef _ISOC99_SOURCE
> >> #define _ISOC99_SOURCE
> >> #endif
> >>
> >>
> >> However, it still will not build for me on Fedora 8. In case I'm doing something
> >> else strange..were you able to build it on FC8 by any chance?
> >>
> >> I can easily carry the fix in my own tree, but thought
> >> you might want to know...
> >
> > No, I don't have FC8 anywhere ... Does it build for you with -std=c99?
> > But that gives me a lot of warnings due to a libnl header file bug
> > ("extern inline").
>
> Any problem with just changing it to 'strtod' ?

I did that earlier today.

johannes


2010-09-21 22:06:47

by Johannes Stezenbach

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

On Tue, Sep 21, 2010 at 02:09:57PM -0700, Ben Greear wrote:
> On 09/21/2010 12:49 PM, Andreas Schwab wrote:
> >Ben Greear<greearb-my8/[email protected]> writes:
> >
> >>I need this in order to get iw to build on Fedora 8.
> >>
...
> >>+#define __USE_ISOC99
> >
> >This is wrong. You must never define internal glibc macros.
>
> How about this then?
...
> - tmpf = strtof(argv[i], &end);
> + tmpf = strtod(argv[i], &end);
...
> Seems you don't have to do anything clever to get strtod to work,
> and I assume it should cast just fine.

I think to use C99 features like strtof() you need to either
add -std=c99 to CFLAGS, or #define _ISOC99_SOURCE
(see /usr/include/features.h).

HTH,
Johannes

2010-09-23 23:05:21

by Ben Greear

[permalink] [raw]
Subject: Re: Patch to get iw building on Fedora 8

I notice that you added some code to try to get this working:

#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE
#endif


However, it still will not build for me on Fedora 8. In case I'm doing something
else strange..were you able to build it on FC8 by any chance?

I can easily carry the fix in my own tree, but thought
you might want to know...

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com