While trying to compile mod_php 4.3.2-r3 I receive multiple errors referring to the jpeg library. Looking at the link command I found that -ljpeg was defined twice causing redefines on some of it's functions during the linking process. I did a manual ebuild mod_php-4.3.2-r3.ebuild unpack, edited the Makefile and removed the second -ljpeg and ran make. After this I ran ebuild mod_php-4.3.2-r3.ebuild install and it re-did the ./configure, which re-introduced the -ljpeg redundancy problem, which caused the install to fail. I'm quite stumped at what to do about this. So, without further adiue, here are the details: $ emerge info Portage 2.0.48-r1 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r4) ================================================================= System uname: 2.6.0-test1 i586 AMD-K6(tm) 3D+ Processor GENTOO_MIRRORS="ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo ftp://ftp.ussg.iu.edu/pub/linux/gentoo ftp://cs.ubishops.ca/pub/gentoo http://adelie.polymtl.ca/" CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/config /usr/kde/3/share/config /var/bind" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" PORTDIR="/usr/portage" DISTDIR="/usr/portage/distfiles" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR_OVERLAY="/usr/local/portage" USE="x86 3dnow crypt foomaticdb gif jpeg mmx ncurses pdflib png spell truetype xml2 zlib gdbm berkdb slang readline mysql tcpd pam libwww ssl perl python apache2 doc gd guile imap snmp -oss -apm -arts -avi -cups -encode -gtk -imlib -java -kde -gnome -libg++ -mad -mikmod -motif -mpeg -nls -oggvorbis -opengl -qt -quicktime -sdl -svga -X -xmms -xv -gpm" COMPILER="gcc3" CHOST="i686-pc-linux-gnu" CFLAGS="-march=k6-3 -mcpu=k6-3 -O3 -pipe" CXXFLAGS="-O2 -mcpu=i686 -pipe" ACCEPT_KEYWORDS="x86" MAKEOPTS="-j2" AUTOCLEAN="yes" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" FEATURES="sandbox ccache" Compile errors: /bin/sh /var/tmp/portage/mod_php-4.3.2-r3/work/php-4.3.2/libtool --silent --preserve-dup-deps --mode=link gcc -export-dynamic -march=i586 -export-symbols /var/tmp/portage/mod_php-4.3.2-r3/work/php-4.3.2/sapi/apache2handler/php.sym -avoid-version -module ext/zlib/zlib.lo ext/zlib/zlib_fopen_wrapper.lo ext/bcmath/bcmath.lo ext/bcmath/number.lo ext/bcmath/libbcmath/src/add.lo ext/bcmath/libbcmath/src/div.lo ext/bcmath/libbcmath/src/init.lo ext/bcmath/libbcmath/src/neg.lo ext/bcmath/libbcmath/src/outofmem.lo ext/bcmath/libbcmath/src/raisemod.lo ext/bcmath/libbcmath/src/rt.lo ext/bcmath/libbcmath/src/sub.lo ext/bcmath/libbcmath/src/compare.lo ext/bcmath/libbcmath/src/divmod.lo ext/bcmath/libbcmath/src/int2num.lo ext/bcmath/libbcmath/src/num2long.lo ext/bcmath/libbcmath/src/output.lo ext/bcmath/libbcmath/src/recmul.lo ext/bcmath/libbcmath/src/sqrt.lo ext/bcmath/libbcmath/src/zero.lo ext/bcmath/libbcmath/src/debug.lo ext/bcmath/libbcmath/src/doaddsub.lo ext/bcmath/libbcmath/src/nearzero.lo ext/bcmath/libbcmath/src/num2str.lo ext/bcmath/libbcmath/src/raise.lo ext/bcmath/libbcmath/src/rmzero.lo ext/bcmath/libbcmath/src/str2num.lo ext/bz2/bz2.lo ext/calendar/calendar.lo ext/calendar/dow.lo ext/calendar/french.lo ext/calendar/gregor.lo ext/calendar/jewish.lo ext/calendar/julian.lo ext/calendar/easter.lo ext/calendar/cal_unix.lo ext/crack/crack.lo ext/ctype/ctype.lo ext/dba/dba.lo ext/dba/dba_cdb.lo ext/dba/dba_db2.lo ext/dba/dba_dbm.lo ext/dba/dba_gdbm.lo ext/dba/dba_ndbm.lo ext/dba/dba_db3.lo ext/dba/dba_db4.lo ext/dba/dba_flatfile.lo ext/dba/libcdb/cdb.lo ext/dba/libcdb/cdb_make.lo ext/dba/libcdb/uint32.lo ext/dba/libflatfile/flatfile.lo ext/dbase/dbf_head.lo ext/dbase/dbf_rec.lo ext/dbase/dbf_misc.lo ext/dbase/dbf_ndx.lo ext/dbase/dbase.lo ext/dbx/dbx.lo ext/dbx/dbx_mysql.lo ext/dbx/dbx_odbc.lo ext/dbx/dbx_pgsql.lo ext/dbx/dbx_mssql.lo ext/dbx/dbx_fbsql.lo ext/dbx/dbx_oci8.lo ext/dbx/dbx_sybasect.lo ext/dio/dio.lo ext/domxml/php_domxml.lo ext/exif/exif.lo ext/filepro/filepro.lo ext/ftp/php_ftp.lo ext/ftp/ftp.lo ext/gd/gd.lo ext/gd/gdttf.lo ext/gd/libgd/gd.lo ext/gd/libgd/gd_gd.lo ext/gd/libgd/gd_gd2.lo ext/gd/libgd/gd_io.lo ext/gd/libgd/gd_io_dp.lo ext/gd/libgd/gd_io_file.lo ext/gd/libgd/gd_ss.lo ext/gd/libgd/gd_io_ss.lo ext/gd/libgd/gd_png.lo ext/gd/libgd/gd_jpeg.lo ext/gd/libgd/gdxpm.lo ext/gd/libgd/gdfontt.lo ext/gd/libgd/gdfonts.lo ext/gd/libgd/gdfontmb.lo ext/gd/libgd/gdfontl.lo ext/gd/libgd/gdfontg.lo ext/gd/libgd/gdtables.lo ext/gd/libgd/gdft.lo ext/gd/libgd/gdcache.lo ext/gd/libgd/gdkanji.lo ext/gd/libgd/wbmp.lo ext/gd/libgd/gd_wbmp.lo ext/gd/libgd/gdhelpers.lo ext/gd/libgd/gd_topal.lo ext/gd/libgd/gd_gif_in.lo ext/gd/libgd/xbm.lo ext/iconv/iconv.lo ext/imap/php_imap.lo ext/mcrypt/mcrypt.lo ext/mhash/mhash.lo ext/mime_magic/mime_magic.lo ext/mysql/php_mysql.lo ext/openssl/openssl.lo ext/overload/overload.lo ext/pcre/pcrelib/maketables.lo ext/pcre/pcrelib/get.lo ext/pcre/pcrelib/study.lo ext/pcre/pcrelib/pcre.lo ext/pcre/php_pcre.lo ext/pdf/pdf.lo ext/posix/posix.lo ext/pspell/pspell.lo ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo ext/session/mod_user.lo ext/shmop/shmop.lo ext/snmp/snmp.lo ext/sockets/sockets.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/parsedate.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/aggregation.lo ext/standard/sha1.lo ext/sysvsem/sysvsem.lo ext/sysvshm/sysvshm.lo ext/tokenizer/tokenizer.lo ext/wddx/wddx.lo ext/xml/xml.lo ext/xml/expat/xmlparse.lo ext/xml/expat/xmlrole.lo ext/xml/expat/xmltok.lo ext/xmlrpc/xmlrpc-epi-php.lo ext/xmlrpc/libxmlrpc/base64.lo ext/xmlrpc/libxmlrpc/simplestring.lo ext/xmlrpc/libxmlrpc/xml_to_dandarpc.lo ext/xmlrpc/libxmlrpc/xmlrpc_introspection.lo ext/xmlrpc/libxmlrpc/encodings.lo ext/xmlrpc/libxmlrpc/system_methods.lo ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.lo ext/xmlrpc/libxmlrpc/queue.lo ext/xmlrpc/libxmlrpc/xml_element.lo ext/xmlrpc/libxmlrpc/xmlrpc.lo ext/xmlrpc/libxmlrpc/xml_to_soap.lo ext/xslt/xslt.lo ext/xslt/sablot.lo regex/regcomp.lo regex/regexec.lo regex/regerror.lo regex/regfree.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/streams.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/memory_streams.lo main/user_streams.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lc-client -lssl -lcrypto -lsablot -lexpat -lexpat -lpspell -lpdf -lz -ltiff -lpng -ljpeg -lmysqlclient -lmhash -lmcrypt -lltdl -lcrypt -lpam -lt1 -lttf -lpng -lz -ljpeg -lxsltbreakpoint -lxml2 -lxslt -lz -lndbm -lgdbm -lcrack -lbz2 -lz -lssl -lcrypto -lresolv -lm -lxmlparse -lxmltok -lxml2 -lz -lm -lnetsnmp -lcrypto -lm -lcrypt -o sapi/cli/php /usr/lib/libc-client.a(osdep.o)(.text+0x97ad): In function `ssl_onceonlyinit': /var/tmp/portage/c-client-2002d/work/imap-2002d/c-client/osdep.c:287: the use of `tmpnam' is dangerous, better use `mkstemp' /usr/lib/libjpeg.a(jcapimin.o)(.text+0x0): In function `jpeg_CreateCompress': : multiple definition of `jpeg_CreateCompress' /usr/lib/libjpeg.a(jcapimin.o)(.text+0x0): first defined here /usr/lib/libjpeg.a(jcapimin.o)(.text+0x100): In function `jpeg_finish_compress': : multiple definition of `jpeg_finish_compress' /usr/lib/libjpeg.a(jcapimin.o)(.text+0x100): first defined here /usr/lib/libjpeg.a(jcapimin.o)(.text+0x240): In function `jpeg_destroy_compress': : multiple definition of `jpeg_destroy_compress' /usr/lib/libjpeg.a(jcapimin.o)(.text+0x240): first defined here /usr/lib/libjpeg.a(jcapimin.o)(.text+0x250): In function `jpeg_abort_compress': : multiple definition of `jpeg_abort_compress' /usr/lib/libjpeg.a(jcapimin.o)(.text+0x250): first defined here <SNIP> ... A whole whack more of these multiple definition errors ...</SNIP> collect2: ld returned 1 exit status make: *** [libphp4.la] Error 1 !!! ERROR: dev-php/mod_php-4.3.2-r3 failed. !!! Function php_src_compile, Line 383, Exitcode 2 !!! compile problem
Could you please attach /var/tmp/portage/mod_php-4.3.2-r3/work/php*/config.log ?
Created attachment 14581 [details] config.log for mod_php 4.3.2-r3 config.log as requested.
I've just commited a fix to the eclass. Please do: rm -rf /var/tmp/portage/{mod_php,php}* emerge sync emerge mod_php It should work now. If it doesn't please re-open this bug, and attach the latest config.log as well as the FULL output of the configure and make.
Created attachment 14687 [details] portage logfile with full ./configure and make process detailed. Here is the emerge logs, new config.log will follow.
Created attachment 14688 [details] new and improved config.log Here is the new config.log file. Just so you know, the problem seems to be the same as before. Exact same error messages in the exact same part of the make process. If I manually go into the /var/tmp/portage/mod_php-4.2.3-r3/work/mod_php-4.2.3-r3 directory and remove the extra -ljpeg from the EXTRA_LIBS variable I can compile it manually, but then I cannot emerge it. Thanks for your help!
Hmm, I don't see why this is happening. I used your settings and ran the ./configure etc on my own box, and then looking in the Makefile. In my EXTRA_LIBS I have two '-ljpeg' as well, but the entire emerge goes perfectly!
I don't know what's happening either. If I go in and edit the Makefile, removing the additional -ljpeg in the EXTRA_LIBS variable, then I can manually compile it fine when I do make manually. If I go to the directory after a failed emerge and leave the Makefile alone, I get the same error messages. Might it be my version of gcc? I'm running gcc 3.2.3-r1. What's even wierder is the fact that I believe I can compile the normal php ebuild just fine. It's only the mod_php ebuild that bombers on me. Any ideas?
Is there any way that I can do an ebuild mod_php unpack, compile the stinker myself, and then use ebuild/emerge to merge my compiled source? Or where could I put a line in my php.eclass script that would be a search/replace on the Makefile and remove one of the -ljpeg instances after it does the $myconf thing? Like some cat Makefile | sed 's/^EXTRA_LIBS/my new custom EXTRA_LIBS statement/' > Makefile.new mv Makefile.new Makefile ????? I'm really hoping to get this working as an ebuild so that I can easily update it when the next version of php comes out. Thanks again for your help!
I'm running the same GCC as you. As one idea, could you try: CFLAGS="-march=k6 -mcpu=k6-2 -O3 -pipe" CXXFLAGS="${CFLAGS}" in your make.conf? if that fails, i'll show you how to ebuild it with a single change like what you want.
On my testing box, after the ./configure I have this in the Makefile. Note just how many times some of the libraries are listed in it. EXTRA_LIBS = -lcrypt -lmcal -lc-client -lssl -lcrypto -lsablot -lexpat -lexpat -lswf -lqt -lpspell -lpdf -lz -ltiff -lpng -ljpeg -lmysqlclient -lming -lm -lmhash -lmcrypt -lltdl -lldap -llber -lcrypt -lpam -lfreetype -lX11 -lXpm -lpng -lz -ljpeg -lxsltbreakpoint -lxml2 -lxslt -lz -lndbm -lgdbm -lcurl -lcrack -lbz2 -lz -lssl -lcrypto -lresolv -lm -lxmlparse -lxmltok -lcurl -lz -lssl -lcrypto -ldl -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lodbc -lnetsnmp -lcrypto -lelf -lm -lcrypt
I tried what you said to no avail. So I leave you with two propositions. 1.) I give you temporary access to my Gentoo box so that you witness, beyond question, the oddities that I am experiencing, and if able to find the solution to said wierdness. 2.) If possible, you can tell me what snippits to add to my php.eclass file in order to just redefine that silly EXTRA_LIBS variable. I understand your question as to why the 2 occurances of -ljpeg are causing problems for me. I realize that this problem isn't logical nor probably, but for some darn reason it's a persistant impossibility :-) Thanks again, ever so much, for all of your help thus far. I truly appreciate it greatly. If you want to follow through with option 1, just e-mail me for the particulars on how to SSH into this box.
I fixed it up myself, and here is the stuff that I added to php.eclass to make it work. I ended up removing all duplicated -l flags, since they only bloat the binary file anyways. If this ever becomes a problem in the future, it probably wouldn't be to hard to write a small procedure that would automagically look at any LIBS variables and remove any redudant library includes. Thanks for all of your help! LIBS="${LIBS}" econf \ ${myconf} || die "bad ./configure" #-- What I added. mv Makefile Makefile.old cat Makefile.old | sed "s/^EXTRA_LIBS.*/EXTRA_LIBS = -lcrypt -lc-client -lssl -lcrypto -lsablot -lexpat -lpspell -lpdf -lz -ltiff -lpng -ljpeg -lmysqlclient -lmhash -lmcrypt -lltdl -lpam -lt1 -lttf -lxsltbreakpoint -lxml2 -lxslt -lndbm -lgdbm -lcrack -lbz2 -lresolv -lm -lxmlparse -lxmltok -lnetsnmp/" > Makefile rm Makefile.old #-- End What I added. emake || die "compile problem"
Hi Joel, The php.eclass change you posted isn't suitable for adding to Gentoo. The definition of EXTRA_LIBS will be different for different Gentoo users. Have you tried re-installing libjpeg at all? I think there's something wierd about the copy of this library that you have on your machine. Best regards, Stu
No I haven't. I'll try re-emerging libjpeg and then mod_php and see if it works. I also realize that my "dirty-fix" is not appropriate for distribution, but I do think that a small function could be written to find multiple -l definitions in various LIB variables from the Makefile that will not only get rid of problems like this, but will also reduce the size of the binary. Unless I'm mistaken, I assume that each -l is actually "re-including" that library into the final binary?
There are two parts to linking. 1. Run thru the list of libraries and objects and concatenate them together in that order 2. Remove duplicate items as needed. One other comment, try 'USE="pic" emerge mod_php' after you try re-emerging libjpeg if that fails.
It didn't help. I still got the same errors.
A quick explaination about linking: The -l<library> flag simply tells gcc to look inside lib<library>.<so|a> to resolve any functions that need resolving. If the library has a .so file, then (by default) no code is copied into the binary - some instructions are added to tell the operating system to load the library into memory when the binary runs. If the library only has a .a file, then code *is* copied into the binary - but only the code required to satisfy the function that needs resolving. I can't help but notice that your mod_php is linking against the libjpeg.a file. It should be linking against the libjpeg.so file. Your CFLAGS and CXXFLAGS specify different PC CPU architectures too - your CFLAGS is set for AMD's K6 processor (an i586-compatible chip), but your CXXFLAGS is set for 'i686'. If you've been compiling packages with inconsistent CFLAGS, you'll probably be having all sorts of weird problems!
I fixed the inconsistancy with the architecture settings a bit ago. It reads i586 now. And, if it is linking against a .la, how do I make it use the .so?
I have verified that my jpeg library is infact being compiled in as static no matter what I do. I took a look at the ebuild for the jpeg library and it was calling econf with --enable-shared and --enable-static. I commented out --enable-static, recompiled, but it still installed the stupid .la file. Looking closer I used ebuild to unpack the source, manually ran the ./configure --enable-shared and then looked at the Makefile, and it seems as if it only tries to install the static library. In this case would gcc actually compile in that .la once for every -ljpeg is being called. And if so it would seem as if this is the standard behaviour for at least this version of the jpeg library. Being as such it would seem as if the redundant -ljpeg will have to either be removed, or the jpeg library will have to be somewhat altered so that it actually attempts to install the .so file. Thanks again for your help, I have found this to be a learning experience :-)
The latest version of media-libs/jpeg should build a .so now.