Mail Archives: cygwin/2005/06/19/23:57:43
--------------B378EB36D02A713D564B7253
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Carlo Florendo wrote:
> The thing is, libs/libphp4.so does not exist but only libs/libpp4.a
>
> I remember someone saying before that there is a problem in libtool.
> However, I don't quite understand how libtool works.
>
> Here's what the make warning says:
>
> libtool: link: warning: undefined symbols not allowed in i686-pc-cygwin
> shared libraries
Usually that means you have to add -W,l,-no-undefined to the link
command line.
You also have to patch a few in the build system to compensate for some
other braindead issues, such as the fact that it assumes that binaries
have no extension and that shared objects are named .so. Naming the
shared objects .so is fine if you only plan to dlopen() them, but if you
want full PHP functionality (such as a working CLI) you need them named
.DLL.
The attached patch does this in a rather crude way... it skips using
libtool, which is ugly, but at the time when I was looking at this it at
least got me past the build problems. You can build most PHP modules
dynamically with this (or at least, you could last time I checked) but
some of them would segfault when loaded. There's also a serious problem
with image addresses, and I remember having to manually rebase the php
modules to a certain range to get the server to start.
This was with Apache 1.x, no clue if it will work for 2.x. No
guarantees that there hasn't been bitrot since I last looked at this.
Brian
--------------B378EB36D02A713D564B7253
Content-Type: text/plain; charset=us-ascii;
name="php-all.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="php-all.patch"
--- ./acinclude.m4 2005/04/13 01:27:14 1.1
+++ ./acinclude.m4 2005/04/13 02:47:02
@@ -1,4 +1,4 @@
-dnl $Id: acinclude.m4,v 1.1 2005/04/13 01:27:14 brian Exp $ -*- autoconf -*-
+dnl $Id: acinclude.m4,v 1.1 2005/04/13 01:27:14 brian Exp brian $ -*- autoconf -*-
dnl
dnl This file contains local autoconf functions.
@@ -293,13 +293,23 @@
AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
AC_REQUIRE([PHP_CANONICAL_HOST])dnl
PHP_SUBST(SHLIB_SUFFIX_NAME)
- SHLIB_SUFFIX_NAME=so
+ PHP_SUBST(BIN_EXT)
case $host_alias in
*hpux*[)]
SHLIB_SUFFIX_NAME=sl
+ BIN_EXT=
;;
*darwin*[)]
SHLIB_SUFFIX_NAME=dylib
+ BIN_EXT=
+ ;;
+ *cygwin*[)]
+ SHLIB_SUFFIX_NAME=dll.a
+ BIN_EXT=.exe
+ ;;
+ *[)]
+ SHLIB_SUFFIX_NAME=so
+ BIN_EXT=
;;
esac
])
@@ -748,7 +758,15 @@
dnl
AC_DEFUN([PHP_BUILD_SHARED],[
PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp4.la
+ case $host_alias in
+ *cygwin*[)]
+ OVERALL_TARGET=cygphp4.dll
+ ;;
+ *[)]
+ OVERALL_TARGET=libphp4.la
+ ;;
+ esac
+
php_build_target=shared
php_c_pre=$shared_c_pre
@@ -765,7 +783,14 @@
dnl
AC_DEFUN([PHP_BUILD_STATIC],[
PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp4.la
+ case $host_alias in
+ *cygwin*[)]
+ OVERALL_TARGET=cygphp4.dll
+ ;;
+ *[)]
+ OVERALL_TARGET=libphp4.la
+ ;;
+ esac
php_build_target=static
])
@@ -1186,6 +1211,10 @@
suffix=so
link_cmd='ifelse($4,,[$(CC)],[$(CXX)]) -dynamic -flat_namespace -bundle -undefined suppress $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
;;
+ *cygwin*[)]
+ suffix=dll
+ link_cmd='ifelse($4,,[$(CC)],[$(CXX)]) -shared $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD) -L$(phptempdir) -lphp4'
+ ;;
*[)]
suffix=la
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
--- ./ext/gd/config.m4 2005/04/13 01:27:50 1.1
+++ ./ext/gd/config.m4 2005/04/13 01:29:48
@@ -111,6 +111,7 @@
if test "$PHP_XPM_DIR" != "no"; then
for i in $PHP_XPM_DIR /usr/local /usr/X11R6 /usr; do
+ test -f $i/lib/noX/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/noX/libXpm.a && GD_XPM_DIR=$i && GD_XPM_NOX=1 && break
test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.a && GD_XPM_DIR=$i && break
done
@@ -119,23 +120,36 @@
fi
for i in include include/X11; do
- test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/include
+ test -n "$GD_XPM_NOX" -a -f $GD_XPM_DIR/$i/noX/xpm.h && GD_XPM_INC=$GD_XPM_DIR/$i/noX
+ test -f $GD_XPM_DIR/$i/xpm.h && GD_XPM_INC=$GD_XPM_DIR/$i
done
if test -z "$GD_XPM_INC"; then
AC_MSG_ERROR([xpm.h not found.])
fi
- PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
- [
- PHP_ADD_INCLUDE($GD_XPM_INC)
- PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
- ],[
- -L$GD_XPM_DIR/lib -lX11
- ])
+ if test -n "$GD_XPM_NOX"; then
+ PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
+ [
+ PHP_ADD_INCLUDE($GD_XPM_INC)
+ PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib/noX, GD_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
+ ],[
+ -L$GD_XPM_DIR/lib/noX
+ ])
+ else
+ PHP_CHECK_LIBRARY(Xpm,XpmFreeXpmImage,
+ [
+ PHP_ADD_INCLUDE($GD_XPM_INC)
+ PHP_ADD_LIBRARY_WITH_PATH(Xpm, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(X11, $GD_XPM_DIR/lib, GD_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([Problem with libXpm.(a|so) or libX11.(a|so). Please check config.log for more information.])
+ ],[
+ -L$GD_XPM_DIR/lib -lX11
+ ])
+ fi
else
AC_MSG_RESULT(If configure fails try --with-xpm-dir=<DIR>)
fi
--- ./ext/wddx/config.m4 2005/04/13 01:28:10 1.1
+++ ./ext/wddx/config.m4 2005/04/13 01:29:48
@@ -12,4 +12,10 @@
fi
AC_DEFINE(HAVE_WDDX, 1, [ ])
PHP_NEW_EXTENSION(wddx, wddx.c, $ext_shared)
+ if test -z "$EXPAT_DIR"; then
+ PHP_ADD_LIBRARY_WITH_PATH(expat, /usr/lib, WDDX_SHARED_LIBADD)
+ else
+ PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR, WDDX_SHARED_LIBADD)
+ fi
+ PHP_SUBST(WDDX_SHARED_LIBADD)
fi
--- ./Makefile.global 2005/04/13 01:27:06 1.1
+++ ./Makefile.global 2005/04/13 01:29:48
@@ -1,5 +1,5 @@
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
-INSTALL = $(top_srcdir)/build/shtool install -c
+INSTALL = /usr/bin/install
INSTALL_DATA = $(INSTALL) -m 644
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
@@ -14,9 +14,9 @@
build-modules: $(PHP_MODULES)
-libphp4.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
- -@$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
+$(OVERALL_TARGET): $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
+ $(CC) -shared $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -L/usr/lib/apache -lhttpd -o $@
+ -@$(LIBTOOL) --silent --mode=install cp $(OVERALL_TARGET) $(phptempdir)/$(OVERALL_TARGET) >/dev/null 2>&1
libs/libphp4.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp4.so
@@ -40,7 +40,6 @@
@test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
@echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
- @rm -f modules/*.la >/dev/null 2>&1
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
install-tester:
@@ -67,7 +66,7 @@
find . -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
- rm -f libphp4.la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
+ rm -f $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php4.spec sapi/apache/libphp4.module buildmk.stamp
--- ./sapi/apache/config.m4 2005/04/13 01:28:17 1.1
+++ ./sapi/apache/config.m4 2005/04/13 01:29:48
@@ -77,6 +77,10 @@
SAPI_SHARED=libs/libphp4.so
build_type=bundle
;;
+ *cygwin*)
+ SAPI_SHARED=libs/cygphp4.dll
+ build_type=shared
+ ;;
*)
build_type=shared
;;
--- ./sapi/cli/config.m4 2005/04/13 01:28:31 1.1
+++ ./sapi/cli/config.m4 2005/04/13 01:29:48
@@ -30,7 +30,7 @@
BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
esac
- INSTALL_CLI="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(bindir); \$(INSTALL) -m 0755 \$(SAPI_CLI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php\$(program_suffix)"
+ INSTALL_CLI="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(bindir); \$(INSTALL) -m 0755 \$(SAPI_CLI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php\$(program_suffix)\$(BIN_EXT)"
PHP_SUBST(BUILD_CLI)
PHP_SUBST(INSTALL_CLI)
--- ./sapi/cli/Makefile.frag 2005/04/13 01:28:24 1.1
+++ ./sapi/cli/Makefile.frag 2005/04/13 01:29:48
@@ -6,4 +6,4 @@
@$(INSTALL_CLI)
@echo "Installing PHP CLI man page: $(INSTALL_ROOT)$(mandir)/man1/"
@$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1
- @$(INSTALL_DATA) $(builddir)/php.1 $(INSTALL_ROOT)$(mandir)/man1/php.1
+ @$(INSTALL_DATA) $(builddir)/php.1 $(INSTALL_ROOT)$(mandir)/man1/php$(program_suffix).1
--- ./scripts/Makefile.frag 2005/04/13 01:28:38 1.1
+++ ./scripts/Makefile.frag 2005/04/13 01:29:48
@@ -3,8 +3,8 @@
# Build environment install
#
-phpincludedir = $(includedir)/php
-phpbuilddir = $(prefix)/lib/php/build
+phpincludedir = $(includedir)/php$(program_suffix)
+phpbuilddir = $(prefix)/lib/php$(program_suffix)/build
BUILD_FILES = \
scripts/phpize.m4 \
@@ -51,14 +51,15 @@
done; \
$(mkinstalldirs) $$paths && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
- for i in $(HEADER_DIRS); do \
- (cd $(top_srcdir)/$$i && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
- cd $(top_builddir)/$$i && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
+ ABS_INSTALL_ROOT=`(cd $(INSTALL_ROOT) && pwd)`; for i in $(HEADER_DIRS); do \
+ (cd $(top_srcdir)/$$i && $(INSTALL_DATA) *.h $${ABS_INSTALL_ROOT}$(phpincludedir)/$$i; \
+ cd $(top_builddir)/$$i && $(INSTALL_DATA) *.h $${ABS_INSTALL_ROOT}$(phpincludedir)/$$i) 2>/dev/null || true; \
done; \
- cd $(top_srcdir)/sapi/embed && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/main
+ cd $(top_srcdir)/sapi/embed && $(INSTALL_DATA) *.h $${ABS_INSTALL_ROOT}$(phpincludedir)/main
install-programs: $(builddir)/phpize $(builddir)/php-config
@echo "Installing helper programs: $(INSTALL_ROOT)$(bindir)/"
+ -@$(mkinstalldirs) $(INSTALL_ROOT) $(INSTALL_ROOT)$(bindir)
@for prog in $(bin_SCRIPTS); do \
echo " program: $(program_prefix)$$prog$(program_suffix)"; \
$(INSTALL) -m 755 $(builddir)/$$prog $(INSTALL_ROOT)$(bindir)/$(program_prefix)$$prog$(program_suffix); \
--- ./scripts/php-config.in 2005/04/13 01:28:48 1.1
+++ ./scripts/php-config.in 2005/04/13 01:56:57
@@ -2,7 +2,7 @@
prefix="@prefix@"
version="@PHP_VERSION@"
-includedir="@includedir@/php"
+includedir="@includedir@/php AT program_suffix@"
includes="-I$includedir -I$includedir/main -I$includedir/TSRM -I$includedir/Zend"
ldflags="@PHP_LDFLAGS@"
libs="@EXTRA_LIBS@"
--- ./scripts/phpize.in 2005/04/13 01:28:55 1.1
+++ ./scripts/phpize.in 2005/04/13 01:59:01
@@ -2,13 +2,13 @@
# Variable declaration
prefix='@prefix@'
-phpdir="$prefix/lib/php/build"
-includedir="$prefix/include/php"
+phpdir="$prefix/lib/php AT program_suffix@/build"
+includedir="$prefix/include/php AT program_suffix@"
builddir="`pwd`"
FILES_BUILD="mkdep.awk scan_makefile_in.awk shtool libtool.m4"
FILES="acinclude.m4 Makefile.global config.sub config.guess ltmain.sh"
-CLEAN_FILES="$FILES *.o *.lo *.la .deps .libs/ build/ include/ modules/ install-sh \
+CLEAN_FILES="$FILES *.o *.lo *.la *.dll *.dll.a .deps .libs/ build/ include/ modules/ install-sh \
mkinstalldirs missing config.nice config.sub config.guess configure configure.in \
aclocal.m4 config.h config.h.in conftest* ltmain.sh libtool config.cache autom4te.cache/ \
config.log config.status Makefile Makefile.fragments Makefile.objects confdefs.h"
--------------B378EB36D02A713D564B7253
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--------------B378EB36D02A713D564B7253--
- Raw text -