ndoutils compilation problem on Solaris 10
Damien Bastié
damien at merione.net
Wed Apr 19 08:55:19 CEST 2006
Yeah all work fine :-)
I have a "gruik" patch solution .......
in src/db.c and src/ndomod.c :
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define CHUNKSIZE 512
int
vasprintf(char **ret, const char *fmt, va_list ap)
{
int chunks;
size_t buflen;
char *buf;
int len;
chunks = ((strlen(fmt) + 1) / CHUNKSIZE) + 1;
buflen = chunks * CHUNKSIZE;
for (;;) {
if ((buf = malloc(buflen)) == NULL) {
*ret = NULL;
return -1;
}
len = vsnprintf(buf, buflen, fmt, ap);
if (len >= 0 && len < (buflen - 1)) {
break;
}
free(buf);
buflen = (++chunks) * CHUNKSIZE;
/*
* len >= 0 are required for vsnprintf implementation
that
* return -1 of buffer insufficient
*/
if (len >= 0 && len >= buflen) {
buflen = len + 1;
}
}
*ret = buf;
return len;
FILE *fp;
*ret = NULL;
}
int
asprintf(char **ret, const char *fmt, ...)
{
int len;
va_list ap;
va_start(ap, fmt);
len = vasprintf(ret, fmt, ap);
va_end(ap);
return len;
}
Damien
Le 15 avr. 06, à 01:35, Damien Bastié a écrit :
> 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
> 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, à 01:33, Damien Bastié a écrit :
>
>> Another error ...
>>
>> gcc -g -O2 -DHAVE_CONFIG_H -D BUILD_NAGIOS_2X -o ndo2db-2x ndo2db.c
>> 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
>> dbhandlers-2x.o io.o utils.o db.o -lnsl -lsocket -lmysqlclient
>> Undefined first referenced
>> symbol in file
>> ceil utils.o (symbol belongs to
>> 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
>> to :
>>
>> ndo2db-2x: ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC)
>> $(COMMON_OBJS) dbhandlers-2x.o
>> $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_2X -o ndo2db-2x
>> ndo2db.c dbhandlers-2x.o $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS)
>> $(DBLDFLAGS) $(LIBS) $(SOCK
>> ETLIBS) $(DBLIBS) $(OTHERLIBS)
>>
>>
>> Damien
>>
>> Le 14 avr. 06, à 20:54, Damien Bastié a écrit :
>>
>>> Hi,
>>>
>>> I have corrected the problem by adding in io.c file :
>>>
>>> #define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *)
>>> 0)->sun_path) + strlen ((ptr)->sun_path))
>>>
>>> Damien
>>>
>>> Le 14 avr. 06, à 18:25, Damien Bastié a écrit :
>>>
>>>> Hi,
>>>>
>>>> I tried to compil ndoutils with my Solaris 10 box, and i have these
>>>> following errors :
>>>> # make
>>>>
>>>> cd ./src/; make ; cd ..
>>>> make[1]: Entering directory
>>>> `/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
>>>> -lm -lnsl -lsocket
>>>> Symbole première référence
>>>> non défini dans le fichier
>>>> SUN_LEN io.o
>>>> ld: fatal : Erreurs dans le référencement des symboles. Aucun
>>>> résultat n'a été écrit dans file2sock
>>>> collect2: ld returned 1 exit status
>>>> make[1]: *** [file2sock] Error 1
>>>> make[1]: Leaving directory
>>>> `/export/home/compilation/ndoutils-1.3.1/src'
>>>>
>>>>
>>>> (Sorry i have french box)
>>>>
>>>> It seems that SUN_LEN doesn't exist on Solaris...
>>>>
>>>> Anyone have a small patch ?
>>>>
>>>> Thx in advance,
>>>>
>>>> Damien
>>>>
>>>>
>>>> -------------------------------------------------------
>>>> This SF.Net email is sponsored by xPML, a groundbreaking scripting
>>>> language
>>>> that extends applications into web and mobile media. Attend the
>>>> live webcast
>>>> and join the prime developer group breaking into this new coding
>>>> territory!
>>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
>>>> _______________________________________________
>>>> Nagios-devel mailing list
>>>> Nagios-devel at lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>>>
>>>
Damien Bastié
Administrateur Système et Réseau.
BRAINTEC
9 rue Santos Dumont, 75015 PARIS
Tél : 33 156085200 - Fax : 33 156085239
http://www.braintec.fr
>>>
>>
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by xPML, a groundbreaking scripting
>> language
>> that extends applications into web and mobile media. Attend the live
>> webcast
>> and join the prime developer group breaking into this new coding
>> territory!
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
>> _______________________________________________
>> Nagios-devel mailing list
>> Nagios-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
More information about the Developers
mailing list