Closed icinga-migration closed 13 years ago
Updated by alexs77 on 2010-06-21 11:49:37 +00:00
Problem also exists when using gcc on Solaris (gccfss [[http://cooltools.sunsource.net/gcc/]] in this case):
--($ ~/Source/icinga-1.0.1)-- make all
cd ./base && make
/opt/gccfss/gcc/bin/sparc-sun-solaris2.10-gcc-4.3.3 -xarch=sparcima -xcache=128/64/2:5120/64/10 -xchip=sparc64vii -mcpu=sparc64vii -xprefetch=auto,explicit -xprefetch_level=2 -O5 -xvector=no -xbuiltin=%all -fsimple=2 -ftrap=%none -xlibmopt -fns -xalias_level=basic -depend -I/opt/csw/include -I/opt/local/libdbi/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO -I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE -DHAVE_CONFIG_H -DNSCORE -c ../common/snprintf.c
cc1: warning: unrecognized gcc debugging option: e
cc1: warning: unrecognized gcc debugging option: e
/opt/gccfss/gcc/bin/sparc-sun-solaris2.10-gcc-4.3.3 -xarch=sparcima -xcache=128/64/2:5120/64/10 -xchip=sparc64vii -mcpu=sparc64vii -xprefetch=auto,explicit -xprefetch_level=2 -O5 -xvector=no -xbuiltin=%all -fsimple=2 -ftrap=%none -xlibmopt -fns -xalias_level=basic -depend -I/opt/csw/include -I/opt/local/libdbi/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO -I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE -DHAVE_CONFIG_H -DNSCORE -o icinga icinga.c broker.o nebmods.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o skiplist.o utils.o retention-base.o xretention-base.o comments-base.o xcomments-base.o objects-base.o xobjects-base.o statusdata-base.o xstatusdata-base.o perfdata-base.o xperfdata-base.o downtime-base.o xdowntime-base.o ../common/snprintf.o perlxsi.o -L/opt/csw/lib -L/opt/local/libdbi/lib/ -R /usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE /usr/perl5/5.8.4/lib/sun4-solaris-64int/auto/DynaLoader/DynaLoader.a -L/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE -lperl -lsocket -lnsl -ldl -lm -lc -lm -lsocket -lpthread -ldl -lrt -lsocket
sparc-sun-solaris2.10-gcc-4.3.3: ../common/snprintf.o: No such file or directory
cc1: warning: unrecognized gcc debugging option: e
cc1: warning: unrecognized gcc debugging option: e
*** Error code 1
make: Fatal error: Command failed for target `icinga'
Current working directory /export/home/user/Source/icinga-1.0.1/base
*** Error code 1
make: Fatal error: Command failed for target `all'
Interestingly, during ./configure
, it found:
[...]
checking for asprintf... no
[...]
But despite that, icinga tried to use the non-existant asprint()
function.
The problem also exists in git icinga-core (checked out 2010-06-21):
--($ ~/Source/icinga-core)-- make all
cd ./base && make
/opt/gccfss/gcc/bin/sparc-sun-solaris2.10-gcc-4.3.3 -Wall -xarch=sparcima -xcache=128/64/2:5120/64/10 -xchip=sparc64vii -mcpu=sparc64vii -xprefetch=auto,explicit -xprefetch_level=2 -O5 -xvector=no -xbuiltin=%all -fsimple=2 -ftrap=%none -xlibmopt -fns -xalias_level=basic -depend -I/opt/csw/include -I/opt/local/libdbi/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO -I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE -DHAVE_CONFIG_H -DNSCORE -c checks.c
cc1: warning: unrecognized gcc debugging option: e
cc1: warning: unrecognized gcc debugging option: e
checks.c: In function 'run_async_service_check':
checks.c:483: warning: implicit declaration of function 'asprintf'
checks.c:719: error: 'n_a' undeclared (first use in this function)
checks.c:719: error: (Each undeclared identifier is reported only once
checks.c:719: error: for each function it appears in.)
checks.c:719: warning: left-hand operand of comma expression has no effect
checks.c:363: warning: unused variable 'Perl___notused'
*** Error code 1
make: Fatal error: Command failed for target `checks.o'
Current working directory /export/home/user/Source/icinga-core/base
*** Error code 1
make: Fatal error: Command failed for target `all'
Updated by mfriedrich on 2010-06-21 16:25:47 +00:00
the n_a was removed during a cleanup, i think it's default expected in this function with embedded perl - readded it. asprintf is not the real problem - above common/snprintf.o is not built properly which is why it fails in the next step
cc1: warning: unrecognized gcc debugging option: e
seems rather strange to me.
Updated by alexs77 on 2010-06-21 17:46:11 +00:00
Yes, I then also read the error message correctly, and it is like you say - it fails because of n_a. :)
But still… If you check eg. checks.c:483, asprintf() is invoked (or not…). Is icinga going to work fine, if all those asprintf() (in checks.c and whereever…) actually do nothing?
It exists - but in the base directory, not in the common directory! If I copy/link it from base -> common, all is well (that's actually an error carried over from Nagios 3.2.0). I remembered that I had to do this on Nagios as well. It seems to be well known .
Updated by mfriedrich on 2010-06-21 21:50:04 +00:00
hm, we need to get a deeper look on the asprintf problem on solaris.
any thoughts on this? http://osdir.com/ml/network.nagios.devel/2006-04/msg00038.html
or on the opsera patches? http://labs.opsview.com/2008/03/ndoutils-on-solaris-10/
especially those:
ndoutils_sunos.h, ndoutils_sunos.c and ndoutils_build_on_solaris.patch
These files include asprintf() and vasprintf(), which are not available on solaris. However, this is not the best way of handling this. A more appropriate way would be to be only include if ./configure saw they were missing. I’d be inclined to use gnulib to add this function in, because then there’s a whole set of other functions that can be brought in as well. The Nagios Plugins use this in their project to great success. If Ethan says the word, we’ll make this a better patch. But it works for now.
the best thing would be to check for them available during configure and if not there, setting a #define which is being checked in source compilation - e,g, in include/common.h and module/idoutils/include/common.h - #ifdef USE_SOLARIS include "include/sunos_icinga.h" which holds all function prototypes, common/sunos_icinga.c holds the definitions then. thoughts on that?
regarding snprintf - common/Makefile does not hold anything to compile. Can you point me there where snprintf gets set into base/ instead of common/? which Makefile invokes that exactly?
'make all' steps into base, cgi and html dirs do make the files.
cd $(SRC_BASE) && $(MAKE) cd $(SRC_CGI) && $(MAKE) cd $(SRC_HTM) && $(MAKE)
but then i'm stuck.
but since shared.o (thanks to Andreas Ericsson's patches) also runs into common/ and is compiled during base/ I would consider the same solution for that.
add below
$(SRC_COMMON)/shared.o: $(SRC_COMMON)/shared.c
$(CC) $(CFLAGS) -c -o $@ $<
this
$(SRC_COMMON)/snprintf.o: $(SRC_COMMON)/snprintf.c
$(CC) $(CFLAGS) -c -o $@ $<
also adding that to OBJ variable.
this will result in snprintf.o in common/ and can be used in further context with solaris while others won't need that (make clean removes it again).
can you please test that?
diff --git a/base/Makefile.in b/base/Makefile.in
index 66c1821..d709ede 100644
--- a/base/Makefile.in
+++ b/base/Makefile.in
@@ -120,7 +120,7 @@ DDATAHDRS=
DDATADEPS=$(DDATALIBS)
-OBJS=$(BROKER_O) $(SRC_COMMON)/shared.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o skiplist.o utils.o profiler.o $(RDATALIBS) $(CDATALIB
+OBJS=$(BROKER_O) $(SRC_COMMON)/shared.o $(SRC_COMMON)/snprintf.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o skiplist.o utils.o profiler.
OBJDEPS=$(ODATADEPS) $(ODATADEPS) $(RDATADEPS) $(CDATADEPS) $(SDATADEPS) $(PDATADEPS) $(DDATADEPS) $(BROKER_H)
all: icinga icingastats
@@ -173,6 +173,9 @@ xretention-base.o: $(SRC_XDATA)/$(XRDC) $(SRC_XDATA)/$(XRDH)
$(SRC_COMMON)/shared.o: $(SRC_COMMON)/shared.c
$(CC) $(CFLAGS) -c -o $@ $<
+$(SRC_COMMON)/snprintf.o: $(SRC_COMMON)/snprintf.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
########## ICINGA ##########
Updated by mfriedrich on 2010-06-21 21:55:41 +00:00
Updated by mfriedrich on 2010-06-21 21:56:05 +00:00
Updated by mfriedrich on 2010-06-21 21:56:17 +00:00
Updated by alexs77 on 2010-06-23 07:47:20 +00:00
I get this now:
[...]
/opt/local/ccache/bin/ccache /opt/sunstudio12.1/bin/cc -xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xipo=1 -I/opt/local/gd/include -I/opt/local/libdbi/include -DHAVE_CONFIG_H -DNSCORE -o icinga icinga.c broker.o nebmods.o ../common/shared.o ../common/snprintf.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o skiplist.o utils.o profiler.o retention-base.o xretention-base.o comments-base.o xcomments-base.o objects-base.o xobjects-base.o statusdata-base.o xstatusdata-base.o perfdata-base.o xperfdata-base.o downtime-base.o xdowntime-base.o ../common/snprintf.o -L/opt/local/gd/lib -L/opt/local/libdbi/lib/ -lm -lsocket -lnsl -lpthread -ldl -lrt -lnsl -lsocket
"icinga.c", line 663: warning: implicit function declaration: asprintf
ld: warning: file ../common/snprintf.o: attempted multiple inclusion of file
ld: warning: file ../common/snprintf.o: attempted multiple inclusion of file
[...]
But that doesn't seem to hurt - it compiles fine now (as far as that's concerned).
I also think, that these should only be used, if required. For that, I thought about this:
--- icinga-core.unpatched/configure.in Di Jun 22 09:03:51 2010
+++ icinga-core/configure.in Mi Jun 23 09:31:30 2010
@@ -61,10 +61,11 @@
fi
fi
-AC_CHECK_FUNC(vsnprintf,,SNPRINTF_O=../common/snprintf.o)
-AC_CHECK_FUNC(snprintf,,SNPRINTF_O=../common/snprintf.o)
-AC_CHECK_FUNC(asprintf,,SNPRINTF_O=../common/snprintf.o)
-AC_CHECK_FUNC(vasprintf,,SNPRINTF_O=../common/snprintf.o)
+dnl Define C preprocessor variables, so that functions can be re-implemented, if missing
+AC_CHECK_FUNC(vsnprintf,[AC_DEFINE(HAVE_VSNPRINTF, 1, [Whether vsnprintf() is available])],SNPRINTF_O=../common/snprintf.o)
+AC_CHECK_FUNC(snprintf,[AC_DEFINE(HAVE_SNPRINTF, 1, [Whether snprintf() is available])],SNPRINTF_O=../common/snprintf.o)
+AC_CHECK_FUNC(asprintf,[AC_DEFINE(HAVE_ASNPRINTF, 1, [Whether asprintf() is available])],SNPRINTF_O=../common/snprintf.o)
+AC_CHECK_FUNC(vasprintf,[AC_DEFINE(HAVE_VASPRINTF, 1, [Whether vasprintf() is available])],SNPRINTF_O=../common/snprintf.o)
AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([
(Haven't checked it.)
Idea: We already check if asprintf() & co. are present. The patch should add #HAVE_ASPRINTF. Now I'd split https://dev.icinga.org/attachments/156/ndoutils\_sunos.h and https://dev.icinga.org/attachments/157/ndoutils\_sunos.c into two (or more) files: asprintf.c & asprintf.h and vasprintf.c/.h. Then, add a #ifndef HAVE_ASPRINTF and include asprintf.h/c.
....
Uhm....
Check out common/snprintf.c
:1246 ff and also line 1223ff . There already IS a definition of asprintf() and the like. Why isn't is used? Is it because of what's in include/config.h.in
:92 ff ?
Updated by alexs77 on 2010-06-30 08:59:32 +00:00
Using the latest version of the mfriedrichs/solaris branch, it eventually fails with:
/opt/local/ccache/bin/ccache /opt/sunstudio12.1/bin/cc -xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xipo=1 -I/opt/local/gd/include -I/opt/local/libdbi/include -DHAVE_CONFIG_H -DNSCORE -c -o xdowntime-base.o ../xdata/xdddefault.c
/opt/local/ccache/bin/ccache /opt/sunstudio12.1/bin/cc -xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xipo=1 -I/opt/local/gd/include -I/opt/local/libdbi/include -DHAVE_CONFIG_H -DNSCORE -o icinga icinga.c broker.o nebmods.o ../common/shared.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o skiplist.o utils.o profiler.o retention-base.o xretention-base.o comments-base.o xcomments-base.o objects-base.o xobjects-base.o statusdata-base.o xstatusdata-base.o perfdata-base.o xperfdata-base.o downtime-base.o xdowntime-base.o ../common/snprintf.o -L/opt/local/gd/lib -L/opt/local/libdbi/lib/ -lm -lsocket -lnsl -lpthread -ldl -lrt -lnsl -lsocket
"icinga.c", line 663: warning: implicit function declaration: asprintf
Undefined first referenced
symbol in file
vasprintf logging.o
asprintf icinga.o
ld: fatal: Symbol referencing errors. No output written to icinga
*** Error code 1
make: Fatal error: Command failed for target `icinga'
Current working directory /export/home/user/Source/icinga/icinga-core.git.sun/base
*** Error code 1
make: Fatal error: Command failed for target `all'
Updated by mfriedrich on 2010-06-30 15:21:10 +00:00
mh solaris is outdated, the new approach is here: https://git.icinga.org/?p=icinga-core.git;a=shortlog;h=refs/heads/mfriedrich/sun
Updated by mfriedrich on 2010-10-22 15:21:25 +00:00
i'll leave the last diff over here (git branch cleanup) but i do think that issues are resolved as reported?
removed diff and converted it to attachment
Updated by alexs77 on 2010-10-25 09:25:28 +00:00
dnsmichi wrote:
i'll leave the last diff over here (git branch cleanup) but i do think that issues are resolved as reported?
Uhm, in 1.2.0, I still get the ../common/snprintf.o error.
cd ./base && make
/opt/solstudio12.2/bin/cc -xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xipo=1 -I/opt/local/gd/include -I/opt/local/libdbi/include -DHAVE_CONFIG_H -DNSCORE -c ../common/snprintf.c
"../common/snprintf.c", line 273: warning: initializer will be sign-extended: -1
/opt/solstudio12.2/bin/cc -xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xipo=1 -I/opt/local/gd/include -I/opt/local/libdbi/include -DHAVE_CONFIG_H -DNSCORE -o icinga icinga.c broker.o nebmods.o ../common/shared.o checks.o config.o commands.o events.o flapping.o logging.o macros-base.o netutils.o notifications.o sehandlers.o skiplist.o utils.o profiler.o retention-base.o xretention-base.o comments-base.o xcomments-base.o objects-base.o xobjects-base.o statusdata-base.o xstatusdata-base.o perfdata-base.o xperfdata-base.o downtime-base.o xdowntime-base.o ../common/snprintf.o -L/opt/local/gd/lib -L/opt/local/libdbi/lib -lm -lsocket -lnsl -lpthread -ldl -lrt -lnsl -lsocket
"icinga.c", line 676: warning: implicit function declaration: asprintf
ld: fatal: file ../common/snprintf.o: open failed: No such file or directory
ld: fatal: File processing errors. No output written to /dev/null
/opt/solstudio12.2/prod/bin/ipo: Error inside /usr/ccs/bin/ld
cc: ipo failed for icinga
*** Error code 2
make: Fatal error: Command failed for target `icinga'
Current working directory /export/home/user/Source/icinga/icinga-1.2.0/base
*** Error code 1
make: Fatal error: Command failed for target `all'
Should it have been fixed?
Updated by mfriedrich on 2010-10-25 09:48:47 +00:00
current 1.2.1 holds an reported fix for that. check #858
Updated by alexs77 on 2010-10-25 11:56:19 +00:00
dnsmichi wrote:
current 1.2.1 holds an reported fix for that. check #858
Thx.
I downloaded 1.2.1 and it breaks because of helloworld.o (cf #524 ). Also, lots of messages like this one:
[…]
"../xdata/xodtemplate.c", line 280: warning: implicit function declaration: asprintf
[…]
"../common/downtime.c", line 273: warning: implicit function declaration: asprintf
[…]
"../common/statusdata.c", line 354: warning: implicit function declaration: asprintf
[…]
asprintf() is unknown.
Updated by mfriedrich on 2011-01-10 17:02:42 +00:00
this should be finally resolved by now as sunos detection now compiles common/snprintf.c and makes use of the .o lib all around the corner.
Updated by mfrosch on 2017-01-17 13:29:15 +00:00
This issue has been migrated from Redmine: https://dev.icinga.com/issues/521
Created by alexs77 on 2010-06-21 11:29:01 +00:00
Assignee: mfriedrich Status: Resolved (closed on 2011-01-10 17:02:42 +00:00) Target Version: 1.3 Last Update: 2017-01-17 13:29:14 +00:00 (in Redmine)
Trying to compile icinga-1.0.1 on Solaris 10 using Sun Studio 12 update 1 compiler:
Main problem: "icinga.c", line 651: warning: implicit function declaration: asprintf
Solaris 10 doesn't have asprintf.
(Note: Because of this issue, I tried to use git icinga-core, but didn't work too well... -> Issue #520 )
Attachments
Changesets
2010-06-21 16:25:06 +00:00 by mfriedrich e60e86d116254c5b7181f9c0a82c5e9f6821cd8c
2010-06-22 07:25:35 +00:00 by mfriedrich b3c4e71057a55c93385e218af37bba26f6557d84
2010-06-24 12:02:23 +00:00 by mfriedrich 49cae46314f5980ae1db2ef387c96dd1477de935