compilation - Error linking to mongo-c-driver library while building collected performance monitoring package -



compilation - Error linking to mongo-c-driver library while building collected performance monitoring package -

i trying build collectd scheme performance monitoring bundle (version 5.4.1; building collectd on fedora v20 vm) , want utilize write_mongodb plug-in.

i run ./configure in folder collectd-5.4.1 have download bundle source files cannot write_mongodb back upwards due next error (as seen in config.log file of collectd folder):

/home/user01/documents/libs/collectd-5.4.1/conftest.c:181: undefined reference 'mongo_run_command'

i trying link mongo-c-driver library, compiled generate libmongoc-1.0.so.0.0.0 (version 0.96.4).

i made next modifications in script configure link 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/"

and copied file mongoc.h folder /usr/local/include/libmongoc-1.0/mongo.h

following snippet output of configure script config.log in collectd folder has error relating mongo_run_command.

configure:21551: libmongoc cppflags: -i/usr/local/include/libmongoc-1.0/ -i/usr/local/include/libbson-1.0/ configure:21556: checking 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 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 'mongo_run_command' collect2: error: ld returned 1 exit status configure:21607: $? = 1 configure: failed programme 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 bundle "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 gcc internal prototype avoid error. | utilize char because int might match homecoming type of gcc | builtin , argument prototype still apply. */ | #ifdef __cplusplus | extern "c" | #endif | char mongo_run_command (); | int | main () | { | homecoming mongo_run_command (); | ; | homecoming 0; | } configure:21616: result: no

i did not find function mongo_run_command anywhere in files in folder mongo-c-driver-0.96.4

mongo-c-driver-0.96.4/src/mongoc/.* mongo-c-driver-0.96.4/src/libmongoc.symbols

thanks.

following steps fixed problems encountered while building write mongodb plugin back upwards collectd scheme performance monitoring package.

compiling mongo-c-driver , collectd

following steps , code updates needed build , utilize write_mongodb plugin in collectd send scheme performance info straight mongodb database.

download collectd-5.4.1 to, say,

collectd_dir=/home/user01/libs/collectd-5.4.1

don’t compile/build collectd, yet.

download mongo-c-driver version 0.8.1 github. latest version of mongo-c-driver not compatible collectd version 5.4.1

built mongo 0.8.1 folder: mongoc_dir=/home/user01/libs/mongo-c-driver-0.8.1

copy libraries libbson.so , libmongoc.so mongoc_dir /usr/local/lib , /usr/local/lib64

copy libmongoc.so library next locations: sudo cp /usr/local/lib/libmongoc.so /lib64/libmongoc.so.0.8 sudo cp /usr/local/lib/libmongoc.so /lib/libmongoc.so.0.8

copy .h header files folder mongoc_dir/src /usr/local/include

go collectd_dir , create next changes configure script

// comment lines -i$withval/include , -i$withval/lib , replace them next // before > libmongoc_cppflags="$libmongoc_cppflags -i$withval/include" libmongoc_ldflags="$libmongoc_ldflags -l$withval/lib" // after > libmongoc_cppflags="$libmongoc_cppflags -i/usr/local/include/" libmongoc_ldflags="$libmongoc_ldflags -l/usr/local/lib/"

run script ./configure

make next changes file collectd_dir/src/write_mongodb.c; changes mentioned in issue. change bson_create bson_alloc change bson_dispose bson_dealloc compile collectd: run sudo create clean , sudo make compile collectd afresh. install collected running sudo create install

running collectd , testing mongodb

start mongodb server run collected: /opt/collectd/sbin/collectd start mongo server run next commands in mongo session check connection collectd show dbs utilize collectd db.getcollectionnames() db.load.find().sort({x:1}).limit(3).pretty()

c compilation collectd mongo-c-driver

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -