php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49151 relocation must bind locally
Submitted: 2009-08-04 13:02 UTC Modified: 2021-03-21 04:22 UTC
Votes:8
Avg. Score:4.5 ± 0.7
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:4 (66.7%)
From: tech at uscki dot nl Assigned: cmb (profile)
Status: No Feedback Package: Compile Failure
PHP Version: 5.3.0 OS: Sun Solaris 5.10 (i386)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
34 + 27 = ?
Subscribe to this entry?

 
 [2009-08-04 13:02 UTC] tech at uscki dot nl
Description:
------------
Compiling php 5.3.0 on SunOS 5.10 (i386) fails on "fatal: relocation error"

Reproduce code:
---------------
Compile was tried with both:
- GNU ld (GNU Binutils) 2.18
- ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.478

and also with and w/o addition of the make parameter: -fvisibility=hidden

./configure \
--prefix=/phil/usr/local/php-$VERSION \
--with-config-file-path=/phil/etc \
--with-apxs2=/phil/sw/sunos/i386/bin/apxs \
--with-db4=/phil/sw/sunos/i386 \
--with-jpeg-dir=/phil/sw/sunos/i386 \
--with-png-dir=/phil/sw/sunos/i386 \
--with-ldap=/phil/sw/sunos/i386 \
--with-openssl=/phil/sw/sunos/i386 \
--with-zlib \
--enable-zip \
--with-pgsql=/phil/sw/sunos/i386 \
--with-gettext \
--with-gd \
--enable-exif \
--with-pdo-pgsql=/phil/sw/sunos/i386 \
--with-iconv-dir=/phil/sw/sunos/i386 \
--with-libxml-dir=/phil/sw/sunos/i386 \
--with-tidy=/phil/usr/local \
--with-freetype-dir=/phil/sw/sunos/i386 \
--enable-gd-native-ttf \
--with-gnu-ld \
--with-xsl=/phil/sw/sunos/i386/pkg/libxslt-1.1.15 \
--enable-soap \
--with-mysql=mysqlnd

make CFLAGS="-fvisibility=hidden -mimpure-text -m32 -I/phil/sw/sunos/i386/include --with-gnu-ld --with-ld=/phil/sw/sunos/i386/bin/ld"

Expected result:
----------------
Clean compile

