Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Dec 1999 11:25:14 -0500 (EST)
From:      Mikhail Teterin <mi@kot.ne.mediaone.net>
To:        stable@freebsd.org, ports@freebsd.org
Subject:   -lc vs. -lc_r (building Apache-PHP)
Message-ID:  <199912271625.LAA74751@rtfm.newton>

next in thread | raw e-mail | index | archive | help

--ELM946311914-74626-0_
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello!

I found it quite difficult to build the apache13-php3 port :( I selected
MySQL support (among other features  -- nice interface, BTW). The apache
binary, however was seg-faulting on startup.

cc -DHARD_SERVER_LIMIT=512 \
	-DDEFAULT_PATH=\"/usr/local/bin:/bin:/usr/bin\" -funsigned-char \
	-DTARGET=\"apache\" -DMOD_SSL=204109 -DEAPI -DEAPI_MM \
	-DUSE_EXPAT -I./lib/expat-lite -O2 -fexpensive-optimizations \
	-pipe `./apaci` -L/usr/local/lib -Wl,-E -o apache \
	buildmark.o modules.o modules/standard/libstandard.a \
	modules/php3/libphp3.a main/libmain.a ./os/unix/libos.a \
	ap/libap.a lib/expat-lite/libexpat.a -L/usr/local/lib \
	-R/usr/local/lib/mysql /usr/local/lib/libc-client4.a -lgd -lpng \
	-lz -lttf -L/usr/local/lib/mysql -lmysqlclient -lexpat -lmcrypt \
	-lmhash -Lmodules/php3 -L../modules/php3 -L../../modules/php3 \
	-lmodphp3 -lz -lpam -lm -lcrypt -lcrypt -lgdbm -lmm
/usr/lib/libc_r.so.3: warning: mktemp() possibly used unsafely; consider using mkstemp()
/usr/lib/libc_r.so.3: warning: this program uses gets(), which is unsafe.
/usr/lib/libc_r.so.3: WARNING!  setkey(3) not present in the system!
/usr/lib/libc_r.so.3: WARNING!  des_setkey(3) not present in the system!
/usr/lib/libc_r.so.3: WARNING!  encrypt(3) not present in the system!
/usr/lib/libc_r.so.3: WARNING!  des_cipher(3) not present in the system!
/usr/lib/libc_r.so.3: warning: this program uses f_prealloc(), which is stupid.
# ldd apache
apache:
	libpng.so.3 => /usr/local/lib/libpng.so.3 (0x181a2000)
	libz.so.2 => /usr/lib/libz.so.2 (0x181bc000)
	libttf.so.4 => /usr/local/lib/libttf.so.4 (0x181c9000)
	libmysqlclient.so.6 => /usr/local/lib/mysql/libmysqlclient.so.6 (0x181ec000)
	libmcrypt.so.2 => /usr/local/lib/libmcrypt.so.2 (0x181fe000)
	libmhash.so.1 => /usr/local/lib/libmhash.so.1 (0x18214000)
	libpam.so.1 => /usr/lib/libpam.so.1 (0x18225000)
	libm.so.2 => /usr/lib/libm.so.2 (0x1822d000)
	libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x18248000)
	libgdbm.so.2 => /usr/local/lib/libgdbm.so.2 (0x1824b000)
	libmm.so.10 => /usr/local/lib/libmm.so.10 (0x18251000)
	libc.so.3 => /usr/lib/libc.so.3 (0x18255000)
	libc_r.so.3 => /usr/lib/libc_r.so.3 (0x182d7000)

# gdb apache
[...]
Program received signal SIGSEGV, Segmentation fault.
0x182bb240 in __swhatbuf () from /usr/lib/libc.so.3

Now, if I relink the executable manually, adding the -pthread at the end:

cc -DHARD_SERVER_LIMIT=512 \
	-DDEFAULT_PATH=\"/usr/local/bin:/bin:/usr/bin\" -funsigned-char \
	-DTARGET=\"apache\" -DMOD_SSL=204109 -DEAPI -DEAPI_MM \
	-DUSE_EXPAT -I./lib/expat-lite -O2 -fexpensive-optimizations \
	-pipe `./apaci` -L/usr/local/lib -Wl,-E -o apache \
	buildmark.o modules.o modules/standard/libstandard.a \
	modules/php3/libphp3.a main/libmain.a ./os/unix/libos.a \
	ap/libap.a lib/expat-lite/libexpat.a -L/usr/local/lib \
	-R/usr/local/lib/mysql /usr/local/lib/libc-client4.a -lgd -lpng \
	-lz -lttf -L/usr/local/lib/mysql -lmysqlclient -lexpat -lmcrypt \
	-lmhash -Lmodules/php3 -L../modules/php3 -L../../modules/php3 \
	-lmodphp3 -lz -lpam -lm -lcrypt -lcrypt -lgdbm -lmm -pthread
/usr/lib/libc.so.3: warning: mktemp() possibly used unsafely; consider using mkstemp()
/usr/lib/libc.so.3: warning: this program uses gets(), which is unsafe.
/usr/lib/libc.so.3: WARNING!  setkey(3) not present in the system!
/usr/lib/libc.so.3: WARNING!  des_setkey(3) not present in the system!
/usr/lib/libc.so.3: WARNING!  encrypt(3) not present in the system!
/usr/lib/libc.so.3: WARNING!  des_cipher(3) not present in the system!
/usr/lib/libc.so.3: warning: this program uses f_prealloc(), which is stupid.

