title: Error linking to mongo-c-driver library while building collected performance monitoring package
body: <p>I am trying to build the <a href="https://collectd.org/download.shtml" rel="nofollow">collectd</a> system performance monitoring package (version 5.4.1; building collectd on Fedora v20 VM) and want to use the write_mongodb plug-in. </p>
  
  <p>I run <code>./configure</code> in the folder collectd-5.4.1 where I have download the package source files but cannot get write_mongodb support due to the following error (as seen in config.log file of collectd folder):</p>
  
  <pre><code>/home/user01/Documents/libs/collectd-5.4.1/conftest.c:181: undefined reference to 'mongo_run_command'
  </code></pre>
  
  <p>I am trying to link to mongo-c-driver library, which I previously compiled to generate libmongoc-1.0.so.0.0.0 (version 0.96.4). </p>
  
  <p>I made following modifications in the script <code>configure</code> to link to libmongoc:</p>
  
  <pre><code>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/"
  </code></pre>
  
  <p>and copied the file <code>mongoc.h</code> into the folder as <code>/usr/local/include/libmongoc-1.0/mongo.h</code></p>
  
  <p>Following is snippet from output of configure script <code>config.log</code> in collectd folder that has the error relating to <code>mongo_run_command</code>. </p>
  
  <pre><code>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 &gt;&amp;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  &gt;&amp;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
  </code></pre>
  
  <p>I did not find the function <code>mongo_run_command</code> anywhere in files in the folder mongo-c-driver-0.96.4</p>
  
  <pre><code>mongo-c-driver-0.96.4/src/mongoc/.*
  mongo-c-driver-0.96.4/src/libmongoc.symbols
  </code></pre>
  
  <p>Thanks.</p>