php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73777 Undefined symbols during linking
Submitted: 2016-12-17 17:09 UTC Modified: 2017-01-25 22:38 UTC
From: dclarke at blastwave dot org Assigned:
Status: Open Package: Compile Failure
PHP Version: 7.0.14 OS: Solaris 10 Update 11
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-12-17 17:09 UTC] dclarke at blastwave dot org
Description:
------------
No test script as this is a compile from sources using cc compiler provided in
the standards compliant Oracle Studio 12.5 developer tools on Solaris 10 update
11 with the latest up to date system patches. 

Configure stage was trivial and successful :

$ ./configure --disable-all \
> --with-apxs2=/usr/local/bin/apxs --sysconfdir=/usr/local/etc \
> --includedir=/usr/local/include \
> --libdir=/usr/local/lib --libexecdir=/usr/local/libexec \
> --localstatedir=/usr/local/var/php --mandir=/usr/local/share/man \
> --infodir=/usr/local/share \
> --cache-file=../php-7.0.14_SunOS5.10_sparcv9.001.cache

The CFLAGS were set to allow a debug build with no optimization and also
allows for extensions to C as PHP source is not C99 standards compliant yet.

Thus : 

CFLAGS = 
-errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff -m64
-xmemalign=8s -xnolibmil -Xa -xcode=pic32 -xregs=no%appl -xlibmieee
-ftrap=%none -xtarget=ultraT2 -xcache=8/16/4:4096/64/16
-D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE

Compile resulted in Zend/zend_alloc.c, line 2389 error: identifier redefined: _emalloc  thus : 


/usr/local/bin/bash /usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/libtool --silent --preserve-dup-deps --mode=compile /usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/meta_ccld   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -IZend/ -I/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/ -DPHP_ATOM_INC -I/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/include -I/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/main -I/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001 -I/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/ext/date/lib -I/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/TSRM -I/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend  -lsocket -lnsl -I/usr/local/include -I/usr/local/ssl/include -I/opt/mysql/mysql/include -DOPENSSL_NO_SSL2 -D_EXTENSIONS_ -D__EXTENSIONS__ -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT  -errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff -m64 -xmemalign=8s -xnolibmil -Xa -xcode=pic32 -xregs=no%appl -xlibmieee -ftrap=%none -xtarget=ultraT2 -xcache=8/16/4:4096/64/16 -fast -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -Kthread -DZTS   -c /usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c -o Zend/zend_alloc.lo 
cc: Warning: illegal option -Kthread
cc: Warning: illegal option -Kthread
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_multiply.h", line 276: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_multiply.h", line 289: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 569: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 569: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 569: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 569: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 662: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 662: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 662: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_operators.h", line 662: warning: integer overflow detected: op "<<"
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 1034: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 1052: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 1527: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 1773: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 1791: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2389: error: identifier redefined: _emalloc
        current : function(unsigned long) returning pointer to void
        previous: function(unsigned long) returning pointer to void : "/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2383
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2424: error: identifier redeclared: _efree
        current : function(pointer to void, unsigned long) returning void
        previous: function(pointer to void) returning void : "/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.h", line 78
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2441: error: identifier redefined: _efree
        current : function(pointer to void, unsigned long) returning void
        previous: function(pointer to void, unsigned long) returning void : "/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2425
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2449: error: identifier redefined: _emalloc
        current : function(unsigned long) returning pointer to void
        previous: function(unsigned long) returning pointer to void : "/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2390
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2464: error: identifier redefined: _efree
        current : function(pointer to void) returning void
        previous: function(pointer to void, unsigned long) returning void : "/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2442
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2618: warning: statement not reached
"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2630: warning: statement not reached
cc: acomp failed for /usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c
gmake: *** [Zend/zend_alloc.lo] Error 1
$ 

see also https://bugs.php.net/bug.php?id=73601


Test script:
---------------
See Description as this is not a PHP script bug.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-14 13:32 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2017-01-14 13:32 UTC] cmb@php.net
Somehow the compiler messages don't make sense. For instance:

"/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2464: error: identifier redefined: _efree
        current : function(pointer to void) returning void
        previous: function(pointer to void, unsigned long) returning void : "/usr/local/build/php-7.0.14_SunOS5.10_sparcv9.001/Zend/zend_alloc.c", line 2442

line 2442 declares _efree_huge[1], but not _efree.

Please check whether there are line numbering issues.

[1] <https://github.com/php/php-src/blob/PHP-7.0.14/Zend/zend_alloc.c#L2442>
 [2017-01-22 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2017-01-23 04:31 UTC] dclarke at blastwave dot org
I will test this problem with 7.0.15 as well as 7.1.1 but clearly this bug
report says version 7.0.14.  I think the problem persists but I will look
into this.
 [2017-01-23 11:17 UTC] cmb@php.net
-Status: No Feedback +Status: Feedback
 [2017-01-23 11:18 UTC] cmb@php.net
> Please check whether there are line numbering issues.

I'm talking about *line* (not *version*) numbers. Either your
PHP 7.0.14 sources have other line numbers than the official
sources, or your compiler presents wrong line numbers, or it is
otherwise confused. See my comment above for details.
 [2017-01-25 21:58 UTC] dclarke at blastwave dot org
I have moved on to 7.0.15 where the compile succeeds for a while and fails in the link stage with many undefined symbols : 


