RJ / ketama

C library for consistent hashing, and langauge bindings

Home Page:http://www.metabrew.com/article/libketama-consistent-hashing-algo-memcached-clients

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PPC, PPC64, php_ketama unable to compile

vaskes opened this issue · comments

Machine description: IBM JS20 PowerPC arch, RedHat 5.7
[root@bc4headnode1 log]# uname -a
Linux bc4headnode1 2.6.18-238.12.1.el5 #1 SMP Sat May 7 20:20:19 EDT 2011 ppc64 ppc64 ppc64 GNU/Linux

Php static compilation --with-ketama cannot be completed
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
ext/ketama/ketama.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1
[root@bc4headnode1 build-scripts]#

I tried to compile it as a module and its successfully compiled, but cannot be used. Error message:
[18-Aug-2011 18:51:44] PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'ketama.so' in Unknown on line 0

libketama creates a shared library, but there's also a separate
directory/source in the repo that creates the php module (also a .so
file) which depends on the ketama.so
are you sure you're trying to use the correct .so for php?

On 18 August 2011 16:01, vaskes
reply@reply.github.com
wrote:

Machine description: IBM JS20 PowerPC arch, RedHat 5.7
[root@bc4headnode1 log]# uname -a
Linux bc4headnode1 2.6.18-238.12.1.el5 #1 SMP Sat May 7 20:20:19 EDT 2011 ppc64 ppc64 ppc64 GNU/Linux

Php static compilation --with-ketama cannot be completed
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
/usr/bin/ld: ext/ketama/ketama.o: Relocations in generic ELF (EM: 3)
ext/ketama/ketama.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1
[root@bc4headnode1 build-scripts]#

I tried to compile it as a module and its successfully compiled, but cannot be used. Error message:
[18-Aug-2011 18:51:44] PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) 'ketama.so' in Unknown on line 0

Reply to this email directly or view it on GitHub:
#1

Sorry for the flood. I do compiling module like this:

[root@bc4headnode1 php_ketama]# /opt/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[root@bc4headnode1 php_ketama]# ./configure --with-php-config=/opt/php/bin/php-config
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... powerpc64-unknown-linux-gnu
checking host system type... powerpc64-unknown-linux-gnu
checking target system type... powerpc64-unknown-linux-gnu
checking for PHP prefix... /opt/php
checking for PHP includes... -I/opt/php/include/php -I/opt/php/include/php/main -I/opt/php/include/php/TSRM -I/opt/php/include/php/Zend -I/opt/php/include/php/ext -I/opt/php/include/php/ext/date/lib
checking for PHP extension directory... /opt/php/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /opt/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for ketama support... yes, shared
checking for ketama files in default path... found in /usr
checking for ketama_roll in -lketama... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf32ppclinux) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
[root@bc4headnode1 php_ketama]# make
/bin/sh /home/build-scripts/ketama/trunk/php_ketama/libtool --mode=install cp ./ketama.la /home/build-scripts/ketama/trunk/php_ketama/modules
cp ./.libs/ketama.so /home/build-scripts/ketama/trunk/php_ketama/modules/ketama.so
cp ./.libs/ketama.lai /home/build-scripts/ketama/trunk/php_ketama/modules/ketama.la

PATH="$PATH:/sbin" ldconfig -n /home/build-scripts/ketama/trunk/php_ketama/modules

Libraries have been installed in:
/home/build-scripts/ketama/trunk/php_ketama/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:

  • add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
  • add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
  • use the `-Wl,--rpath -Wl,LIBDIR' linker flag
  • have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

Build complete.
Don't forget to run 'make test'.

[root@bc4headnode1 php_ketama]# make test

Build complete.
Don't forget to run 'make test'.

Warning: PHP Startup: Invalid library (maybe not a PHP library) 'ketama.so' in Unknown on line 0

Warning: PHP Startup: Invalid library (maybe not a PHP library) 'ketama.so' in Unknown on line 0

PHP : /opt/php/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.6
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux bc4headnode1 2.6.18-238.12.1.el5 #1 SMP Sat May 7 20:20:19 EDT 2011 ppc64
INI actual : /home/build-scripts/ketama/trunk/php_ketama/tmp-php.ini
More .INIs :
CWD : /home/build-scripts/ketama/trunk/php_ketama
Extra dirs :
VALGRIND : Not used

Hmm, don't know - sorry.
It's been years since I built the php module - last time was on PHP4,
on x86 - as far as I know, no one ever tried to use it on PPC.

I'm pretty sure the libmemcached extension does consistent hashing,
perhaps that is worth a look?
https://github.com/kajidai/php-libmemcached

Good luck!
RJ

On 18 August 2011 16:09, vaskes
reply@reply.github.com
wrote:

Sorry for the flood. I do compiling module like this:

[root@bc4headnode1 php_ketama]# /opt/php/bin/phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
[root@bc4headnode1 php_ketama]# ./configure --with-php-config=/opt/php/bin/php-config
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... powerpc64-unknown-linux-gnu
checking host system type... powerpc64-unknown-linux-gnu
checking target system type... powerpc64-unknown-linux-gnu
checking for PHP prefix... /opt/php
checking for PHP includes... -I/opt/php/include/php -I/opt/php/include/php/main -I/opt/php/include/php/TSRM -I/opt/php/include/php/Zend -I/opt/php/include/php/ext -I/opt/php/include/php/ext/date/lib
checking for PHP extension directory... /opt/php/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /opt/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for ketama support... yes, shared
checking for ketama files in default path... found in /usr
checking for ketama_roll in -lketama... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf32ppclinux) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
[root@bc4headnode1 php_ketama]# make
/bin/sh /home/build-scripts/ketama/trunk/php_ketama/libtool --mode=install cp ./ketama.la /home/build-scripts/ketama/trunk/php_ketama/modules
cp ./.libs/ketama.so /home/build-scripts/ketama/trunk/php_ketama/modules/ketama.so
cp ./.libs/ketama.lai /home/build-scripts/ketama/trunk/php_ketama/modules/ketama.la

PATH="$PATH:/sbin" ldconfig -n /home/build-scripts/ketama/trunk/php_ketama/modules

Libraries have been installed in:
  /home/build-scripts/ketama/trunk/php_ketama/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the -LLIBDIR' flag during linking and do at least one of the following:   - add LIBDIR to theLD_LIBRARY_PATH' environment variable
    during execution
  - add LIBDIR to the LD_RUN_PATH' environment variable     during linking   - use the-Wl,--rpath -Wl,LIBDIR' linker flag
  - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

Build complete.
Don't forget to run 'make test'.

[root@bc4headnode1 php_ketama]# make test

Build complete.
Don't forget to run 'make test'.

Warning: PHP Startup: Invalid library (maybe not a PHP library) 'ketama.so' in Unknown on line 0

Warning: PHP Startup: Invalid library (maybe not a PHP library) 'ketama.so' in Unknown on line 0

PHP         : /opt/php/bin/php
PHP_SAPI    : cli
PHP_VERSION : 5.3.6
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux bc4headnode1.gamenet.ru 2.6.18-238.12.1.el5 #1 SMP Sat May 7 20:20:19 EDT 2011 ppc64
INI actual  : /home/build-scripts/ketama/trunk/php_ketama/tmp-php.ini
More .INIs  :
CWD         : /home/build-scripts/ketama/trunk/php_ketama
Extra dirs  :
VALGRIND    : Not used

Reply to this email directly or view it on GitHub:
#1 (comment)