Use the following compile and link switches when building shared libraries on Linux.
compile switches
-fPIC -fsigned-char -fno-exceptions -pthread -fno-omit-frame-pointer -Wno-deprecated -Wno-ctor-dtor-privacy
link switches
-ldl -lnsl -lm -lpthread -shared -Wl,-Bsymbolic -Wl,-shared
g++ -c my_interpolate.cxx -fPIC -fsigned-char -fno-exceptions -pthread -fno-omit-frame-pointer -Wno-deprecated -Wno-ctor-dtor-privacy -I${IQDIR15}/sdk/include/
g++ -c my_main.cxx -fPIC -fsigned-char -fno-exceptions -pthread -fno-omit-frame-pointer -Wno-deprecated -Wno-ctor-dtor-privacy -I${IQDIR15}/sdk/include/
ld -G my_main.o my_interpolate.o -ldl -lnsl -lm -lpthread -shared -o my_udf_library.so
compile switches
-q64 -qarch=ppc64 -qcheck=nullptr -qinfo=gen -qtbtable=full -qsrcmsg -qnoansialias -qminimaltoc -qmaxmem=-1 -qenum=int -qhalt=e -qflag=w -qthreaded -qxflags=NLOOPING -qtmplinst=none
link switches
-qmkshrobj -ldl -lg -qthreaded -lnsl -lm