<div dir="ltr"><div>Hi,</div><div><br></div>Apologies for bothering.Issue is resolved.<div><br></div><div>Thanks,</div><div>Nitish</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 5, 2020 at 5:12 PM Nitish Saboo <<a href="mailto:nitish.saboo55@gmail.com">nitish.saboo55@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<br><br>I compiled syslog-ng-3.25.1 using the following code:<br><br>tar -xvzf syslog-ng_3.25.1.tar.gz<br><br>mkdir -p syslog-ng_3.25.1/build<br><br>cd syslog-ng_3.25.1/build<br><br>../configure --prefix=/home/nsaboo/Desktop/Cproject/syslog/syslog-ng_3.25.1/install<br><br>make <br><br>make install<br><br>Post installation,the folder structure looks like this:<br><br>nsaboo@ubuntu:~/Desktop/Cproject/syslog/syslog-ng-3.25.1/install$ ls -lrt<br>total 28<br>drwxrwxr-x 2 nsaboo nsaboo 4096 Feb 11 04:08 sbin<br>drwxrwxr-x 2 nsaboo nsaboo 4096 Feb 11 04:08 bin<br>drwxr-xr-x 2 nsaboo nsaboo 4096 Feb 11 04:08 var<br>drwxr-xr-x 3 nsaboo nsaboo 4096 Feb 11 04:08 share<br>drwxrwxr-x 4 nsaboo nsaboo 4096 Feb 11 04:08 include<br>drwxr-xr-x 3 nsaboo nsaboo 4096 Feb 11 04:08 etc<br>drwxrwxr-x 4 nsaboo nsaboo 4096 Feb 18 00:35 lib<br>nsaboo@ubuntu:~/Desktop/Cproject/syslog/syslog-ng-3.25.1/install$ <br><br>I have a C code base (syslog-node.c) and header file (node.h) that is internally calling syslog-ng patterndb apis':<br>I have a main.c file that calls methods in 'syslog-node.c'.<br><br>My header file has following methods:<br><br>typedef void (*key_value_cb)(const char* key, const char* value, size_t value_len, int data);<br>int initialize_engine(const char* filename, const char* module_path, key_value_cb cb);<br>int reload_pattern_db(const char* filename, key_value_cb cb);<br>int load_pattern_db(const char* filename, key_value_cb cb);<br>void match(const char* pattern, size_t pattern_len, const char* program, size_t program_len);<br>int shutdown();<br><br><br>I am calling following gcc command to create a binary but it is erroring out:<br><br> gcc -L/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/lib lsyslog-ng -L/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/lib/syslog-ng ldbparser -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/include/syslog-ng -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/include -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/ -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/build/ -I/usr/local/include/eventlog/ syslog-node.c main.c -o main<br><br> Error<br> =====<br><br>nsaboo@ubuntu:~/Desktop/Cproject$ gcc -L/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/lib -lsyslog-ng -L/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/lib/syslog-ng -ldbparser -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/include/syslog-ng -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/install/include -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/ -I/home/nsaboo/Desktop/Cproject/syslog/syslog-ng-3.25.1/build/ -I/usr/local/include/eventlog/ syslog-node.c main.c -o main<br>/tmp/ccam1ao5.o: In function `pdbtool_pdb_emit_accumulate':<br>syslog-node.c:(.text+0x55): undefined reference to `logmsg_registry'<br>syslog-node.c:(.text+0x73): undefined reference to `nv_table_foreach'<br>/tmp/ccam1ao5.o: In function `match':<br>syslog-node.c:(.text+0x93): undefined reference to `log_msg_new_empty'<br>syslog-node.c:(.text+0xb0): undefined reference to `log_msg_set_value'<br>syslog-node.c:(.text+0xc9): undefined reference to `log_msg_set_value'<br>syslog-node.c:(.text+0xdf): undefined reference to `pattern_db_process'<br>syslog-node.c:(.text+0xeb): undefined reference to `log_msg_unref'<br>/tmp/ccam1ao5.o: In function `reload_pattern_db':<br>syslog-node.c:(.text+0x1e2): undefined reference to `pattern_db_free'<br>syslog-node.c:(.text+0x1e7): undefined reference to `pattern_db_new'<br>syslog-node.c:(.text+0x20b): undefined reference to `pattern_db_reload_ruleset'<br>syslog-node.c:(.text+0x225): undefined reference to `pattern_db_set_emit_func'<br>/tmp/ccam1ao5.o: In function `load_pattern_db':<br>syslog-node.c:(.text+0x257): undefined reference to `pattern_db_free'<br>syslog-node.c:(.text+0x25c): undefined reference to `pattern_db_new'<br>syslog-node.c:(.text+0x280): undefined reference to `pattern_db_reload_ruleset'<br>syslog-node.c:(.text+0x29a): undefined reference to `pattern_db_set_emit_func'<br>/tmp/ccam1ao5.o: In function `initialize_engine':<br>syslog-node.c:(.text+0x2ba): undefined reference to `app_startup'<br>syslog-node.c:(.text+0x2c4): undefined reference to `msg_init'<br>syslog-node.c:(.text+0x2cb): undefined reference to `resolvedConfigurablePaths'<br>syslog-node.c:(.text+0x2d0): undefined reference to `resolved_configurable_paths_init'<br>syslog-node.c:(.text+0x2db): undefined reference to `resolvedConfigurablePaths'<br>syslog-node.c:(.text+0x2e5): undefined reference to `cfg_new'<br>syslog-node.c:(.text+0x2fb): undefined reference to `cfg_set_global_paths'<br>syslog-node.c:(.text+0x311): undefined reference to `cfg_load_module'<br>syslog-node.c:(.text+0x327): undefined reference to `cfg_load_module'<br>syslog-node.c:(.text+0x32c): undefined reference to `pattern_db_global_init'<br>syslog-node.c:(.text+0x347): undefined reference to `pattern_db_free'<br>syslog-node.c:(.text+0x34c): undefined reference to `pattern_db_new'<br>syslog-node.c:(.text+0x370): undefined reference to `pattern_db_reload_ruleset'<br>syslog-node.c:(.text+0x38a): undefined reference to `pattern_db_set_emit_func'<br>/tmp/ccam1ao5.o: In function `shutdown':<br>syslog-node.c:(.text+0x39a): undefined reference to `app_shutdown'<br>collect2: error: ld returned 1 exit status<br><br>Those functions are available in the shared libraries.nm command output shows the same<br><br>nsaboo@ubuntu:~/Desktop/Cproject$ nm syslog/syslog-ng-3.25.1/install/lib/syslog-ng/libdbparser.so | grep T | grep 'pattern_db_set_emit_func'<br>0000000000010d40 T pattern_db_set_emit_func<br>nsaboo@ubuntu:~/Desktop/Cproject$ nm syslog/syslog-ng-3.25.1/install/lib/syslog-ng/libdbparser.so | grep T | grep 'pattern_db_new'<br>0000000000010ef0 T pattern_db_new<br>nsaboo@ubuntu:~/Desktop/Cproject$ nm syslog/syslog-ng-3.25.1/install/lib/syslog-ng/libdbparser.so | grep T | grep 'pattern_db_reload_ruleset'<br>0000000000010cc0 T pattern_db_reload_ruleset<br>nsaboo@ubuntu:~/Desktop/Cproject$ nm syslog/syslog-ng-3.25.1/install/lib/libsyslog-ng.so.0 | grep T | grep 'log_msg_set_value'<br>0000000000080df0 T log_msg_set_value<br>00000000000811d0 T __log_msg_set_value_by_name<br>0000000000081220 T log_msg_set_value_indirect<br>nsaboo@ubuntu:~/Desktop/Cproject$ nm syslog/syslog-ng-3.25.1/install/lib/libsyslog-ng.so | grep T | grep 'msg_init'<br>0000000000051990 T msg_init<br>nsaboo@ubuntu:~/Desktop/Cproject$ nm syslog/syslog-ng-3.25.1/install/lib/libsyslog-ng.so | grep T | grep 'cfg_new'<br>0000000000039200 T cfg_new<br>0000000000039360 T cfg_new_snippet<br>0000000000039390 T cfg_new_subordinate<br><br><br>I understand this is the C linking error where I am including all the dynamic shared libraries and header files, but not able to figure out what is causing this issue.<br>Can someone please help me to determine what am I missing here ?<br><br>Thanks,<br>Nitish<br></div></div></div>
</blockquote></div>