Tuesday 26 March 2019

gcc on windows

to configure gcc on windows

Refer the following links

https://www.msys2.org/

https://www.youtube.com/watch?v=TLh--v8OxHE

Wednesday 20 March 2019

In function `readConfig' | undefined reference to `config_read_file' | undefined reference to `config_destroy'

/tmp/cctmoy8d.o: In function `readConfig':
readConf.c:(.text+0x1c): undefined reference to `config_init'
readConf.c:(.text+0x2f): undefined reference to `config_read_file'
readConf.c:(.text+0x74): undefined reference to `config_destroy'
collect2: error: ld returned 1 exit status

Compile with  -lconfig

gcc -o main main.c readConf.c -lconfig

Tuesday 19 March 2019

show line number in vi

user the following command in Vi

set number



error: unknown type name ‘config_t’

add the following line

#include <libconfig.h>

fatal error: libconfig.h: No such file or directory

gcc -c main.c
main.c:12:23: fatal error: libconfig.h: No such file or directory
 #include "libconfig.h"
                       ^
compilation terminated.







Solution: fire this command on terminal

 [root@localhost zoocurator]# `gcc -print-prog-name=cc1` -v
 

ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include
 /usr/local/include
 /usr/include
End of search list.


/////////////now manually check the gcc include folders listed above for libconfig.h/////////////////////

[root@localhost include]# ls
aio.h        err.h           inttypes.h  neteconet   rpc            tar.h
aliases.h    errno.h         langinfo.h  netinet     rpcsvc         termio.h
alloca.h     error.h         lastlog.h   netipx      sched.h        termios.h



if it is not available then


for centos :
# yum install libconfig 
# yum install libconfig-devel

[root@localhost include]# yum install libconfig-devel

Now check the folder again for    libconfig.h


 Ref: http://lampwww.epfl.ch/~fsalvi/docs/gcc/www.network-theory.co.uk/docs/gccintro/gccintro_20.html 





 

linux command to search or find a file or text

$ sudo grep -iRl 'host=localhost' htdocs/


example

grep -irl 'libconfig.h' /usr/
/usr/share/doc/python-gobject-base-3.22.0/NEWS
/usr/share/doc/glib2-2.56.1/NEWS
/usr/share/doc/libconfig-1.4.9/ChangeLog
[root@localhost include]# vi /usr/share/doc/libconfig-1.4.9/ChangeLog

Friday 15 March 2019

sync the git repository centos (svn checkout equivalent)

git clone https://github.com/gunabalans/zoocurator.git
Cloning into 'zoocurator'...
Username for 'https://github.com': your git user name
Password for 'https://gunabalans@github.com': pw

Tuesday 5 March 2019

serf

 Ref: https://www.serf.io/intro/getting-started/agent.html
Running multiple serf agents

serf agent -bind=127.0.0.1:1010 -rpc-addr=127.0.0.1:7373 -node=y1
serf agent -bind=127.0.0.1:1011 -rpc-addr=127.0.0.1:7374 -node=y2
serf agent -bind=127.0.0.1:1012 -rpc-addr=127.0.0.1:7375 -node=y3
serf agent -bind=127.0.0.1:1013 -rpc-addr=127.0.0.1:7377 -node=y4




 join in the cluster

serf join 127.0.0.1:1011
serf join 127.0.0.1:1012
serf join 127.0.0.1:1013

serf members











C:\Users\ycs-gbs\go\bin>serf leave -rpc-addr=127.0.0.1:7373
Graceful leave complete

Saturday 2 March 2019

find and replace the content in all files in a folder ansible

- name: find and replace the content in all files in a folder ansible
replace:
path: "{{ item.src }}"
regexp: 'export KAFKA_HEAP_OPTS="-Xmx512M"'
replace: 'export KAFKA_HEAP_OPTS="-Xmx128M"'
with_filetree: "{{ kafka_installation_dir }}/{{ kafka_version }}/bin/"
when: item.state == 'file'