finding libraries at compile - strange problems - SUN

This is a discussion on finding libraries at compile - strange problems - SUN ; I have come across this problem a number of times when compiling software, the package doesnt matter as this has happened with php mysql and a few others. I set my LDFLAGS, CFLAGS etc to include libraries and include files ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: finding libraries at compile - strange problems

  1. finding libraries at compile - strange problems

    I have come across this problem a number of times when compiling
    software, the package doesnt matter as this has happened with php mysql
    and a few others.

    I set my LDFLAGS, CFLAGS etc to include libraries and include files
    that are in odd spots.
    i build and compile the software but some of the libaries are found
    some are not even though they may reside in the same directory.

    below is an example first my settings showing the build enviroment
    the an ldd of the binary in this case it finds libgcc in /usr/local/lib
    once but not the other time as well as other libs that are required
    that live in /usr/local/lib but not libstdc++.so.5 even though that
    lives in /usr/local/lib. I set LD_LIBRARY_PATH to /usr/local/lib and
    all of the libraries are found.

    now I refuse to cheat and use LD_LIBRARY_PATH to get something built. I
    would rather have everything nice and neat.

    for the record this box was a Sol 9 on an X1 but i have seen this on
    Sol 10. (this is the reason that I am not running Sol 10 as this just
    kept happening with no solution)

    thanks for any help.


    # env
    _=/usr/bin/env
    SSH_TTY=/dev/pts/1
    PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/ucb
    LOGNAME=barryh
    PS1=#
    USER=barryh
    LDFLAGS=-L/usr/local/lib
    CFLAGS=-L/usr/local/lib
    CC=gcc
    SHELL=/usr/bin/ksh
    CPPFLAGS=-I/usr/local/include
    HOME=/home/barryh
    SSH_CLIENT=192.168.0.254 50611 22
    TERM=xterm
    CFLAGS=-R/usr/local/lib -O -g
    PWD=/home/barryh/mysql-4.0.20
    TZ=Australia/NSW
    # rm -r /usr/local/mysql
    # ldd /usr/local/mysql/bin/mysql
    libcurses.so.1 => /usr/lib/libcurses.so.1
    libmysqlclient.so.12 =>
    /usr/local/mysql/lib/mysql/libmysqlclient.so.12
    libz.so => /usr/lib/libz.so
    librt.so.1 => /usr/lib/librt.so.1
    libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
    libgen.so.1 => /usr/lib/libgen.so.1
    libsocket.so.1 => /usr/lib/libsocket.so.1
    libnsl.so.1 => /usr/lib/libnsl.so.1
    libstdc++.so.5 => (file not found)
    libm.so.1 => /usr/lib/libm.so.1
    libgcc_s.so.1 => (file not found)
    libc.so.1 => /usr/lib/libc.so.1
    libz.so => /usr/local/lib/libz.so
    libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
    libaio.so.1 => /usr/lib/libaio.so.1
    libmd5.so.1 => /usr/lib/libmd5.so.1
    libdl.so.1 => /usr/lib/libdl.so.1
    libmp.so.2 => /usr/lib/libmp.so.2
    /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
    /usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1
    #
    # export LD_LIBRARY_PATH=/usr/local/lib
    # ldd /usr/local/mysql/bin/mysql
    libcurses.so.1 => /usr/lib/libcurses.so.1
    libmysqlclient.so.12 =>
    /usr/local/mysql/lib/mysql/libmysqlclient.so.12
    libz.so => /usr/local/lib/libz.so
    librt.so.1 => /usr/lib/librt.so.1
    libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
    libgen.so.1 => /usr/lib/libgen.so.1
    libsocket.so.1 => /usr/lib/libsocket.so.1
    libnsl.so.1 => /usr/lib/libnsl.so.1
    libstdc++.so.5 => /usr/local/lib/libstdc++.so.5
    libm.so.1 => /usr/lib/libm.so.1
    libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
    libc.so.1 => /usr/lib/libc.so.1
    libaio.so.1 => /usr/lib/libaio.so.1
    libmd5.so.1 => /usr/lib/libmd5.so.1
    libdl.so.1 => /usr/lib/libdl.so.1
    libmp.so.2 => /usr/lib/libmp.so.2
    /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
    /usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1


  2. Re: finding libraries at compile - strange problems

    satori692002@yahoo.com.au wrote:
    > I have come across this problem a number of times when compiling
    > software, the package doesnt matter as this has happened with php mysql
    > and a few others.
    >
    > I set my LDFLAGS, CFLAGS etc to include libraries and include files
    > that are in odd spots.
    > i build and compile the software but some of the libaries are found
    > some are not even though they may reside in the same directory.
    >
    > below is an example first my settings showing the build enviroment
    > the an ldd of the binary in this case it finds libgcc in /usr/local/lib
    > once but not the other time as well as other libs that are required
    > that live in /usr/local/lib but not libstdc++.so.5 even though that
    > lives in /usr/local/lib. I set LD_LIBRARY_PATH to /usr/local/lib and
    > all of the libraries are found.
    >
    > now I refuse to cheat and use LD_LIBRARY_PATH to get something built. I
    > would rather have everything nice and neat.
    >
    > for the record this box was a Sol 9 on an X1 but i have seen this on
    > Sol 10. (this is the reason that I am not running Sol 10 as this just
    > kept happening with no solution)
    >
    > thanks for any help.
    >
    >
    > # env
    > _=/usr/bin/env
    > SSH_TTY=/dev/pts/1
    > PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/ucb
    > LOGNAME=barryh
    > PS1=#
    > USER=barryh
    > LDFLAGS=-L/usr/local/lib
    > CFLAGS=-L/usr/local/lib
    > CC=gcc
    > SHELL=/usr/bin/ksh
    > CPPFLAGS=-I/usr/local/include
    > HOME=/home/barryh
    > SSH_CLIENT=192.168.0.254 50611 22
    > TERM=xterm
    > CFLAGS=-R/usr/local/lib -O -g
    > PWD=/home/barryh/mysql-4.0.20
    > TZ=Australia/NSW
    > # rm -r /usr/local/mysql
    > # ldd /usr/local/mysql/bin/mysql
    > libcurses.so.1 => /usr/lib/libcurses.so.1
    > libmysqlclient.so.12 =>
    > /usr/local/mysql/lib/mysql/libmysqlclient.so.12
    > libz.so => /usr/lib/libz.so
    > librt.so.1 => /usr/lib/librt.so.1
    > libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
    > libgen.so.1 => /usr/lib/libgen.so.1
    > libsocket.so.1 => /usr/lib/libsocket.so.1
    > libnsl.so.1 => /usr/lib/libnsl.so.1
    > libstdc++.so.5 => (file not found)
    > libm.so.1 => /usr/lib/libm.so.1
    > libgcc_s.so.1 => (file not found)
    > libc.so.1 => /usr/lib/libc.so.1
    > libz.so => /usr/local/lib/libz.so
    > libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
    > libaio.so.1 => /usr/lib/libaio.so.1
    > libmd5.so.1 => /usr/lib/libmd5.so.1
    > libdl.so.1 => /usr/lib/libdl.so.1
    > libmp.so.2 => /usr/lib/libmp.so.2
    > /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
    > /usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1
    > #
    > # export LD_LIBRARY_PATH=/usr/local/lib
    > # ldd /usr/local/mysql/bin/mysql
    > libcurses.so.1 => /usr/lib/libcurses.so.1
    > libmysqlclient.so.12 =>
    > /usr/local/mysql/lib/mysql/libmysqlclient.so.12
    > libz.so => /usr/local/lib/libz.so
    > librt.so.1 => /usr/lib/librt.so.1
    > libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
    > libgen.so.1 => /usr/lib/libgen.so.1
    > libsocket.so.1 => /usr/lib/libsocket.so.1
    > libnsl.so.1 => /usr/lib/libnsl.so.1
    > libstdc++.so.5 => /usr/local/lib/libstdc++.so.5
    > libm.so.1 => /usr/lib/libm.so.1
    > libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
    > libc.so.1 => /usr/lib/libc.so.1
    > libaio.so.1 => /usr/lib/libaio.so.1
    > libmd5.so.1 => /usr/lib/libmd5.so.1
    > libdl.so.1 => /usr/lib/libdl.so.1
    > libmp.so.2 => /usr/lib/libmp.so.2
    > /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
    > /usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1
    >


    your CFLAGS is probably wrong. It appears two times (i.e. its first
    value is overwritten) and gcc requires -Xlinker or -Wl, before -R.
    Ie.:
    CFLAGS=-Xlinker -R/usr/local/lib -O -g

    HTH,
    Tom

  3. Re: finding libraries at compile - strange problems


    satori692002@yahoo.com.au wrote:

    > I set my LDFLAGS, CFLAGS etc to include libraries and include files
    > that are in odd spots.


    odd spots??

    > i build and compile the software but some of the libaries are found
    > some are not even though they may reside in the same directory.
    >
    > below is an example first my settings showing the build enviroment
    > the an ldd of the binary in this case it finds libgcc in /usr/local/lib
    > once but not the other time as well as other libs that are required
    > that live in /usr/local/lib but not libstdc++.so.5 even though that
    > lives in /usr/local/lib. I set LD_LIBRARY_PATH to /usr/local/lib and
    > all of the libraries are found.


    libstdc++.so.5 problems usually stem from usage of sunfreeware
    "packages"
    of gcc and failing to read the installation hints at the site which
    sometimes have
    important info..
    You may have better luck with Blastwave packages of gcc.

    > now I refuse to cheat and use LD_LIBRARY_PATH to get something built. I
    > would rather have everything nice and neat.


    Good. Now read the man pages on ld.so.1 and ld paying some attention to
    LD_RUN_PATH.
    A -R flag has no place in CFLAGS by the way, its for LDFLAGS.
    If you dont know this then its no wonder you are having strange
    problems : >

    Also, with "configure" its often necessary to use both -L and -R
    as well as "env" with LD_RUN_PATH set.

    > for the record this box was a Sol 9 on an X1 but i have seen this on
    > Sol 10. (this is the reason that I am not running Sol 10 as this just
    > kept happening with no solution)


    Thats not a good enough excuse to stay at 9..

    > # env
    > LDFLAGS=-L/usr/local/lib
    > CFLAGS=-L/usr/local/lib
    > CFLAGS=-R/usr/local/lib -O -g


    How you manage to get 2 entries from one env I dont know but
    if you need to set something with space characters you should use
    double quotes. CFLAGS="-O -g"
    In any case you dont need to export either of these as there is no
    assurance
    that 'configure' will use exported vars. If you say
    env LD_RUN_PATH="whatever" CFLAGS="-O -g" \
    LDFLAGS="-L something -R something.. -L -R etc" ./configure
    that will almost always do the right thing if gcc is installed
    correctly.
    Or Studio 11 for that matter.


+ Reply to Thread