Actual result:
--------------
/bin/sh /home/gemeren/php/php-5.3.0/libtool --silent --preserve-dup-deps --mode=compile gcc  -IZend/ -I/home/gemeren/php/php-5.3.0/Zend/ -DPHP_ATOM_INC -I/home/gemeren/php/php-5.3.0/include -I/home/gemeren/php/php-5.3.0/main -I/home/gemeren/php/php-5.3.0 -I/home/gemeren/php/php-5.3.0/ext/date/lib -I/home/gemeren/php/php-5.3.0/ext/ereg/regex -I/phil/sw/sunos/i386/pkg/libxml2-2.6.22/include/libxml2 -I/phil/sw/sunos/i386/include -I/phil/sw/sunos/i386/include/freetype2 -I/phil/sw/sunos/i386/pkg/postgresql-8.1.1/include -I/home/gemeren/php/php-5.3.0/ext/sqlite3/libsqlite -I/phil/usr/local/include/tidy -I/phil/sw/sunos/i386/pkg/libxslt-1.1.15/include -I/home/gemeren/php/php-5.3.0/TSRM -I/home/gemeren/php/php-5.3.0/Zend  -D_POSIX_PTHREAD_SEMANTICS  -I/usr/include -g -O2 -fvisibility=hidden   -c /home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c -o Zend/zend_object_handlers.lo 
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c: In function 'zend_std_object_get_class':
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c:1199: warning: visibility attribute not supported in this configuration; ignored
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c: In function 'zend_std_object_get_class_name':
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c:1220: warning: visibility attribute not supported in this configuration; ignored
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c: In function 'zend_std_get_closure':
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c:1317: warning: visibility attribute not supported in this configuration; ignored
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c: In function 'zend_std_read_dimension':
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c:503: warning: visibility attribute not supported in this configuration; ignored
/home/gemeren/php/php-5.3.0/Zend/zend_object_handlers.c: In function 'zend_std_read_property':
 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/tidy/tidy.lo ext/tokenizer/tokenizer.lo ext/tokenizer/tokenizer_data.lo ext/xml/xml.lo ext/xml/compat.lo ext/xmlreader/php_xmlreader.lo ext/xmlwriter/php_xmlwriter.lo ext/xsl/php_xsl.lo ext/xsl/xsltprocessor.lo ext/zip/php_zip.lo ext/zip/zip_stream.lo ext/zip/lib/zip_add.lo ext/zip/lib/zip_error.lo ext/zip/lib/zip_fclose.lo ext/zip/lib/zip_fread.lo ext/zip/lib/zip_open.lo ext/zip/lib/zip_source_filep.lo ext/zip/lib/zip_strerror.lo ext/zip/lib/zip_close.lo ext/zip/lib/zip_error_get.lo ext/zip/lib/zip_file_error_get.lo ext/zip/lib/zip_free.lo ext/zip/lib/zip_rename.lo ext/zip/lib/zip_source_free.lo ext/zip/lib/zip_unchange_all.lo ext/zip/lib/zip_delete.lo ext/zip/lib/zip_error_get_sys_type.lo ext/zip/lib/zip_file_get_offset.lo ext/zip/lib/zip_get_name.lo ext/zip/lib/zip_replace.lo ext/zip/lib/zip_source_function.lo ext/zip/lib/zip_unchange.lo ext/zip/lib/zip_dirent.lo ext/zip/lib/zip_error_strerror.lo ext/zip/lib/zip_filerange_crc.lo ext/zip/lib/zip_file_strerror.lo ext/zip/lib/zip_get_num_files.lo ext/zip/lib/zip_get_archive_flag.lo ext/zip/lib/zip_set_archive_flag.lo ext/zip/lib/zip_set_name.lo ext/zip/lib/zip_source_zip.lo ext/zip/lib/zip_unchange_data.lo ext/zip/lib/zip_entry_free.lo ext/zip/lib/zip_error_to_str.lo ext/zip/lib/zip_fopen.lo ext/zip/lib/zip_name_locate.lo ext/zip/lib/zip_source_buffer.lo ext/zip/lib/zip_stat.lo ext/zip/lib/zip_entry_new.lo ext/zip/lib/zip_err_str.lo ext/zip/lib/zip_fopen_index.lo ext/zip/lib/zip_get_archive_comment.lo ext/zip/lib/zip_get_file_comment.lo ext/zip/lib/zip_new.lo ext/zip/lib/zip_source_file.lo ext/zip/lib/zip_stat_index.lo ext/zip/lib/zip_set_archive_comment.lo ext/zip/lib/zip_set_file_comment.lo ext/zip/lib/zip_unchange_archive.lo ext/zip/lib/zip_memdup.lo ext/zip/lib/zip_stat_init.lo ext/zip/lib/zip_add_dir.lo ext/zip/lib/zip_error_clear.lo ext/zip/lib/zip_file_error_clear.lo ext/mysqlnd/mysqlnd.lo ext/mysqlnd/mysqlnd_charset.lo ext/mysqlnd/mysqlnd_wireprotocol.lo ext/mysqlnd/mysqlnd_ps.lo ext/mysqlnd/mysqlnd_loaddata.lo ext/mysqlnd/mysqlnd_palloc.lo ext/mysqlnd/mysqlnd_ps_codec.lo ext/mysqlnd/mysqlnd_statistics.lo ext/mysqlnd/mysqlnd_qcache.lo ext/mysqlnd/mysqlnd_result.lo ext/mysqlnd/mysqlnd_result_meta.lo ext/mysqlnd/mysqlnd_debug.lo ext/mysqlnd/mysqlnd_block_alloc.lo ext/mysqlnd/php_mysqlnd.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/network.lo main/php_open_temporary_file.lo main/php_logos.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_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_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_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo sapi/apache2handler/mod_php5.lo sapi/apache2handler/sapi_apache2.lo sapi/apache2handler/apache_config.lo sapi/apache2handler/php_functions.lo main/internal_functions.lo -lz -lexslt -ltidy -lpq -lrt -lpq -lldap -llber -lintl -lfreetype -lpng -lz -ljpeg -ldb-4.4 -lz -lssl -lcrypto -lresolv -lm -lnsl -lsocket -lgcc -lxml2 -lz -liconv -lm -lsocket -lnsl -lgcc_s -lxml2 -lz -liconv -lm -lsocket -lnsl -lgcc_s -lxml2 -lz -liconv -lm -lsocket -lnsl -lgcc_s -lxml2 -lz -liconv -lm -lsocket -lnsl -lgcc_s -lxml2 -lz -liconv -lm -lsocket -lnsl -lgcc_s -lxml2 -lz -liconv -lm -lsocket -lnsl -lgcc_s -lxml2 -lz -liconv -lm -lsocket -lnsl -lgcc_s -lxslt -lxml2 -lz -liconv -lsocket -lnsl -lgcc_s -lm  -o libphp5.la
ld: fatal: relocation error: R_386_GOTOFF: file ext/date/.libs/php_date.o: symbol date_ce_date: relocation must bind locally
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-04 14:31 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-08-04 17:04 UTC] tech at uscki dot nl
Alas, same result
 [2009-08-04 19:15 UTC] jani@php.net
