Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 679efee66 -> a8743f2d4


[TRAFODION-1749] Bundle log4cxx library in Trafodion build

Since log4cxx is not available in all Linux distros, we make it a
build-time dependency only, and bundle the shared library for runtime.
This eliminates the installer dependency to check log4cxx package.

The build-time dependency can be satisfied either by installing log4cxx
and log4cxx-devel RPM packages, if available, or by building library
from source.  The traf_tools_setup.sh script is enhanced to download
source code and build this dependency.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/7c37f1ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/7c37f1ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/7c37f1ae

Branch: refs/heads/master
Commit: 7c37f1ae23e62e5f4cc4caa12518b613b62c7583
Parents: 1741235
Author: Steve Varnau <[email protected]>
Authored: Mon Feb 1 18:40:33 2016 +0000
Committer: Steve Varnau <[email protected]>
Committed: Mon Feb 1 18:40:33 2016 +0000

----------------------------------------------------------------------
 core/conn/odbc/src/odbc/nsksrvr/Makefile |  2 +-
 core/sqf/monitor/linux/makefile          |  2 +-
 core/sqf/sqenvcom.sh                     |  2 +-
 core/sqf/src/tm/Makefile                 |  8 +++---
 core/sql/nskgmake/Makerules.linux        |  5 ++--
 install/installer/traf_package_setup     |  4 +--
 install/traf_tools_setup.sh              | 37 +++++++++++++++++++++++++++
 7 files changed, 49 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7c37f1ae/core/conn/odbc/src/odbc/nsksrvr/Makefile
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvr/Makefile 
b/core/conn/odbc/src/odbc/nsksrvr/Makefile
index e24e496..2952f9d 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/Makefile
+++ b/core/conn/odbc/src/odbc/nsksrvr/Makefile
@@ -121,7 +121,7 @@ DBT_LIBS =
 
 EARLY_LIBS = -ljsig
 
-COMMON_LIBS = -lsbfs -lsbms -levlsq -lwin -ltdm_sqlcli -larkcmp_dll 
-L../nsksrvrcore -lmxocore -L$(LOG4CXX_LIB_DIR) -llog4cxx
+COMMON_LIBS = -lsbfs -lsbms -levlsq -lwin -ltdm_sqlcli -larkcmp_dll 
-L../nsksrvrcore -lmxocore -llog4cxx
 
 ifeq ($(SQ_MTYPE),64)
 LOC_JSIG=$(JAVA_HOME)/jre/lib/amd64/server

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7c37f1ae/core/sqf/monitor/linux/makefile
----------------------------------------------------------------------
diff --git a/core/sqf/monitor/linux/makefile b/core/sqf/monitor/linux/makefile
index 7f41331..6a9efac 100755
--- a/core/sqf/monitor/linux/makefile
+++ b/core/sqf/monitor/linux/makefile
@@ -83,7 +83,7 @@ INCLUDES+= -I$(LOG4CXX_INC_DIR)
 INCLUDES+= -I$(LOG4CXX_INC_DIR)/log4cxx
 
 LIBS+=  -lsqlite3
-LIBS+=  -L$(LOG4CXX_LIB_DIR) -llog4cxx
+LIBS+=  -llog4cxx
 
 ifeq ($(USE_TESTPOINTS),1)
    FLAGS+= -DUSE_TESTPOINTS

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7c37f1ae/core/sqf/sqenvcom.sh
----------------------------------------------------------------------
diff --git a/core/sqf/sqenvcom.sh b/core/sqf/sqenvcom.sh
index a8bc752..84765c4 100644
--- a/core/sqf/sqenvcom.sh
+++ b/core/sqf/sqenvcom.sh
@@ -634,7 +634,7 @@ then
   export LOG4CXX_LIB_DIR=$TOOLSDIR/apache-log4cxx-0.10.0/lib
   export LOG4CXX_INC_DIR=$TOOLSDIR/apache-log4cxx-0.10.0/include
 else