/usr/local/bin/bash /usr/local/build/php-7.0.15_SunOS5.10_sparcv9.001/libtool --silent --preserve-dup-deps --mode=link /usr/local/build/php-7.0.15_SunOS5.10_sparcv9.001/meta_ccld -export-dynamic -errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff -m64 -xmemalign=8s -xnolibmil -Xa -xcode=pic32 -xregs=no%appl -xlibmieee -ftrap=%none -xarch=sparc -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -DUSE_ZEND_ALLOC=0 -g -DZTS   -L/usr/ucblib  -R /usr/ucblib ext/date/php_date.lo ext/date/lib/astro.lo ext/date/lib/dow.lo ext/date/lib/parse_date.lo ext/date/lib/parse_tz.lo ext/date/lib/timelib.lo ext/date/lib/tm2unixtime.lo ext/date/lib/unixtime2tm.lo ext/date/lib/parse_iso_intervals.lo ext/date/lib/interval.lo ext/pcre/pcrelib/pcre_chartables.lo ext/pcre/pcrelib/pcre_ucd.lo ext/pcre/pcrelib/pcre_compile.lo ext/pcre/pcrelib/pcre_config.lo ext/pcre/pcrelib/pcre_exec.lo ext/pcre/pcrelib/pcre_fullinfo.lo ext/pcre/pcrelib/pcre_get.lo ext/pcre/pcrelib/pcre_globals.lo ext/pcre/pcrelib/pcre_maketables.lo ext/pcre/pcrelib/pcre_newline.lo ext/pcre/pcrelib/pcre_ord2utf8.lo ext/pcre/pcrelib/pcre_refcount.lo ext/pcre/pcrelib/pcre_study.lo ext/pcre/pcrelib/pcre_tables.lo ext/pcre/pcrelib/pcre_valid_utf8.lo ext/pcre/pcrelib/pcre_version.lo ext/pcre/pcrelib/pcre_xclass.lo ext/pcre/pcrelib/pcre_jit_compile.lo ext/pcre/php_pcre.lo ext/reflection/php_reflection.lo ext/spl/php_spl.lo ext/spl/spl_functions.lo ext/spl/spl_engine.lo ext/spl/spl_iterators.lo ext/spl/spl_array.lo ext/spl/spl_directory.lo ext/spl/spl_exceptions.lo ext/spl/spl_observer.lo ext/spl/spl_dllist.lo ext/spl/spl_heap.lo ext/spl/spl_fixedarray.lo ext/standard/crypt_freesec.lo ext/standard/crypt_blowfish.lo ext/standard/crypt_sha512.lo ext/standard/crypt_sha256.lo ext/standard/php_crypt_r.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/quot_print.lo ext/standard/rand.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/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/sha1.lo ext/standard/user_filters.lo ext/standard/uuencode.lo ext/standard/filters.lo ext/standard/proc_open.lo ext/standard/streamsfuncs.lo ext/standard/http.lo ext/standard/password.lo ext/standard/random.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.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/network.lo main/php_open_temporary_file.lo main/output.lo main/getopt.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo main/streams/glob_wrapper.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_dtrace.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_vm_opcodes.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_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_sort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_gc.lo Zend/zend_closures.lo Zend/zend_float.lo Zend/zend_string.lo Zend/zend_signal.lo Zend/zend_generators.lo Zend/zend_virtual_cwd.lo Zend/zend_ast.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_inheritance.lo Zend/zend_smart_str.lo Zend/zend_execute.lo main/internal_functions_cli.lo sapi/cli/php_cli.lo sapi/cli/php_http_parser.lo sapi/cli/php_cli_server.lo sapi/cli/ps_title.lo sapi/cli/php_cli_process_title.lo -lresolv -lrt -lm -lpthread  -o sapi/cli/php

results in : 


Undefined                       first referenced
 symbol                             in file
bind                                main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
recv                                main/streams/.libs/xp_socket.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
send                                main/streams/.libs/xp_socket.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
getservbyname                       ext/standard/.libs/basic_functions.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
socketpair                          ext/standard/.libs/streamsfuncs.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
getsockname                         main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
accept                              main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
gethostbyname_r                     main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libnsl.so.1)
listen                              main/streams/.libs/xp_socket.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
gethostbyaddr                       ext/standard/.libs/dns.o  (symbol belongs to implicit dependency /lib/64/libnsl.so.1)
sendto                              main/streams/.libs/xp_socket.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
socket                              main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
getprotobyname                      ext/standard/.libs/basic_functions.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
getprotobynumber                    ext/standard/.libs/basic_functions.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
setsockopt                          main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
getsockopt                          main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
connect                             main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
in6addr_any                         main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
getaddrinfo                         main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
getpeername                         main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
recvfrom                            main/streams/.libs/xp_socket.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
freeaddrinfo                        main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
inet_pton                           ext/standard/.libs/basic_functions.o  (symbol belongs to implicit dependency /lib/64/libnsl.so.1)
inet_ntoa                           ext/standard/.libs/dns.o  (symbol belongs to implicit dependency /lib/64/libnsl.so.1)
inet_ntop                           ext/standard/.libs/basic_functions.o  (symbol belongs to implicit dependency /lib/64/libnsl.so.1)
gai_strerror                        main/.libs/network.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
shutdown                            main/streams/.libs/xp_socket.o  (symbol belongs to implicit dependency /lib/64/libsocket.so.1)
ld: fatal: symbol referencing errors. No output written to sapi/cli/php
gmake: *** [sapi/cli/php] Error 2

There seems to be some sort of a library issue and most likely LD options somewhere.
 [2017-01-25 22:38 UTC] cmb@php.net
-Summary: Zend/zend_alloc.c line 2389: error: identifier redefined: _emalloc +Summary: Undefined symbols during linking -Status: Feedback +Status: Open -Assigned To: cmb +Assigned To:
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 14:01:25 2019 UTC