From: Mark Hobley on

I am trying to compile motor, and I am getting an error as follows:

Making all in src
make[3]: Entering directory `/volumes/vol3a/build/motor/motor-3.4.0/
parser/src'
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../include -g -O2 -c llist.c
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../include -g -O2 -c parlist.c
In file included from parlist.c:29:
.../include/strfn.h:51: error: conflicting types for 'strndup'
make[3]: *** [parlist.o] Error 1

Has anyone else seen this error, and does anyone know how to fix this?

Mark.

--
/local/home/mark/.Signature

--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: despen on
Mark Hobley <markhobley(a)yahoo.donottypethisbit.co> writes:

> I am trying to compile motor, and I am getting an error as follows:
>
> Making all in src
> make[3]: Entering directory `/volumes/vol3a/build/motor/motor-3.4.0/
> parser/src'
> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../include -g -O2 -c llist.c
> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../include -g -O2 -c parlist.c
> In file included from parlist.c:29:
> ../include/strfn.h:51: error: conflicting types for 'strndup'
> make[3]: *** [parlist.o] Error 1
>
> Has anyone else seen this error, and does anyone know how to fix this?

Conflicting types means just what it says, it's encountered 2 different
definitions for what strndup does.

"man strndup" says:

#include <string.h>
char *strndup(const char *s, size_t n);

It looks like the "motor" package has a conflicting definition in its
own "../include/strfn.h" file.


The "configure" step SHOULD have detected that your system already
has a strndup function and not supplied it's own definition.
From: Mark Hobley on
On Wed, 02 Jun 2010 17:29:00 -0400, despen wrote:

> Conflicting types means just what it says, it's encountered 2 different
> definitions for what strndup does.
>
> "man strndup" says:
>
> #include <string.h>
> char *strndup(const char *s, size_t n);
>
> It looks like the "motor" package has a conflicting definition in its
> own "../include/strfn.h" file.
>
>
> The "configure" step SHOULD have detected that your system already has a
> strndup function and not supplied it's own definition.

Looking at the code, the definition for strndup is as follows:

/* string function */
char *strndup(const char *src, int size) {
int s;
char *r;

if ((s = strlen(src)) > size) s = size;

r = calloc(1, s + 1);
memcpy(r, src, s);

return r;
}

AFAICT, There are currently no conditions around this definition in the
motor source code. What should I do here? Should I just zap the function
definition from the motor code, or is there an operational difference
that needs to be considered? It seems odd that this function has been
defined in the motor code when the function is already provided by the
string.h header.

--
/local/home/mark/.Signature

--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: despen on
Mark Hobley <markhobley(a)yahoo.donottypethisbit.co> writes:

> On Wed, 02 Jun 2010 17:29:00 -0400, despen wrote:
>
>> Conflicting types means just what it says, it's encountered 2 different
>> definitions for what strndup does.
>>
>> "man strndup" says:
>>
>> #include <string.h>
>> char *strndup(const char *s, size_t n);
>>
>> It looks like the "motor" package has a conflicting definition in its
>> own "../include/strfn.h" file.
>>
>>
>> The "configure" step SHOULD have detected that your system already has a
>> strndup function and not supplied it's own definition.
>
> Looking at the code, the definition for strndup is as follows:
>
> /* string function */
> char *strndup(const char *src, int size) {
> int s;
> char *r;
>
> if ((s = strlen(src)) > size) s = size;
>
> r = calloc(1, s + 1);
> memcpy(r, src, s);
>
> return r;
> }
>
> AFAICT, There are currently no conditions around this definition in the
> motor source code. What should I do here? Should I just zap the function
> definition from the motor code, or is there an operational difference
> that needs to be considered? It seems odd that this function has been
> defined in the motor code when the function is already provided by the
> string.h header.

Zap it.

Strndup must be fairly recent. I've seen other packages that supply
a replacement.
From: Cat 22 on
Mark Hobley wrote:

>
> I am trying to compile motor, and I am getting an error as follows:
>
> Making all in src
> make[3]: Entering directory
> `/volumes/vol3a/build/motor/motor-3.4.0/ parser/src'
> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../include -g -O2 -c
> llist.c
> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../include -g -O2 -c
> parlist.c In file included from parlist.c:29:
> ../include/strfn.h:51: error: conflicting types for 'strndup'
> make[3]: *** [parlist.o] Error 1
>
> Has anyone else seen this error, and does anyone know how to fix
> this?
>
> Mark.
>
After you removed the strndup code there, did it compile ok? did it
run?
Seeing your post i was curious and downloaded the source. It has a
lot of compile errors and I am not sure that what he is doing there
in some cases is valid or a typo.
e.g
int texteditor::findint(void *p1, void *p2) {
return *(int *) p1 != (int) p2;
}

I also tried installing the mandriva motor package and it segfaults
on startup
How did you make out?
Cat22