The libraries are arranged differently:
apache:
        libpng.so.3 => /usr/local/lib/libpng.so.3 (0x181a2000)
        libz.so.2 => /usr/lib/libz.so.2 (0x181bc000)
        libttf.so.4 => /usr/local/lib/libttf.so.4 (0x181c9000)
        libmysqlclient.so.6 => /usr/local/lib/mysql/libmysqlclient.so.6 (0x181ec000)
        libmcrypt.so.2 => /usr/local/lib/libmcrypt.so.2 (0x181fe000)
        libmhash.so.1 => /usr/local/lib/libmhash.so.1 (0x18214000)
        libpam.so.1 => /usr/lib/libpam.so.1 (0x18225000)
        libm.so.2 => /usr/lib/libm.so.2 (0x1822d000)
        libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x18248000)
        libgdbm.so.2 => /usr/local/lib/libgdbm.so.2 (0x1824b000)
        libmm.so.10 => /usr/local/lib/libmm.so.10 (0x18251000)
        libc_r.so.3 => /usr/lib/libc_r.so.3 (0x18255000)
        libc.so.3 => /usr/lib/libc.so.3 (0x182e9000)

and the server starts and appears to work.

What's the magic  and why doesn't the  port know it? Why is  -lc even in
play if some of the components (-lmysqlclient) require -lc_r? Yours,

	-mi

FreeBSD rtfm.newton 3.4-STABLE FreeBSD 3.4-STABLE #0: Fri Dec 17 08:49:51 EST 1999

--ELM946311914-74626-0_
Content-Type: text/plain; charset=KOI8-R
Content-Disposition: attachment; filename=Makefile.inc
Content-Description: Automaticly generated by the port
Content-Transfer-Encoding: 7bit

PKGNAME=	apache+php+mod_ssl-${VERSION_APACHE}+${VERSION_PHP}+${VERSION_MODSSL}
DISTFILES+=	mod_ssl-${VERSION_MODSSL}-${VERSION_APACHE}${EXTRACT_SUFX}

BUILD_DEPENDS+=	openssl:${PORTSDIR}/security/openssl \
		mm-config:${PORTSDIR}/devel/mm \
		${PREFIX}/lib/libmm.a:${PORTSDIR}/devel/mm
LIB_DEPENDS+=	crypto.1:${PORTSDIR}/security/openssl \
		ssl.1:${PORTSDIR}/security/openssl
RUN_DEPENDS+=	openssl:${PORTSDIR}/security/openssl

VERSION_MODSSL=	2.4.9

RESTRICTED=	"Contains cryptography"

CONFIGURE_ARGS+=--enable-module=ssl \
		--enable-module=define
CONFIGURE_ENV+=	SSL_BASE='SYSTEM' EAPI_MM='SYSTEM' PATH="${PREFIX}/bin:${PATH}"

PLIST=		${PKGDIR}/PLIST.modssl
SSL=		ssl

TYPE=	test
CRT=
KEY=

pre-patch:
	@cd ${WRKDIR}/mod_ssl-${VERSION_MODSSL}-${VERSION_APACHE} \
	&& ${ECHO_MSG} "===>  Applying mod_ssl-${VERSION_MODSSL} extension" \
	&& ./configure --with-apache=../${DISTNAME} --expert

post-patch:
	@cd ${WRKSRC} \
	&& find . -type f -name "*.orig" -print | xargs ${RM} -f

post-build:
	@cd ${WRKSRC} \
	&& ${ECHO_MSG} "===>  Creating Dummy Certificate for Server (SnakeOil)" \
	&& ${ECHO_MSG} "      [use 'make certificate' to create a real one]" \
	&& ${MAKE} certificate TYPE=dummy >/dev/null 2>&1

certificate:
	@cd ${WRKSRC} \
	&& ${ECHO_MSG} "===>  Creating Test Certificate for Server" \
	&& ${MAKE} certificate TYPE=$(TYPE) CRT=$(CRT) KEY=$(KEY)

BUILD_DEPENDS+=	${PREFIX}/lib/libgd.a:${PORTSDIR}/graphics/gd
PHP_CONF_ARGS+=	--with-gd=${PREFIX}
LIB_DEPENDS+=	ttf.4:${PORTSDIR}/print/freetype
PHP_CONF_ARGS+=	--with-ttf=${PREFIX}
PHP_CONF_ARGS+=	--with-zlib
LIB_DEPENDS+=	mcrypt.2:${PORTSDIR}/security/libmcrypt
PHP_CONF_ARGS+=	--with-mcrypt=${PREFIX}
LIB_DEPENDS+=	mhash.1:${PORTSDIR}/security/mhash
PHP_CONF_ARGS+=	--with-mhash=${PREFIX}
BUILD_DEPENDS+=	${PREFIX}/lib/libc-client4.a:${PORTSDIR}/mail/imap-uw
PHP_CONF_ARGS+=	--with-imap=${PREFIX}
LIB_DEPENDS+=	mysqlclient.6:${PORTSDIR}/databases/mysql322-client
PHP_CONF_ARGS+=	--with-mysql=${PREFIX}
BUILD_DEPENDS+=	${PREFIX}/lib/libexpat.a:${PORTSDIR}/textproc/expat
BUILD_DEPENDS+=	${PREFIX}/include/xml/xmlparse.h:${PORTSDIR}/textproc/expat
BUILD_DEPENDS+=	${PREFIX}/include/xml/xmltok.h:${PORTSDIR}/textproc/expat
PHP_CONF_ARGS+=	--with-xml=${PREFIX}

--ELM946311914-74626-0_--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912271625.LAA74751>