[collectd] Compiling collectd-4.6.2 / collectd-git-repo on Solaris 10 Update 6
Peter Bray
pdb_ml at yahoo.com.au
Thu May 14 08:02:51 CEST 2009
Hi Doug,
I have tried collectd-4.7.0 and required just the one alteration for
Solaris 10 Update 6 / GCC 4.1.2 / 32-bit & 64-bit / SPARC & X86:
--- src/bind.c.FCS Thu May 14 13:23:43 2009
+++ src/bind.c Thu May 14 13:24:17 2009
@@ -21,8 +21,6 @@
* Florian Forster <octo at verplant.org>
**/
-#define _XOPEN_SOURCE 600 /* glibc2 needs this for strptime */
-
#include "collectd.h"
#include "common.h"
#include "plugin.h"
If glibc2 really does need this than I think it needs to be wrapped in a
pre-processor conditional maybe like if __GLIBC__ >= 2 (seen else where
in the code).
Regards,
Peter Bray
PS: 32-bit SPARC & X86 require --disable-swap as the compile systems
where running 64-bit kernels (in fact SPARC is 64-bit only these days)
This could probably be auto-detected at configure time (if I knew how)
PPS: Here is the Solaris 10 Update 6 Code that causes the error:
/usr/include/sys/feature_tests.h
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
[deleted]
#if defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE)
#define __XOPEN_OR_POSIX
#endif
[deleted]
/*
* It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application
* using c99. The same is true for POSIX.1-1990, POSIX.2-1992,POSIX.1b,
* and POSIX.1c applications. Likewise, it is invalid to compile an XPG6
* or a POSIX.1-2001 application with anything other than a c99 or later
* compiler. Therefore, we force an error in both cases.
*/
#if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
#error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
and pre-2001 POSIX applications"
#elif !defined(_STDC_C99) && \
(defined(__XOPEN_OR_POSIX) && defined(_XPG6))
#error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
require the use of c99"
#endif
[deleted]
Doug MacEachern wrote:
> Hi Peter,
>
> Can you give the recent 4.7.0 release a try? I believe the recent
> solaris related changes were also merged to the collectd-4.6 branch.
>
> On May 10, 2009, at 3:30 AM, Peter Bray wrote:
>
>>
>> Greetings,
>>
>> I have been trying to compile collectd-4.6.2 on Solaris 10 Update 6
>> (also known as Solaris 10 10/2008) on both SPARC and x86 (AMD64), with
>> both gcc-4.1.2 and Sun Studio 12. I received the following #error from
>> the compilation process:
>>
>> #error "Compiler or options invalid; UNIX 03 and POSIX.1-2001
>> applications require the use of c99"
>>
>> A full example is included at the end of this email. The Sun Studio
>> 12 compiler generates the same error but of course from
>> /usr/include/sys/feature_tests.h (c.f. its GCC counterpart listed below)
>>
>> In 4.6.2, this error occurs for src/libcollectdclient/client.c,
>> src/bind.c, src/target_notification.c, src/target_replace.c,
>> src/target_set.c, src/collectd-nagios.c, src/collectd-nagios.c,
>> src/filter_chain.c, src/meta_data.c while in the current git-repo the
>> error only occurs in src/bind.c. Because one error is easier to fix
>> then many and with the pending release of a new version, I looked into
>> the git-repo build issue with src/bind.c.
>>
>> Looking src/bind.c and the error I decided to comment out:
>>
>> #define _XOPEN_SOURCE 600 /* glibc2 needs this for strptime */
>>
>> The build (from git-repo) now works fine and the collectd seem
>> functional (full configuration and testing pending). Looking again at
>> 4.6.2 again, the list of files that don't compile and those contain
>> _XOPEN_SOURCE we have a nearly perfect correspondence:
>>
>> % find . -type f | xargs grep _XOPEN_SOURCE
>> ./src/bind.c:#ifndef _XOPEN_SOURCE
>> ./src/bind.c:# define _XOPEN_SOURCE 600
>> ./src/target_notification.c:#ifdef _XOPEN_SOURCE
>> ./src/target_notification.c:# undef _XOPEN_SOURCE
>> ./src/target_notification.c:#define _XOPEN_SOURCE 500
>> ./src/target_replace.c:#ifdef _XOPEN_SOURCE
>> ./src/target_replace.c:# undef _XOPEN_SOURCE
>> ./src/target_replace.c:#define _XOPEN_SOURCE 500
>> ./src/target_set.c:#ifdef _XOPEN_SOURCE
>> ./src/target_set.c:# undef _XOPEN_SOURCE
>> ./src/target_set.c:#define _XOPEN_SOURCE 500
>> ./src/filter_chain.c:#ifdef _XOPEN_SOURCE
>> ./src/filter_chain.c:# undef _XOPEN_SOURCE
>> ./src/filter_chain.c:#define _XOPEN_SOURCE 500
>> ./src/meta_data.c:#ifdef _XOPEN_SOURCE
>> ./src/meta_data.c:# undef _XOPEN_SOURCE
>> ./src/meta_data.c:#define _XOPEN_SOURCE 500
>>
>> I would suggest that _XPOEN_SOURCE definition in bind.c be made
>> conditional, but I not sure of the best approach to this issue. It
>> should be noted that this is the last .c file containing a reference
>> to _XOPEN_SOURCE, so maybe the solution used to remove the other
>> instances would be appropriate here.
>>
>> I hope this helps others looking at collectd on Solaris.
>>
>> Regards,
>> Peter Bray
>> Sydney, Australia
>>
>> gmake[4]: Entering directory
>> `/tmp/64-bit/collectd-4.6.2/src/libcollectdclient'
>> /bin/bash ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H
>> -I. -I../../src -D_POSIX_PTHREAD_SEMANTICS -Wall -Werror -g -O2 -c
>> -o client.lo client.c
>> gcc -DHAVE_CONFIG_H -I. -I../../src -D_POSIX_PTHREAD_SEMANTICS -Wall
>> -Werror -g -O2 -c client.c -fPIC -DPIC -o .libs/client.o
>> In file included from /usr/include/iso/stdlib_iso.h:30,
>> from /usr/include/stdlib.h:18,
>> from client.c:57:
>> /pkgs/64-bit/release/gcc-4.1.2/lib/gcc/i386-pc-solaris2.10/4.1.2/include/sys/feature_tests.h:345:2:
>> error: #error "Compiler or options invalid; UNIX 03 and POSIX.1-2001
>> applications require the use of c99"
>> gmake[4]: *** [client.lo] Error 1
>>
>>
>>
>>
>>
>> _______________________________________________
>> collectd mailing list
>> collectd at verplant.org
>> http://mailman.verplant.org/listinfo/collectd
>
>
More information about the collectd
mailing list