Page 1 of 1

Re: [Nagios-devel] ndoutils compilation problem on Solaris 10

Posted: Tue Apr 18, 2006 10:55 pm
by Guest
Yeah all work fine :-)

I have a "gruik" patch solution .......

in src/db.c and src/ndomod.c :


#include
#include

#include
#include
#include

#define CHUNKSIZE 512

int
vasprintf(char **ret, const char *fmt, va_list ap)
{
int chunks;
size_t buflen;
char *buf;
int len;

chunks =3D ((strlen(fmt) + 1) / CHUNKSIZE) + 1;
buflen =3D chunks * CHUNKSIZE;
for (;;) {
if ((buf =3D malloc(buflen)) =3D=3D NULL) {
*ret =3D NULL;
return -1;
}
len =3D vsnprintf(buf, buflen, fmt, ap);
if (len >=3D 0 && len =3D 0 are required for vsnprintf implementation=20=

that
* return -1 of buffer insufficient
*/
if (len >=3D 0 && len >=3D buflen) {
buflen =3D len + 1;
}
}
*ret =3D buf;
return len;
FILE *fp;
*ret =3D NULL;
}

int
asprintf(char **ret, const char *fmt, ...)
{
int len;
va_list ap;

va_start(ap, fmt);
len =3D vasprintf(ret, fmt, ap);
va_end(ap);
return len;
}


Damien

Le 15 avr. 06, =E0 01:35, Damien Basti=E9 a =E9crit :

> Error again ...
>
> asprintf doesn't exist ? I am trying to find a solution ....
>
>
> gcc -g -O2 -DHAVE_CONFIG_H -D BUILD_NAGIOS_2X -o ndo2db-2x ndo2db.c=20=

> dbhandlers-2x.o io.o utils.o db.o -lnsl -lsocket -lmysqlclient -lm
> Undefined first referenced
> symbol in file
> asprintf dbhandlers-2x.o
> ld: fatal: Symbol referencing errors. No output written to ndo2db-2x
> collect2: ld returned 1 exit status
>
> Damien
>
>
> Le 15 avr. 06, =E0 01:33, Damien Basti=E9 a =E9crit :
>
>> Another error ...
>>
>> gcc -g -O2 -DHAVE_CONFIG_H -D BUILD_NAGIOS_2X -o ndo2db-2x ndo2db.c=20=

>> dbhandlers-2x.o io.o utils.o db.o -lnsl -lsocket -lmysqlclient
>> ndo2db.c:14:20: mcheck.h: No such file or directory
>>
>> mcheck doesn't exist on Solaris ?
>>
>> I have tried to comment #define DEBUG_MEMORY 1
>>
>> After i have :
>>
>> gcc -g -O2 -DHAVE_CONFIG_H -D BUILD_NAGIOS_2X -o ndo2db-2x ndo2db.c=20=

>> dbhandlers-2x.o io.o utils.o db.o -lnsl -lsocket -lmysqlclient
>> Undefined first referenced
>> symbol in file
>> ceil utils.o (symbol belongs to=20
>> implicit dependency /usr/lib/libm.so.2)
>> asprintf dbhandlers-2x.o
>> ld: fatal: Symbol referencing errors. No output written to ndo2db-2x
>> collect2: ld returned 1 exit status
>>
>> I have corrected "ceil" problem by adding $(MATHLIBS) in src/Makefile=20=

>> to :
>>
>> ndo2db-2x: ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC)=20
>> $(COMMON_OBJS) dbhandlers-2x.o
>> $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_2X -o ndo2db-2x=20=

>> ndo2db.c dbhandlers-2x.o $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS)=20
>> $(DBLDFLAGS) $(LIBS) $(SOCK
>> ETLIBS) $(DBLIBS) $(OTHERLIBS)
>>
>>
>> Damien
>>
>> Le 14 avr. 06, =E0 20:54, Damien Basti=E9 a =E9crit :
>>
>>> Hi,
>>>
>>> I have corrected the problem by adding in io.c file :
>>>
>>> #define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *)=20
>>> 0)->sun_path) + strlen ((ptr)->sun_path))
>>>
>>> Damien
>>>
>>> Le 14 avr. 06, =E0 18:25, Damien Basti=E9 a =E9crit :
>>>
>>>> Hi,
>>>>
>>>> I tried to compil ndoutils with my Solaris 10 box, and i have these=20=

>>>> following errors :
>>>> # make
>>>>
>>>> cd ./src/; make ; cd ..
>>>> make[1]: Entering directory=20
>>>> `/export/home/compilation/ndoutils-1.3.1/src'
>>>> gcc -g -O2 -DHAVE_CONFIG_H -c -o io.o io.c
>>>> gcc -g -O2 -DHAVE_CONFIG_H -c -o utils.o utils.c
>>>> gcc -g -O2 -DHAVE_CONFIG_H -o file2sock file2sock.c io.o utils.o =20=

>>>> -lm -lnsl -lsocket
>>>> Symbole premi=E8re r=E9f=E9rence
>>>> non d=E9fini dans le fichier
>>>> SUN_LEN io.o
>>>> ld: fatal : Erreurs dans le r=E9f=E9rencement des symboles. Aucun=20=

>>>> r=E9sultat n'a =E9t=E9 =E9crit dans file2sock
>>>> collect2: ld returned 1 exit status
>>>> make[1]: *** [file2sock] Error 1
>>>> make[1]: Leaving directory=20


...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]