http://www.opensolaris.org/jive/thread.jspa?
threadID=35812&tstart=0#145783
 [2009-08-05 08:26 UTC] tech at uscki dot nl
Not sure what you mean exactly with that post, but the LDFLAGS are set before compilation to the following:

export LDFLAGS="$LDFLAGS -L/phil/sw/sunos/i386/lib"
export LDFLAGS="$LDFLAGS -R/phil/sw/sunos/i386/lib"

This all worked fine with php 5.2.9 . Anyway thanks for the help so far! I will be out for about a week, so I will look at it again by that time (hopefully with fresh new insight! ;) )

Kind regards,
Coert
 [2009-08-05 14:39 UTC] jani@php.net
Assigned to Nuno who's patch broke this.
 [2009-08-05 14:48 UTC] jani@php.net
Would this help:

ext/date/php_date.c:511

-zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period;
+static zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period;

(add static there :)
 [2009-08-10 22:51 UTC] nlopess@php.net
If adding static doesn't help, we can disable the visibility thing on solaris. (due to the apparently broken compiler/assembler).
 [2009-08-13 09:50 UTC] tech at uscki dot nl
Hi, the suggestion of making date_ce_date static seems to help! But I'm not quite there yet :( , date_globals gives a similar error:

ld: fatal: relocation error: R_386_GOTOFF: file ext/date/.libs/php_date.o: symbol date_globals: relocation must bind locally

I'm not quite able to find its definition to make that one static as well (due to my lousy C-skills ... ;) ). Any ideas where to do this?
 [2009-08-13 10:01 UTC] jani@php.net
in ext/date/php_date.c:485, add static in front of this line:

ZEND_DECLARE_MODULE_GLOBALS(date)

 [2009-08-14 10:08 UTC] tech at uscki dot nl
Hmmm, adding static isn't trivial, these first two methods were the tip of the iceberg... Looks like I'll be adding it all through the code if I go through with this (I stopped after about 10 changes in various files). 

How do I "disable the visibility thing", as Nuno noted?
 [2009-08-14 16:49 UTC] nlopess@php.net
you can disable the visibility patch by editing the configure.in file and removing the occurrence of "-fvisibility=hidden". Then do a ./vcsclean && ./configure && make. Then please report if it worked, and which compiler version you used. thanks.
 [2009-08-14 21:54 UTC] nlopess@php.net
sorry, I forgot to say that before ./configure you must run ./buildconf
 [2009-08-14 23:13 UTC] tech at uscki dot nl
Yeah, got it compiling! I removed "-fvisibility=hidden" from the Makefile after running ./configure, guess that boils down to the same result, though your suggestion is a bit tidier.

Compiler: gcc (GCC) 4.0.1

Thanks for all your help!
 [2009-08-17 09:42 UTC] jani@php.net
It should be as simple as adding 'static' in the macro ZEND_DECLARE_MODULE_GLOBALS since those should be static anyway..


 [2010-05-24 17:20 UTC] dbakyle at gmail dot com
I've removed the -fvisibility=hidden from the Makefile and tried the make again.  
The process is still failing on glob_wrapper.lo

I'm using 4.1.2 of gcc and 2.6.18-92.1.22.0.1 of Red Hat.
 [2010-09-13 23:45 UTC] brentk at birs dot ca
I'm getting the same problem with PHP 5.3.3 on Solaris 10 (x64), gcc 4.3.3.  The 
compile dies at php_date.o with the same message as the original post.  If I 
remove the "-fvisibility=hidden" part from configure, this doesn't happen.
 [2010-12-20 12:07 UTC] jani@php.net
-Package: Tidy +Package: Compile Failure
 [2012-01-20 19:42 UTC] nlopess@php.net
-Status: Assigned +Status: Open -Assigned To: nlopess +Assigned To:
 [2012-03-14 06:18 UTC] sergei dot solomonov at gmail dot com
Try this:

ext/date/php_date.c:511 (line 508, for php 5.4)

-zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period;
+static zend_class_entry *date_ce_date, *date_ce_timezone,
*date_ce_interval, *date_ce_period;
 [2013-03-03 15:51 UTC] eugene at zhegan dot in
Guys, this stuff about relocation errors is still actual for the php 5.4.x and gcc 4.x, for example on Solaris 10 and gcc 4.7.2 (althought it does not fire on Solaris 11 and less recent gcc). No questions, it still builds just fine using gcc 3.4.3, but any way 3.4.3 will go sooner or later.

Still helps to edit the Makefile manually and remove -fvisibility=hidden.
 [2021-03-04 12:46 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-03-04 12:46 UTC] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-03-08 13:48 UTC] cmb@php.net
-Status: Verified +Status: Feedback
 [2021-03-08 13:48 UTC] cmb@php.net
Oops, wrong status!
 [2021-03-21 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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC