hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/2] incubator-hawq git commit: HAWQ-23. Fixed building gpfdist error
Date Sat, 10 Oct 2015 08:36:15 GMT
HAWQ-23. Fixed building gpfdist error


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

Branch: refs/heads/master
Commit: c941468b65e179b6b91ed9062258f90369218e4f
Parents: 4e7fe92
Author: Ming LI <mli@pivotal.io>
Authored: Fri Oct 9 16:17:29 2015 +0800
Committer: rlei <rlei@pivotal.io>
Committed: Sat Oct 10 16:35:24 2015 +0800

----------------------------------------------------------------------
 configure                             |  40 ++++++++++
 configure.in                          |   3 +
 src/bin/gpfdist/Makefile              | 114 ++++++++---------------------
 src/bin/gpfdist/src/gpfdist/gpfdist.c |   2 +-
 4 files changed, 75 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/c941468b/configure
----------------------------------------------------------------------
diff --git a/configure b/configure
index dad68b7..b4c7a54 100755
--- a/configure
+++ b/configure
@@ -654,6 +654,7 @@ PTHREAD_CC
 acx_pthread_config
 LIBOBJS
 HAVE_IPV6
+APR_CONFIG
 CXXCPP
 ac_ct_CXX
 CXXFLAGS
@@ -11092,6 +11093,45 @@ else
 fi
 
 
+# apr for gpfdist
+# Extract the first word of "apr-1-config", so it can be a program name with args.
+set dummy apr-1-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_APR_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$APR_CONFIG"; then
+  ac_cv_prog_APR_CONFIG="$APR_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_APR_CONFIG="yes"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+APR_CONFIG=$ac_cv_prog_APR_CONFIG
+if test -n "$APR_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $APR_CONFIG" >&5
+$as_echo "$APR_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+test -z "$APR_CONFIG" && as_fn_error $? "Please install apr from http://apr.apache.org/
and add dir of 'apr-1-config' to env variable '$PATH'." "$LINENO" 5
 
 ##
 ## Types, structures, compiler characteristics

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/c941468b/configure.in
----------------------------------------------------------------------
diff --git a/configure.in b/configure.in
index c2d7dc0..1a35284 100644
--- a/configure.in
+++ b/configure.in
@@ -1233,6 +1233,9 @@ AC_SEARCH_LIBS(hdfsOpenFile, hdfs3, [], [AC_MSG_ERROR([libhdfs3 is required])],
 AC_CHECK_HEADERS(libyarn/LibYarnClientC.h, [], [AC_MSG_ERROR([libyarn is required])])
 AC_SEARCH_LIBS(newLibYarnClient, yarn, [], [AC_MSG_ERROR([libyarn is required])], [])
 
+# apr for gpfdist
+AC_CHECK_PROG([APR_CONFIG], [apr-1-config],[yes])
+test -z "$APR_CONFIG" && AC_MSG_ERROR([Please install apr from http://apr.apache.org/
and add dir of 'apr-1-config' to env variable '$PATH'.])
 
 ##
 ## Types, structures, compiler characteristics

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/c941468b/src/bin/gpfdist/Makefile
----------------------------------------------------------------------
diff --git a/src/bin/gpfdist/Makefile b/src/bin/gpfdist/Makefile
index 36a204b..65d0439 100644
--- a/src/bin/gpfdist/Makefile
+++ b/src/bin/gpfdist/Makefile
@@ -1,114 +1,62 @@
-# prevent included makefiles from stealing default target
-default: all
 
 subdir = src/bin/gpfdist
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-# NO_M64 set in Makefile.global turns off default to 64-bit
-# here, select bitness we desire this build for gcc and ld
-CC=$(strip $(BLD_CC) $(BLD_CFLAGS))
+LIBS := -levent -lyaml -lz -lbz2 -lssl -lcrypto
 
-GPFDISTDIR=$(CURDIR)
-CDBINCL=-I$(GPFDISTDIR)/../../../src/include
-
-ifeq "$(BLD_ARCH)" "win32"
-override CC=$(strip /usr/local/mingw32/bin/mingw32-gcc $(BLD_CFLAGS))
-override BLD_CFLAGS += -L/usr/local/mingw32/mingw32/lib -I/usr/local/mingw32/mingw32/include
-DWIN32 $(CDBINCL)/port/win32 $(CDBINCL)/port/win32_msvc -DFRONTEND
-GPFDISTFILES=gpfdist.c
-GPFDISTFILES_EXTRA=fstream.c gfile.c transform.c glob.c $(CURDIR)/../src/port/dirent.c $(CURDIR)/../src/port/strlcpy.c
$(CURDIR)/../src/port/win32error.c $(CURDIR)/../src/port/snprintf.c
-GPFDISTOBJS_EXTRA=$(strip $(patsubst %.c,%.o,$(notdir $(GPFDISTFILES_EXTRA))))
-GPFDIST_INCLUDES=-I$(BLD_TOP)/src/gpfdist/include
-GPFDIST_LIBS=-L$(CURDIR)/../src/port -lpgport -lws2_32 -lgdi32
-EXT_EXE=.exe
-else
-GPFDISTFILES=fstream.c gfile.c gpfdist.c transform.c
-GPFDISTOBJSFILES=$(subst .c,.o,$(GPFDISTFILES))
-# link with static libyaml so gpfdist won't need LD_LIBRARY_PATH
-ifneq "$(findstring $(BLD_ARCH),aix5_ppc_64 aix5_ppc_32 osx104_x86)" ""
-GPFDIST_LIBS=-lyaml -lz -lbz2
-else
-GPFDIST_LIBS=$(BLD_THIRDPARTY_LIB_DIR)/libyaml.a -lz -lbz2
-endif
-endif
-
-export CC
-export LDFLAGS=$(BLD_CFLAGS)
+code_dir     = $(CURDIR)/src/gpfdist/
+GPFDISTFILES = fstream.c gfile.c gpfdist.c transform.c
+OBJS         = $(subst .c,.o,$(GPFDISTFILES))
 
 SHELL=bash
-OPT=-g -O3
-LIBEVENT=libevent-1.4.3-stable
-OPENSSL=openssl-0.9.8r
-OPENSSL_LIBS=-lssl -lcrypto
-GP_VERSION:=$(shell cat $(BLD_TOP)/VERSION)
+GP_VERSION:=$(shell cat $(top_builddir)/VERSION)
+
+APR_CFG  := $(shell which apr-1-config)
+APR_DIR  := $(shell dirname $(APR_CFG))/../
+INCLUDES := $$($(APR_CFG) --includes) -I$(code_dir) -I$(CURDIR)/../../../src/include $(INCLUDES)
+CFLAGS   := $$($(APR_CFG) --cflags) -Wall $(GPFXDIST) $(CFLAGS)
+LIBS     := $$($(APR_CFG) --link-ld --libs) $(LIBS)
 
 # flag to include/exclude gpfdist transformation support
 GPFXDIST=-DGPFXDIST
 
-INCLUDES=-I$(BLD_THIRDPARTY_INCLUDE_DIR) $$($(BLD_THIRDPARTY_BIN_DIR)/apr-1-config --includes)
-I. $(BLD_THIRDPARTY_OPENSSL_INCLUDES) 
-CFLAGS=$(OPT) $$($(BLD_THIRDPARTY_BIN_DIR)/apr-1-config --cflags) -Wall $(GPFXDIST)
-APRLIBS=$$($(BLD_THIRDPARTY_BIN_DIR)/apr-1-config --link-ld --libs) 
-APULIBS= $$($(BLD_THIRDPARTY_BIN_DIR)/apu-1-config --link-ld --libs)
-CPPFLAGS=$$($(BLD_THIRDPARTY_BIN_DIR)/apr-1-config --cppflags) -DGP_VERSION="$(GP_VERSION)"
-ifeq "$(BLD_ARCH)" "win32"
-GPFDIST_CPPFLAGS=$$($(BLD_THIRDPARTY_BIN_DIR)/apr-1-config --cppflags) -DGP_VERSION="$(GP_VERSION)"
-GPFDIST_CPPFLAGS_EXTRA=$$($(BLD_THIRDPARTY_BIN_DIR)/apr-1-config --cppflags)
-else
-sol10_sparc_32_CPPFLAGS=-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-sol9_sparc_32_CPPFLAGS=-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-sol8_sparc_32_CPPFLAGS=-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-rhel4_x86_32_CPPFLAGS=-D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
-rhel5_x86_32_CPPFLAGS=-D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
-GPFDIST_CPPFLAGS=$$($(BLD_THIRDPARTY_BIN_DIR)/apr-1-config --cppflags) -DGP_VERSION="$(GP_VERSION)"
$($(BLD_ARCH)_CPPFLAGS)
-endif
-
-osx105_x86_GPFDIST_LDFLAGS=-Wl,-search_paths_first
-GPFDIST_LDFLAGS=$($(BLD_ARCH)_GPFDIST_LDFLAGS)
-
-all: 
-
-#mkdir mkgpfdist
+sol10_sparc_32_CPPFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+sol9_sparc_32_CPPFLAGS  = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+sol8_sparc_32_CPPFLAGS  = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+rhel4_x86_32_CPPFLAGS   = -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+rhel5_x86_32_CPPFLAGS   = -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
+GPFDIST_CPPFLAGS        = $$($(APR_CFG) --cppflags) -DGP_VERSION="$(GP_VERSION)" $($(BLD_ARCH)_CPPFLAGS)
+CFLAGS:=$(GPFDIST_CPPFLAGS) $(CFLAGS)
 
-#mkgpma mkgp 
+all: mkdir mkgpfdist
 
 mkgpfdist: mkdir
 	@echo --- gpfdist --------------------------------------------------
 	cd src/gpfdist/ && \
 	  ln -sf ../../../../../src/backend/utils/misc/fstream/*.c . && ls ../../../../../src/backend/utils/misc/fstream/*.c
-	mkdir -p src/gpfdist/include
-	perl -p -i -e 's,^prefix=.*$$,prefix="$(BLD_THIRDPARTY_DIR)",' $(BLD_THIRDPARTY_DIR)/bin/apr-1-config
-ifeq "$(BLD_ARCH)" "win32"
-	cd src/gpfdist/ && \
-	  $(CC) $(INCLUDES) $(GPFDIST_INCLUDES) $(CDBINCL) $(GPFDIST_CPPFLAGS_EXTRA) $(CFLAGS) $(GPFDIST_LDFLAGS)
-Werror -c \
-	  $(GPFDISTFILES_EXTRA)
-	cd src/gpfdist/ && \
-	  $(CC) $(INCLUDES) $(GPFDIST_INCLUDES) $(CDBINCL) $(GPFDIST_CPPFLAGS) $(CFLAGS) $(GPFDIST_LDFLAGS)
-Werror -o gpfdist$(EXT_EXE) \
-	  $(GPFDISTFILES) $(GPFDISTOBJS_EXTRA) $(APRLIBS) -levent $(OPENSSL_LIBS) -L$(BLD_THIRDPARTY_LIB_DIR)
$(GPFDIST_LIBS)
-else
+	perl -p -i -e 's,^prefix=.*$$,prefix="$(APR_DIR)",' $(APR_CFG)
+
 	for file in $(GPFDISTFILES); do \
-	    (cd src/gpfdist/ && \
-	      $(CC) $(INCLUDES) $(GPFDIST_INCLUDES) $(CDBINCL) $(GPFDIST_CPPFLAGS) $(CFLAGS) -Werror
-c $${file}); \
+	    ( $(CC) $(INCLUDES) $(CFLAGS) $(LIBS) -c $(code_dir)$${file}); \
 	done
-	cd src/gpfdist/ && \
-	  $(CC) $(INCLUDES) $(GPFDIST_INCLUDES) $(CDBINCL) $(GPFDIST_CPPFLAGS) $(CFLAGS) $(GPFDIST_LDFLAGS)
-Werror -o gpfdist$(EXT_EXE) \
-	  $(GPFDISTOBJSFILES) $(GPFDISTOBJS_EXTRA) $(APRLIBS) -levent $(OPENSSL_LIBS) -L$(BLD_THIRDPARTY_LIB_DIR)
$(GPFDIST_LIBS)
-endif
+	# link
+	$(CC) -o $(code_dir)gpfdist $(OBJS)  $(LIBS)
+
 	mkdir -p build/bin
-	cp -f src/gpfdist/gpfdist$(EXT_EXE) build/bin/
+	mv -f src/gpfdist/gpfdist build/bin/
 
 mkdir:
-	@mkdir -p src/build/lib src/build/include build/bin build/bin/lib
+	@mkdir -p build/bin
 
 clean: 
-	rm -f src/gpfdist/gpfdist
-	rm -rf src/build
-	find src -name '*.o' -exec rm -f {} \;
+	rm -rf build
+	find . -name '*.o' -exec rm -f {} \;
 
 install:
-	${INSTALL_SCRIPT} -d ${bindir}
 	@for file in `find build/bin -type f`; \
 		do \
-			echo install $${file} into ${bindir};\
-			${INSTALL_SCRIPT} $${file} ${bindir}; \
+			echo install $${file} into '$(DESTDIR)$(bindir)';\
+			$(INSTALL_PROGRAM) $${file} '$(DESTDIR)$(bindir)'; \
 		done
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/c941468b/src/bin/gpfdist/src/gpfdist/gpfdist.c
----------------------------------------------------------------------
diff --git a/src/bin/gpfdist/src/gpfdist/gpfdist.c b/src/bin/gpfdist/src/gpfdist/gpfdist.c
index f4067f1..716a155 100644
--- a/src/bin/gpfdist/src/gpfdist/gpfdist.c
+++ b/src/bin/gpfdist/src/gpfdist/gpfdist.c
@@ -2246,7 +2246,7 @@ gnet_parse_request(const char* buf, int* len, apr_pool_t* pool)
 
 			/* add to previous hvalue */
 			req->hvalue[req->hc - 1] = gstring_trim(apr_pstrcat(pool,
-					req->hvalue[req->hc - 1], " ", line, 0));
+					req->hvalue[req->hc - 1], " ", line, (char*)NULL));
 			continue;
 		}
 		/* find a colon, and break the line in two */


Mime
View raw message