-  export LOG4CXX_LIB_DIR=/lib64:/usr/lib64
+  export LOG4CXX_LIB_DIR=/usr/lib64
   export LOG4CXX_INC_DIR=/usr/include/log4cxx
 fi
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7c37f1ae/core/sqf/src/tm/Makefile
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/Makefile b/core/sqf/src/tm/Makefile
index bbda3a8..80a295d 100644
--- a/core/sqf/src/tm/Makefile
+++ b/core/sqf/src/tm/Makefile
@@ -146,7 +146,7 @@ all:  $(LIBEXPDIR)/libsxatmlib.so $(LIBEXPDIR)/libstmlib.so 
$(PROGS) $(LIBEXPDIR
 
 $(OUTDIR)/tm: $(TMOBJS) $(LIBEXPDIR)/libsxatmlib.so 
$(LIBEXPDIR)/libshbasetmlib.so $(PROGS) $(LIBEXPDIR)/libxarm.so cp_trx_jar
        @echo "USE_THREADED_IO = " $(USE_THREADED_IO)
-       $(CXX) $(LNK_FLGS) $(LIBJVM) -o $@ $(TMOBJS) $(LIBSTM) -L$(LIBEXPDIR) 
-L$(LOG4CXX_LIB_DIR) -llog4cxx -DTM_BUILD_
+       $(CXX) $(LNK_FLGS) $(LIBJVM) -o $@ $(TMOBJS) $(LIBSTM) -L$(LIBEXPDIR) 
-llog4cxx -DTM_BUILD_
 
        cp -fup $(OUTDIR)/tm $(BINEXPDIR)
 
@@ -158,17 +158,17 @@ $(OUTDIR)/idtmsrv: $(IDSRVOBJS)
        cp -fup $(OUTDIR)/idtmsrv $(BINEXPDIR)
 
 $(LIBEXPDIR)/libstmlib.so: $(LIBSTMOBJS) 
-       $(CXX) $(DTMOBJS) $(LNK_FLGS) $(LIBSBMSX) $(LIBJVM) -L$(LIBEXPDIR) 
-L$(LOG4CXX_LIB_DIR) -llog4cxx -shared -o $@ $(LIBSTMOBJS)  
+       $(CXX) $(DTMOBJS) $(LNK_FLGS) $(LIBSBMSX) $(LIBJVM) -L$(LIBEXPDIR) 
-llog4cxx -shared -o $@ $(LIBSTMOBJS)  
 
 $(LIBEXPDIR)/libsxatmlib.so: $(LIBSXATMOBJS) 
-       $(CXX) $(LNK_FLGS) -shared -o $@ $(LIBSXATMOBJS) $(LIBSTMX) 
-L$(LIBEXPDIR) -L$(LOG4CXX_LIB_DIR) -llog4cxx
+       $(CXX) $(LNK_FLGS) -shared -o $@ $(LIBSXATMOBJS) $(LIBSTMX) 
-L$(LIBEXPDIR) -llog4cxx
 
 $(LIBEXPDIR)/libshbasetmlib.so: $(LIBSXATMOBJS) cp_trx_jar
        cd $(HBASETMLIB); $(MAKE)
 
 
 $(LIBEXPDIR)/libxarm.so: $(LIBXARMOBJS) 
-       $(CXX) $(LNK_FLGS) -shared -o $@ $(LIBXARMOBJS) -L$(LIBEXPDIR) 
-L$(LOG4CXX_LIB_DIR) -llog4cxx -DXARM_BUILD_
+       $(CXX) $(LNK_FLGS) -shared -o $@ $(LIBXARMOBJS) -L$(LIBEXPDIR) 
-llog4cxx -DXARM_BUILD_
 
 $(OUTDIR)/CommonLogger.o: $(MY_SQROOT)/commonLogger/CommonLogger.cpp
        $(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7c37f1ae/core/sql/nskgmake/Makerules.linux
----------------------------------------------------------------------
diff --git a/core/sql/nskgmake/Makerules.linux 
b/core/sql/nskgmake/Makerules.linux
index 2db10b1..1fce092 100755
--- a/core/sql/nskgmake/Makerules.linux
+++ b/core/sql/nskgmake/Makerules.linux
@@ -131,7 +131,7 @@ THRIFT_LIB=-lthrift
 THRIFT_SO=libthrift-*.so
 
 LOG4CXX_INC=-I$(LOG4CXX_INC_DIR) -I$(LOG4CXX_INC_DIR)/log4cxx
-LOG4CXX_LIB=-L$(LOG4CXX_LIB_DIR) -llog4cxx
+LOG4CXX_LIB=-llog4cxx
 LOG4CXX_SO=liblog4cxx*.so
 
 # for now, include these libs (copied to our local lib dir) everywhere
@@ -420,7 +420,8 @@ copytoolslibs:
        mkdir -p $(LIBROOT)
        -(for i in $(HADOOP_LIB_DIR)/$(LIBHDFS_SO) \
                   $(HADOOP_LIB_DIR)/$(LIBHADOOP_SO) \
-                  $(THRIFT_LIB_DIR)/$(THRIFT_SO); \
+                  $(THRIFT_LIB_DIR)/$(THRIFT_SO) \
+                  $(LOG4CXX_LIB_DIR)/$(LOG4CXX_SO); \
         do\
           cp -Pf $$i* $(LIBROOT); \
         done\

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7c37f1ae/install/installer/traf_package_setup
----------------------------------------------------------------------
diff --git a/install/installer/traf_package_setup 
b/install/installer/traf_package_setup
index 7f515f1..bd09902 100755
--- a/install/installer/traf_package_setup
+++ b/install/installer/traf_package_setup
@@ -160,7 +160,7 @@ if [[ $SUSE_LINUX == "false" ]]; then
    # it doesn't hurt if it was already enabled and we try to enable it again
    $TRAF_PDSH sudo yum-config-manager --enable RedHat-6-x86_64-Fedora-EPEL 2>> 
$YUM_LOG >> $YUM_LOG
 
-   package_list="log4cxx sqlite expect perl-DBD-SQLite* protobuf xerces-c 
perl-Params-Validate perl-Time-HiRes gzip"
+   package_list="sqlite expect perl-DBD-SQLite* protobuf xerces-c 
perl-Params-Validate perl-Time-HiRes gzip"
    if [[ $internetAccess == "true" ]]; then
       for package in $package_list
       do
@@ -201,7 +201,7 @@ else
    echo
    echo 
    echo "***WARNING: All needed RPM's must be installed in advance to install 
Trafodion on SUSE."
-   echo "***WARNING: log4cxx sqlite expect perl-DBD-SQLite* protobuf xerces-c 
perl-Params-Validate perl-Time-HiRes gzip"
+   echo "***WARNING: sqlite expect perl-DBD-SQLite* protobuf xerces-c 
perl-Params-Validate perl-Time-HiRes gzip"
    echo "***WARNING: If any of these packages have not been installed. Stop 
Trafodion installation and install."
    echo 
    echo 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7c37f1ae/install/traf_tools_setup.sh
----------------------------------------------------------------------
diff --git a/install/traf_tools_setup.sh b/install/traf_tools_setup.sh
index e3853bf..00cecb2 100755
--- a/install/traf_tools_setup.sh
+++ b/install/traf_tools_setup.sh
@@ -44,6 +44,7 @@
 #   and group services.
 # Thrift: Communications and data serialization tool
 # Maven: Build tool that is only installed if compatible version does not exist
+# log4cxx: standard logging framework for C++
 #
 # Script can be modified to meet the needs of your environment
 # May need root or SUDO access to install tools in desired location
@@ -417,6 +418,42 @@ else
   echo "INFO:  Maven is already installed, skipping to next tool" | tee -a 
$LOGFILE
 fi
 
+# -----------------------------------------------------------------------------
+# install log4cxx, if not installed
+if [[ !  -e /usr/lib64/liblog4cxx.so ]]; then
+  cd $BASEDIR
+  echo
+  echo "INFO: Installing log4cxx on $(date)" | tee -a $LOGFILE
+  if [ -d $TOOLSDIR/apache-log4cxx-0.10.0/lib ]; then
+    echo "INFO: log4cxx is already installed, skipping to next tool" | tee -a 
$LOGFILE
+  else
+    downloadSource 
https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz
 apache-log4cxx
+    cd apache-log4cxx-0.10.0
+    echo "INFO:   headerfile patch - per LOG4CXX-360" | tee -a $LOGFILE
+    sed -i '1 i#include <string.h>' src/main/cpp/inputstreamreader.cpp
+    sed -i '1 i#include <string.h>' src/main/cpp/socketoutputstream.cpp
+    sed -i '1 i#include <string.h>' src/examples/cpp/console.cpp
+    sed -i '2 i#include <stdio.h>' src/examples/cpp/console.cpp
+    ./configure --prefix=$TOOLSDIR/apache-log4cxx-0.10.0 >>$LOGFILE 2>&1
+    echo "INFO:   configure complete" | tee -a $LOGFILE
+    make  >>$LOGFILE 2>&1
+    echo "INFO:   make completed" | tee -a $LOGFILE
+    make install  >>$LOGFILE 2>&1
+    if [ ! -d $TOOLSDIR/apache-log4cxx-0.10.0/lib ]; then
+      echo "ERROR:  failed to install log4cxx" | tee -a $LOGFILE
+      echo "  see details in $LOGFILE" | tee -a $LOGFILE
+      exit 2;
+    fi
+    echo "INFO:   make install complete, files placed in $TOOLSDIR"
+  fi
+  echo "INFO: log4cxx installation complete" | tee -a $LOGFILE
+  echo " *********************************************************** " | tee 
-a $LOGFILE
+else
+  echo "INFO:  log4cxx is already installed, skipping to next tool" | tee -a 
$LOGFILE
+fi
+
+# -----------------------------------------------------------------------------
+
 echo
 echo "INFO: Completed tools build on $(date)" | tee -a $LOGFILE
 echo "INFO: List of tools directory: " | tee -a $LOGFILE

Reply via email to