我正在尝试构建collectd系统性能监控包(版本5.4.1;在Fedora v20 VM上构建collectd)并想使用write_mongodb插件。
我./configure
在文件夹 collectd-5.4.1 中运行,在那里我下载了包源文件,但由于以下错误而无法获得 write_mongodb 支持(如 collectd 文件夹的 config.log 文件中所示):
/home/user01/Documents/libs/collectd-5.4.1/conftest.c:181: undefined reference to 'mongo_run_command'
我正在尝试链接到我之前编译生成 libmongoc-1.0.so.0.0.0(版本 0.96.4)的 mongo-c-driver 库。
我在脚本中进行了以下修改configure
以链接到 libmongoc:
LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L/usr/local/lib/ -L/usr/local/lib/"
并将文件复制到文件mongoc.h
夹中/usr/local/include/libmongoc-1.0/mongo.h
config.log
以下是collectd 文件夹中配置脚本输出的片段,其中包含与mongo_run_command
.
configure:21551: libmongoc CPPFLAGS: -I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/
configure:21556: checking for mongo.h
configure:21556: gcc -c -g -O2 -I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/ conftest.c >&5
configure:21556: $? = 0
configure:21556: result: yes
configure:21579: libmongoc LDFLAGS: -L/usr/local/lib/ -L/usr/local/lib/
configure:21582: checking for mongo_run_command in -lmongoc
configure:21607: gcc -o conftest -g -O2 -I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/ -L/usr/local/lib/ -L/usr/local/lib/ conftest.c -lmongoc -ldl >&5
/tmp/ccyc9VGB.o: In function 'main':
/home/user01/Documents/libs/collectd-5.4.1/conftest.c:181: undefined reference to 'mongo_run_command'
collect2: error: ld returned 1 exit status
configure:21607: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "collectd"
| #define PACKAGE_TARNAME "collectd"
| #define PACKAGE_VERSION "5.4.1"
| #define PACKAGE_STRING "collectd 5.4.1"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define LT_MODULE_EXT ".so"
| #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH"
| #define LT_DLSEARCH_PATH "/lib:/usr/lib:/usr/lib64/dyninst:/usr/lib64/iscsi:/usr/lib64/llvm:/usr/local/lib/usr/lib64/tracker-0.16:/usr/lib64/xulrunner:/usr/local/lib"
| #define HAVE_LIBDL 1
| #define HAVE_DLERROR 1
| #define HAVE_LIBDLLOADER 1
| #define HAVE_ARGZ_H 1
| #define HAVE_ERROR_T 1
| #define HAVE_ARGZ_ADD 1
| #define HAVE_ARGZ_APPEND 1
| #define HAVE_ARGZ_COUNT 1
| #define HAVE_ARGZ_CREATE_SEP 1
| #define HAVE_ARGZ_INSERT 1
| #define HAVE_ARGZ_NEXT 1
| #define HAVE_ARGZ_STRINGIFY 1
| #define HAVE_WORKING_ARGZ 1
| #define HAVE_PRELOADED_SYMBOLS 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_CLOSEDIR 1
| #define HAVE_OPENDIR 1
| #define HAVE_READDIR 1
| #define LT_LIBEXT "a"
| #define LT_LIBPREFIX "lib"
| #define LIBTOOL_VERSION 2
| #define PACKAGE "collectd"
| #define VERSION "5.4.1"
| #define KERNEL_LINUX 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE__BOOL 1
| #define HAVE_STDBOOL_H 1
| #define HAVE_STDIO_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_MATH_H 1
| #define HAVE_STDARG_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_ASSERT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_POLL_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_REGEX_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_ENDIAN_H 1
| #define HAVE_FNMATCH_H 1
| #define HAVE_LIBGEN_H 1
| #define HAVE_NETINET_IN_SYSTM_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_NETINET_IP_H 1
| #define HAVE_NETINET_IP_ICMP_H 1
| #define HAVE_NETINET_IP6_H 1
| #define HAVE_NETINET_ICMP6_H 1
| #define HAVE_NETINET_TCP_H 1
| #define HAVE_NETINET_UDP_H 1
| #define HAVE_SYS_SYSCTL_H 1
| #define HAVE_LINUX_MAJOR_H 1
| #define HAVE_LINUX_RAID_MD_U_H 1
| #define HAVE_LINUX_WIRELESS_H 1
| #define HAVE_SYS_SWAP_H 1
| #define HAVE_UTMP_H 1
| #define HAVE_UTMPX_H 1
| #define HAVE_IFADDRS_H 1
| #define HAVE_NET_IF_H 1
| #define HAVE_LINUX_IF_H 1
| #define HAVE_LINUX_NETDEVICE_H 1
| #define HAVE_LINUX_SOCKIOS_H 1
| #define HAVE_LINUX_ETHTOOL_H 1
| #define HAVE_LINUX_IP_VS_H 1
| #define HAVE_SYS_MOUNT_H 1
| #define HAVE_LINUX_UN_H 1
| #define HAVE_PWD_H 1
| #define HAVE_GRP_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_CTYPE_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_PATHS_H 1
| #define HAVE_MNTENT_H 1
| #define HAVE_SYS_STATFS_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_WORDEXP_H 1
| #define HAVE_ARPA_NAMESER_H 1
| #define HAVE_ARPA_NAMESER_COMPAT_H 1
| #define HAVE_NET_IF_ARP_H 1
| #define HAVE_NET_PPP_DEFS_H 1
| #define HAVE_NET_IF_PPP_H 1
| #define HAVE_NETINET_IF_ETHER_H 1
| #define HAVE_TERMIOS_H 1
| #define TIME_WITH_SYS_TIME 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_SELECT 1
| #define HAVE_STRDUP 1
| #define HAVE_STRTOL 1
| #define HAVE_GETADDRINFO 1
| #define HAVE_GETNAMEINFO 1
| #define HAVE_STRCHR 1
| #define HAVE_MEMCPY 1
| #define HAVE_STRSTR 1
| #define HAVE_STRCMP 1
| #define HAVE_STRNCMP 1
| #define HAVE_STRNCPY 1
| #define HAVE_STRLEN 1
| #define HAVE_STRNCASECMP 1
| #define HAVE_STRCASECMP 1
| #define HAVE_OPENLOG 1
| #define HAVE_CLOSELOG 1
| #define HAVE_SYSCONF 1
| #define HAVE_SETENV 1
| #define HAVE_IF_INDEXTONAME 1
| #define HAVE_DECL_STRERROR_R 1
| #define HAVE_STRERROR_R 1
| #define HAVE_GETPWNAM_R 1
| #define HAVE_GETGRNAM_R 1
| #define HAVE_SETGROUPS 1
| #define HAVE_REGCOMP 1
| #define HAVE_REGERROR 1
| #define HAVE_REGEXEC 1
| #define HAVE_REGFREE 1
| #define HAVE_SOCKET 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_NANOSLEEP 1
| #define HAVE_SYSCTL 1
| #define HAVE_STATFS 1
| #define HAVE_STATVFS 1
| #define HAVE_GETIFADDRS 1
| #define HAVE_GETLOADAVG 1
| #define HAVE_SYSLOG 1
| #define HAVE_GETUTENT 1
| #define HAVE_GETUTXENT 1
| #define HAVE_STRPTIME 1
| #define STRPTIME_NEEDS_STANDARDS 1
| #define NAN_STATIC_DEFAULT 1
| #define FP_LAYOUT_NEED_NOTHING 1
| #define HAVE_GETMNTENT 1
| #define HAVE_ONE_GETMNTENT 1
| #define HAVE_STRUCT_IP_MREQN_IMR_IFINDEX 1
| #define HAVE_STRUCT_UDPHDR_UH_DPORT 1
| #define HAVE_STRUCT_UDPHDR_UH_SPORT 1
| #define COLLECT_LIBESMTP 0
| #define HAVE_MONGO_H 1
| /* end confdefs.h. */
|
| /* Override any GCC internal prototype to avoid an error.
| Use char because int might match the return type of a GCC
| builtin and then its argument prototype would still apply. */
| #ifdef __cplusplus
| extern "C"
| #endif
| char mongo_run_command ();
| int
| main ()
| {
| return mongo_run_command ();
| ;
| return 0;
| }
configure:21616: result: no
我没有mongo_run_command
在文件夹 mongo-c-driver-0.96.4 的文件中的任何地方找到该函数
mongo-c-driver-0.96.4/src/mongoc/.*
mongo-c-driver-0.96.4/src/libmongoc.symbols
谢谢。