install PHP...relocation R_X86_64_32... recompile with -fPIC...

Discussion in 'Installation/Configuration' started by vktechnology, May 13, 2006.

  1. vktechnology

    vktechnology New Member

    Install PHP,,has eror after type make

    Reproduce code:
    ./configure --prefix=/usr/local/php-5.1.4
    --with-apxs2=/usr/local/apache2/bin/apxs --enable-ftp


    1.2.8-config --with-zlib-dir=/usr/local/zlib-1.2.2 --with-gd
    --disable-libxml --disable-dom --

    disable-simplexml --disable-xml --disable-pear --disable-xmlreader

    Actual result:
    after type make

    have this error

    /usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32
    against `a local symbol' can not be used when making a shared object;
    recompile with -fPIC
    /usr/local/lib/libz.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: *** [] Error 1
  2. falko

    falko Super Moderator ISPConfig Developer

    Seems to be a problem with zlib. Maybe you should try to install the newest zlib (1.2.3) by hand and try again.
  3. vktechnology

    vktechnology New Member

    Zlib is ok no problem...

    [root@palungjit zlib-1.2.3]# ./configure
    Checking for gcc...
    Building static library libz.a version 1.2.3 with gcc.
    Checking for unistd.h... Yes.
    Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
    Checking for vsnprintf() in stdio.h... Yes.
    Checking for return value of vsnprintf()... Yes.
    Checking for errno.h... Yes.
    Checking for mmap support... Yes.
    [root@palungjit zlib-1.2.3]# make
    gcc -O3 -DUSE_MMAP -c -o example.o example.c
    gcc -O3 -DUSE_MMAP -c -o adler32.o adler32.c
    gcc -O3 -DUSE_MMAP -c -o compress.o compress.c
    gcc -O3 -DUSE_MMAP -c -o crc32.o crc32.c
    gcc -O3 -DUSE_MMAP -c -o gzio.o gzio.c
    gcc -O3 -DUSE_MMAP -c -o uncompr.o uncompr.c
    gcc -O3 -DUSE_MMAP -c -o deflate.o deflate.c
    gcc -O3 -DUSE_MMAP -c -o trees.o trees.c
    gcc -O3 -DUSE_MMAP -c -o zutil.o zutil.c
    gcc -O3 -DUSE_MMAP -c -o inflate.o inflate.c
    gcc -O3 -DUSE_MMAP -c -o infback.o infback.c
    gcc -O3 -DUSE_MMAP -c -o inftrees.o inftrees.c
    gcc -O3 -DUSE_MMAP -c -o inffast.o inffast.c
    ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
    gcc -O3 -DUSE_MMAP -o example example.o -L. libz.a
    gcc -O3 -DUSE_MMAP -c -o minigzip.o minigzip.c
    gcc -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.a
    [root@palungjit zlib-1.2.3]# make install
    cp zlib.h zconf.h /usr/local/include
    chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
    cp libz.a /usr/local/lib
    cd /usr/local/lib; chmod 755 libz.a
    cd /usr/local/lib; if test -f; then \
    rm -f; \
    ln -s; \
    ln -s; \
    (ldconfig || true) >/dev/null 2>&1; \
    cp zlib.3 /usr/local/share/man/man3
    chmod 644 /usr/local/share/man/man3/zlib.3
  4. vktechnology

    vktechnology New Member

    I use Fedora & Linux,
    Intel 64 bit, 3.2 Ghz x 2
    4GB Ram.

    it is something with X64_X86...
    but donlt know how to fix..
  5. vktechnology

    vktechnology New Member

    falko you are right...
    thank you

    it is something with configure in Zlib


    This problem is solved

    this is not PHP problem
    it something to do with Zlib

    I add this in to Make file in Zlib

    and save it

    and configure Zlib again
    by use this command

    ./configure --libdir=/usr/lib64

    it work now
  6. vktechnology

    vktechnology New Member

    Because in PHP Makefile doesn't complatible with 64 Bits processor

    64 Bits processor use "/usr/lib64"
    instead of "/usr/local/lib"

    I found solution to fix this peoblem
    now my problem is solved

    What i did is

    after configure and open Makefile to edit Makefile

    look example my configure
    ./configure --libdir=/usr/lib64 --prefix=/usr/local/php-5.1.4 --with-apxs2=/usr/local/apache2/bin/apxs --enable-ftp --with-mysql-dir=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2-2.6.24 --with-png-dir=/usr/local/libpng-1.2.8-config --with-zlib-dir=/usr/local/zlib-1.2.3/ --with-gd --with-jpeg-dir=/usr/local/lib64/ --with-freetype-dir=/usr/local/freetype-2.2.1

    open Makefile
    find for
    and replace with "/usr/lib64"

    here this is code after replace
    4 lines

    EXTRA_LDFLAGS = -avoid-version -module -L/usr/lib64 -L/usr/local/zlib-1.2.3//lib
    EXTRA_LDFLAGS_PROGRAM = -L/usr/lib64 -L/usr/local/zlib-1.2.3//lib
    NATIVE_RPATHS = -Wl,-rpath,/usr/lib64 -Wl,-rpath,/usr/local/zlib-1.2.3//lib
    PHP_LDFLAGS = -L/usr/lib64 -L/usr/local/zlib-1.2.3//lib
    PHP_RPATHS = -R /usr/lib64 -R /usr/local/zlib-1.2.3//lib

    type make
    make install
  7. vktechnology

    vktechnology New Member


    instead of
    cannot fix,
    after install will cannot connect to my sql by using PHP
    you will see this error

    "Fatal error: Call to undefined function mysql_connect() "

    and looking in info.php
    cannot see mysql too...

Share This Page