RE: [PHP-DEV] Extensions calling C++
| From: | John Keiser | Date: | Sun, 09 Jul 2000 21:45:14 +0000 |
| Subject: | RE: [PHP-DEV] Extensions calling C++ | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23959@lists.php.net to get a copy of this message | ||
> From: Sascha Schumann [mailto:sascha@schumann.cx]
>
> On Sun, 9 Jul 2000, John Keiser wrote:
> >
> > This is what my project looks like (originally generated with ext_skel),
> > with just pertinent info:
> >
> > Makefile.in:
> > ------------------
> > LTLIBRARY_NAME = libsword.la
> > LTLIBRARY_SOURCES = sword.c sword_int.C
>
> Please update your CVS checkout and rewrite the above line as
>
> LTLIBRARY_SOURCES = sword.c
> LTLIBRARY_OBJECTS_X = sword_int.lo
>
> Then rename sword_int.C to sword_int.cxx.
>
> Also add PHP_REQUIRE_CXX to your config.m4 (this shall be run
> conditionally only).
>
> Please let us know whether it works.
>
Doesn't work yet, looks like it's still not compiling ... I checked out PHP4
/ Zend from CVS and tried it out there.
My system has libtool 1.3.5 and make 3.77.
It may be me, though ... to do the PHP_REQUIRE_CXX thing, I placed a line
which just said PHP_REQUIRE_CXX inside my conditional "if sword is enabled."
Other than that, Makefile.in is modified:
----------
# $Id$
LTLIBRARY_NAME = libsword.la
LTLIBRARY_SOURCES = sword.c
LTLIBRARY_SHARED_NAME = sword.la
LTLIBRARY_OBJECTS_X = sword_int.lo
include $(top_srcdir)/build/dynlib.mk
----------
and the files in the directory include sword_int.cxx, sword.c, and
sword_int.h.
I got a warning a couple of times from buildconf:
configure.in:609: AC_PROG_CXXCPP was called before AC_PROG_CXX
The output from make in this directory now:
[john@wyoming sword]$ make
make[1]: Entering directory `/home/john/cvs/php4/ext/sword'
gcc -DHAVE_CONFIG_H -I. -I/home/john/cvs/php4/ext/sword -I/home/john/cvs/ph
p4 -I/home/john/
cvs/php4/main -I/home/john/cvs/php4/Zend -I/home/john/cvs/php4 -I/home/john/
cvs/php4/ext/mys
ql/libmysql -I/home/john/cvs/php4/ext/xml/expat/xmltok -I/home/john/cvs/php4
/ext/xml/expat/x
mlparse -DXML_BYTE_ORDER=12 -g -O2 -c sword.c && touch sword.lo
/bin/sh /home/john/cvs/php4/libtool --silent --mode=link
cc -DHAVE_CONFIG_H -I. -I/home/jo
hn/cvs/php4/ext/sword -I/home/john/cvs/php4 -I/home/john/cvs/php4/main -I/ho
me/john/cvs/php4
/Zend -I/home/john/cvs/php4 -I/home/john/cvs/php4/ext/mysql/libmysql -I/home
/john/cvs/php4/e
xt/xml/expat/xmltok -I/home/john/cvs/php4/ext/xml/expat/xmlparse -DXML_BYTE
_ORDER=12 -g -O2
-o libsword.la sword.lo sword_int.lo
ar: sword_int.o: No such file or directory
make[1]: *** [libsword.la] Error 1
make[1]: Leaving directory `/home/john/cvs/php4/ext/sword'
make: *** [all-recursive] Error 1
[john@wyoming sword]$ make
make[1]: Entering directory `/home/john/cvs/php4/ext/sword'
/bin/sh /home/john/cvs/php4/libtool --silent --mode=link
cc -DHAVE_CONFIG_H -I. -I/home/jo
hn/cvs/php4/ext/sword -I/home/john/cvs/php4 -I/home/john/cvs/php4/main -I/ho
me/john/cvs/php4
/Zend -I/home/john/cvs/php4 -I/home/john/cvs/php4/ext/mysql/libmysql -I/home
/john/cvs/php4/e
xt/xml/expat/xmltok -I/home/john/cvs/php4/ext/xml/expat/xmlparse -DXML_BYTE
_ORDER=12 -g -O2
-o libsword.la sword.lo sword_int.lo
ln: sword_int.o: File exists
make[1]: *** [libsword.la] Error 1
make[1]: Leaving directory `/home/john/cvs/php4/ext/sword'
make: *** [all-recursive] Error 1
Note the second time I run make it says "sword_int.o: File exists." Not
sure why this is.
I'd also like to note that since other people seem to prefer CC or perhaps
something else, I have no trouble changing to adapt :)
--John
P.S. It looks like the Support page has out-of-date CVS instructions: the
cvs.zend.net part was not there. Additionally, on the real CVS instructions
at cvs.php, it ought to note that you should cd into the php directory
before checking out Zend and TSRM.