Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power

 View Only
  • 1.  ldd: file is not valid in the current object file mode.

    Posted Wed September 02, 2020 06:14 AM
    hi,

    short backround story: i am building our  cfengine package against freeware libs/sources. today i did a ldd against one of
    the binaries and ldd spits out this error no matter with OBJECT_MODE empty or set to 64.

    root@aixbuildhostng: /root # ldd /var/cfengine/bin/cf-serverd
    /var/cfengine/bin/cf-serverd needs:
    /usr/lib/libc.a(shr_64.o)
    /usr/lib/libpthreads.a(shr_xpg5_64.o)
    /var/cfengine/lib/libpromises.a(libpromises.so.3)
    /usr/lib/libssl.a(libssl.so.1.0.2)
    /usr/lib/libcrypto.a(libcrypto.so.1.0.2)
    /opt/freeware/lib/liblmdb.a(liblmdb.so)
    /opt/freeware/lib/libpcre.a(libpcre.so.1)
    /opt/freeware/lib/libcurl.a(libcurl.so.4)
    /opt/freeware/lib/libssh2.a(libssh2.so.1)
    /opt/freeware/lib/libldap.a(libldap-2.4.so.2)
    /opt/freeware/lib/liblber.a(liblber-2.4.so.2)
    /unix
    /usr/lib/libcrypt.a(shr_64.o)
    /opt/freeware/lib/libgcc_s.a(shr.o)
    /opt/freeware/lib/libyaml.a(libyaml-0.so.2)
    /usr/lib/libdl.a(shr_64.o)
    /opt/freeware/lib/libgssapi_krb5.a(libgssapi_krb5.so)
    /opt/freeware/lib/libkrb5.a(libkrb5.so)
    /opt/freeware/lib/libk5crypto.a(libk5crypto.so)
    /opt/freeware/lib/libcom_err.a(libcom_err.so)
    /opt/freeware/lib/libz.a(libz.so.1)
    /opt/freeware/lib/libsasl2.a
    dump: /opt/freeware/lib/libsasl2.a: 0654-108 file is not valid in the current object file mode.
    Use the -X option to specify the desired object mode.
    /usr/lib/libs.a(shr_64.o)
    /opt/freeware/lib/libkrb5.so
    dump: /opt/freeware/lib/libkrb5.so: 0654-108 file is not valid in the current object file mode.
    Use the -X option to specify the desired object mode.
    /opt/freeware/lib/libk5crypto.so
    dump: /opt/freeware/lib/libk5crypto.so: 0654-108 file is not valid in the current object file mode.
    Use the -X option to specify the desired object mode.
    /opt/freeware/lib/libcom_err.so
    dump: /opt/freeware/lib/libcom_err.so: 0654-108 file is not valid in the current object file mode.
    Use the -X option to specify the desired object mode.
    /opt/freeware/lib/libkrb5support.so
    dump: /opt/freeware/lib/libkrb5support.so: 0654-108 file is not valid in the current object file mode.
    Use the -X option to specify the desired object mode.
    /opt/freeware/lib/libintl.a(libintl.so.8)
    /opt/freeware/lib/libiconv.a(libiconv.so.2)

    the binary runs anyway, so no runtime problems or so, but i'm not sure whats the reason behind this. the only thing i changed
    is that i installed the newest openssl fileset (1.0.2.2100) but i see no obvios context. the cfengine build is 64bit only, so maybe this is the troublemaker?

    the build line from the cfengine spec nothing special anyway:

    %build
    export CONFIG_SHELL=/usr/bin/ksh
    export CONFIG_ENV_ARGS=/usr/bin/ksh

    export OBJECT_MODE=64
    export AR="/usr/bin/ar -X64"
    export RANLIB="/usr/bin/ranlib -X64"
    export NM="/usr/bin/nm -X64"
    export CC="gcc -maix64"
    export CXX="g++ -maix64"
    export CFLAGS="-DSYSV -D_AIX -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include"
    export CXXFLAGS=$CFLAGS
    export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"

    ./configure \
    --prefix=/var/cfengine \
    --sbindir=/var/cfengine/bin \
    --localstatedir=/var/cfengine \
    --with-workdir=/var/cfengine \
    --without-postgresql \
    --without-mysql \
    --with-lmdb \
    --with-openssl \
    --with-pcre \
    --with-libcurl \
    --with-libyaml \
    --with-libxml2

    gmake %{?_smp_mflags}

    header from binary:

    root@aixbuildhostng: /root # dump -X 64 -H /var/cfengine/bin/cf-serverd

    /var/cfengine/bin/cf-serverd:

    ***Loader Section***
    Loader Header Information
    VERSION# #SYMtableENT #RELOCent LENidSTR
    0x00000001 0x0000014d 0x00000201 0x0000018c

    #IMPfilID OFFidSTR LENstrTBL OFFstrTBL
    0x0000000c 0x00003f80 0x000016a5 0x0000410c


    ***Import File Strings***
    INDEX PATH BASE MEMBER
    0 /var/cfengine/lib:/opt/freeware/lib:/opt/freeware/lib64:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
    1 libc.a shr_64.o
    2 libpthreads.a shr_xpg5_64.o
    3 libpromises.a libpromises.so.3
    4 libssl.a libssl.so.1.0.2
    5 libcrypto.a libcrypto.so.1.0.2
    6 liblmdb.a liblmdb.so
    7 libpcre.a libpcre.so.1
    8 libcurl.a libcurl.so.4
    9 libssh2.a libssh2.so.1
    10 libldap.a libldap-2.4.so.2
    11 liblber.a liblber-2.4.so.2



    any hint?

    wbr

    chris

    ------------------------------
    I regret starting this entire conversation
    ------------------------------

    #AIXOpenSource


  • 2.  RE: ldd: file is not valid in the current object file mode.

    Posted Wed September 02, 2020 10:11 AM
    Edited by C- -T Wed September 02, 2020 10:14 AM
    i played around with LIBPATH and the following setting makes the ldd gibberish disapear...

    root@nimmsag: /opt/freeware/lib64 # echo $LIBPATH
    /var/cfengine/lib:/opt/freeware/lib64:/usr/lib:/lib

    root@nimmsag: /opt/freeware/lib64 # ldd /var/cfengine/bin/cf-serverd
    /var/cfengine/bin/cf-serverd needs:
    /usr/lib/libc.a(shr_64.o)
    /usr/lib/libpthreads.a(shr_xpg5_64.o)
    /var/cfengine/lib/libpromises.a(libpromises.so.3)
    /usr/lib/libssl.a(libssl.so.1.0.2)
    /usr/lib/libcrypto.a(libcrypto.so.1.0.2)
    /opt/freeware/lib64/liblmdb.a(liblmdb.so)
    /usr/lib/libpcre.a(libpcre.so.1)
    /opt/freeware/lib64/libcurl.a(libcurl.so.4)
    /opt/freeware/lib64/libssh2.a(libssh2.so.1)
    /opt/freeware/lib64/libldap.a(libldap-2.4.so.2)
    /opt/freeware/lib64/liblber.a(liblber-2.4.so.2)
    /unix
    /usr/lib/libcrypt.a(shr_64.o)
    /opt/freeware/lib64/libgcc_s.a(shr.o)
    /usr/lib/libyaml.a(libyaml-0.so.2)
    /usr/lib/libdl.a(shr_64.o)
    /opt/freeware/lib64/libgssapi_krb5.a(libgssapi_krb5.so)
    /opt/freeware/lib64/libkrb5.a(libkrb5.so)
    /opt/freeware/lib64/libk5crypto.a(libk5crypto.so)
    /opt/freeware/lib64/libcom_err.a(libcom_err.so)
    /usr/lib/libz.a(libz.so.1)
    /opt/freeware/lib64/libsasl2.a
    /usr/lib/libs.a(shr_64.o)
    /opt/freeware/lib64/libkrb5.so
    /opt/freeware/lib64/libk5crypto.so
    /opt/freeware/lib64/libcom_err.so
    /opt/freeware/lib64/libkrb5support.so
    /opt/freeware/lib64/libintl.a(libintl.so.8)
    /opt/freeware/lib/libiconv.a(libiconv.so.2)

    one thing that leaps to the eyes is, libiconv.a is not in the /opt/freeware/lib64 path. is this intended? whats the strategy here (all libs separated by bitness or not)?

    ------------------------------
    I regret starting this entire conversation
    ------------------------------



  • 3.  RE: ldd: file is not valid in the current object file mode.

    Posted Wed September 02, 2020 12:57 PM
    Some packages like libiconv.a have library shipped only in /opt/freeware/lib and not in lib64. The two main strategy behind having lib64 is to have to proper build system (pkgconfig config file ".pc" differs in some cases )and the presence of libraries in .so format instead of having it inside archives (.a). 
    Packages which don't have these pieces don't really require the 64 bit libraries put it into /opt/freeware/lib64. 
    That being said , the proper  library search for 64bit binaries/libraries will be "/opt/freeware/lib64:/opt/freeware/lib:/usr/lib"  and for 32bit , it is "/opt/freeware/lib:/usr/lib" . AIX Toolbox packages are built with this library search path.

    ------------------------------
    Ayappan P
    ------------------------------