Informix

 View Only
Expand all | Collapse all

Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

  • 1.  Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    Posted Fri January 19, 2024 05:01 AM
    Edited by Sebastien FLAESCH Fri January 19, 2024 05:20 AM

    Hello,

    We have a Linux RedHat 9.2 ARM (aarch64) with CSDK 4.50.FC6 installed:

    [f4gl@pisano lib]$ cat /etc/redhat-release 
    Red Hat Enterprise Linux release 9.2 (Plow)

    [f4gl@pisano lib]$ uname -a
    Linux pisano.strasbourg.4js.com 5.14.0-284.30.1.el9_2.aarch64 #1 SMP PREEMPT_DYNAMIC Fri Aug 25 10:57:12 EDT 2023 aarch64 aarch64 aarch64 GNU/Linux

    [f4gl@pisano lib]$ esql -V
    IBM Informix CSDK Version 4.50, IBM Informix-ESQL Version 4.50.FC6

    It appears that the Informix client libs have a dependency to libcrypt.so.1:

    [f4gl@pisano CSDK-4.50.FC6]$ ldd lib/cli/libifcli.so | grep libcrypt.so
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffffa56a3000)

    However, on this system, we can see that there are 2 versions of libcrypt.so.? :

    [f4gl@pisano lib]$ ls -l /usr/lib64/libcrypt.so*
    lrwxrwxrwx. 1 root root     17 Aug 10  2021 /usr/lib64/libcrypt.so -> libcrypt.so.2.0.0
    lrwxrwxrwx. 1 root root     17 Aug 10  2021 /usr/lib64/libcrypt.so.1 -> libcrypt.so.1.1.0
    -rwxr-xr-x. 1 root root 201816 Aug 10  2021 /usr/lib64/libcrypt.so.1.1.0
    lrwxrwxrwx. 1 root root     17 Aug 10  2021 /usr/lib64/libcrypt.so.2 -> libcrypt.so.2.0.0
    -rwxr-xr-x. 1 root root 201632 Aug 10  2021 /usr/lib64/libcrypt.so.2.0.0

    And as you can see, /usr/lib64/libcrypt.so is a symbolic link to libcrypt.so.2.

    The esql tool uses the following libs to link the binary:

    [f4gl@pisano lib]$ esql -libs
    -lifsql
    -lifasf
    -lifgen
    -lifos
    -lifgls
    -lpthread
    -lm
    -lz
    -ldl
    -lcrypt
    /dbs/64bits/ifx/CSDK-4.50.FC6/lib/esql/checkapi.o
    -lifglx

    Consequently, when building a binary with esql, we'll get a dependency to libcrypt.so.2 ...

    [f4gl@pisano tmp]$ esql -o xx.bin xx.ec
    [f4gl@pisano tmp]$ ldd xx.bin
        ...
        libcrypt.so.2 => /lib64/libcrypt.so.2 (0x0000ffff8ca4b000)
        ...

    Questions:

    1. Is it a problem to have the Informix libs loading libcrypt.so.1, and the binary load libcrypt.so.2 ?
    2. Is there a way (and good idea?) to force to link our binary with libcrypt.so.1 to be sync with Informix libs?
    3. Will there be a CSDK build with Informix libs dependent to libcrypt.so.2, assuming that's the recommended way to use a more recent libcrypt version?
    4. Assuming one can mix libcrypt.so.1 / libcrypt.so.2 at runtime (I have doubts!): What is the recommendation, when building a binary on this platform, and install the resulting binary on an equivalent Linux, that does not have libcrypt.so.2? It appears that some Linux distributions such as Ubuntu 22.04 do not provide a package for libcrypt.so.2 ...

    Tx



    ------------------------------
    Sebastien FLAESCH
    ------------------------------



  • 2.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    IBM Champion
    Posted Sun January 21, 2024 09:35 AM

    Hi,

    Client SDK 4.50.FC6 (and the latest 4.50.FC10W1) are built on RHEL 7.

    Even the latest CentOS 7.9 only has libcrypt.so.1.

    I doubt Client SDK is supported on RHEL 9 yet.,

    Is it a problem to have the Informix libs loading libcrypt.so.1, and the binary load libcrypt.so.2 ?
      I would not rely on it working

    Is there a way (and good idea?) to force to link our binary with libcrypt.so.1 to be sync with Informix libs?
     esql is a shell script so rename to esql.orig and make your own version that excplictly links with the .so.1 version.

    Will there be a CSDK build with Informix libs dependent to libcrypt.so.2, assuming that's the recommended way to use a more recent libcrypt version?
     Probably not soon because it would not work on RHEL 7 and clones

    Assuming one can mix libcrypt.so.1 / libcrypt.so.2 at runtime (I have doubts!): What is the recommendation, when building a binary on this platform, 
    and install the resulting binary on an equivalent Linux, that does not have libcrypt.so.2? It appears that some Linux distributions such as Ubuntu 22.04 do not provide a package for libcrypt.so.2 ...
      Then it will not work and a seperate version would need to be relinked with libcrypt.so.1 (preferred, this means 2 binaries to suppport hence my asnwer above
      Alternatively libcrypt.so.2 could be added a link to libcrypt.so.1 - cheating and could break and also could cause problems when upgrading the OS.

    Regards,
    David.



    ------------------------------
    David Williams
    ------------------------------



  • 3.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    IBM Champion
    Posted Sun January 21, 2024 10:20 AM

    That's not the only problem with the CSDK, David. All of the libraries were compiled with GCC v4.8.5":

    From the release notes:


    1. 1. This product was built on Red Hat Enterprise Linux ES release 7.4
        (Kernel:  3.10.0-693, Glibc: 2.17) for x86_64 compatible processors.
        The following compilers were used:

             gcc and g++ compiler 4.8.5 20150623 (Red Hat 4.8.5-16)

        Installing the product on Ubuntu or Debian requires RPM to be installed
        and initialized. After RPM installed, use the following commands to  
        initialize RPM:

      The current GCC release is at least v13.2.0 and maybe later. This makes if difficult at best to link any static applications and sometimes it does not work at all.

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 4.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    Posted Tue January 23, 2024 04:30 AM

    Some other vendors get around this problem by offering releases of their product compiled on each of the operating systems and versions they support. Perhaps on the client side this is of greater value than on the server side.

    I haven't seen an RFE about this issue. It doesn't affect me so I am not going to raise one but others might wish to.

    Ben.



    ------------------------------
    Benjamin Thompson
    ------------------------------



  • 5.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    Posted Wed January 24, 2024 11:37 AM

    Thanks for your answers!

    I would definitively not suggest our customers to create a symbolic link libcrypt.so.2 -> libcrypt.so.1

    My conclusion so far, is that we will not be able to support Linux distributions that have libcrypt.so.2 (+ other deps like GLIBC version compatibility)

    I fully agree with Ben, but we should not have to raise a RFE for this: It's the job of IBM/HCL, to provide CDSK packages on any recent Linux distribution, with dependencies to libs like libcrypto.so.?, and GLIBC version. I guess it's not a big deal to setup a Linux platform and port the Informix CSDK (compared to porting the server).

    Seb



    ------------------------------
    Sebastien FLAESCH
    ------------------------------



  • 6.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    IBM Champion
    Posted Wed January 24, 2024 11:44 AM
    Have you tried installing the libcrypt compatibility layer ?  That has libcrypt.so.1 as a separate library

    On 1/24/2024 10:37 AM, Sebastien FLAESCH via IBM TechXchange Community wrote:
    0100018d3c550289-a7d5a972-f8af-4cf3-8fdd-b42323ae9816-000000@email.amazonses.com">
    Thanks for your answers! I would definitively not suggest our customers to create a symbolic link libcrypt.so.2 -> libcrypt.so.1 My conclusion...





  • 7.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    Posted Wed January 24, 2024 12:36 PM

    Paul,

    I will check this but the Linux system we use has already both libcrypt.so.1 and libcrypt.so.2:

    [comp@eiffel ~]$ ls -l /usr/lib64/libcrypt.*
    lrwxrwxrwx. 1 root root     17 Aug 10  2021 /usr/lib64/libcrypt.so -> libcrypt.so.2.0.0
    lrwxrwxrwx. 1 root root     17 Aug 10  2021 /usr/lib64/libcrypt.so.1 -> libcrypt.so.1.1.0
    -rwxr-xr-x. 1 root root 201816 Aug 10  2021 /usr/lib64/libcrypt.so.1.1.0
    lrwxrwxrwx. 1 root root     17 Aug 10  2021 /usr/lib64/libcrypt.so.2 -> libcrypt.so.2.0.0
    -rwxr-xr-x. 1 root root 201632 Aug 10  2021 /usr/lib64/libcrypt.so.2.0.0

    On the production system, we do not want to have mixed Informix CSDK client libs loading libcrypt.so.1 with a binary that was build on a Linux where libcrypt.so (without version) points to libcrypt.so.2, and consequently has a dep to libcrypt.so.2 when esql links with the -lcrypt option...

    We want to build our binary with dep to libcrypt.so.1, or get an Informix CSDK build with a dep to libcrypt.so.2

    So far, I have patched the esql script to force the .1 lib dependency (we do not use the -thread option / SYSTHRLIB):

    #SYSLIB="-lm -lz -ldl -lcrypt"
    SYSLIB="-lm -lz -ldl /usr/lib64/libcrypt.so.1"

    I don't think there is an esql option to replace the default SYSLIB list.

    Seb



    ------------------------------
    Sebastien FLAESCH
    ------------------------------



  • 8.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    IBM Champion
    Posted Thu January 25, 2024 06:17 AM

    Just out of curiosity, what would be the outcome on your system (both lib versions present) when linking statically?

    $ esql -static -o xx.bin xx.ec
    $ ldd xx.bin



    ------------------------------
    Andreas Legner
    ------------------------------



  • 9.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    Posted Thu January 25, 2024 06:28 AM

    Hi Andreas,

    Here is the result of a static link on our port platform:

    [comp@eiffel tmp]$ esql -static -o xx.bin xx.ec


    [comp@eiffel tmp]$ ldd -r ./xx.bin 
        linux-vdso.so.1 (0x0000ffffa8e3d000)
        libm.so.6 => /lib64/libm.so.6 (0x0000ffffa8d5f000)
        libz.so.1 => /lib64/libz.so.1 (0x0000ffffa8d2e000)
        libcrypt.so.2 => /lib64/libcrypt.so.2 (0x0000ffffa8ce5000)
        libc.so.6 => /lib64/libc.so.6 (0x0000ffffa8b37000)
        /lib/ld-linux-aarch64.so.1 (0x0000ffffa8e00000)

    Obviously this is not what we want to do, since we want customers to install our binary, plus the latest compatible Informix CSDK with all potential bug fixes.

    Seb



    ------------------------------
    Sebastien FLAESCH
    ------------------------------



  • 10.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    IBM Champion
    Posted Thu January 25, 2024 06:59 AM

    Fully understood and accepted - I only was curious if the conflict (or coexistence) would occur within a single binary.

    So, when executing the non-statically linked application, what would pmap show for the process, wrt. libcrypt and version(s)?



    ------------------------------
    Andreas Legner
    ------------------------------



  • 11.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    Posted Thu January 25, 2024 07:46 AM

    Andreas,

    Not sure to get why you want me to test with pmap.

    I think ldd -r is sufficient to see the deps of Informix client libs vs deps of a binary build with esql:

    [comp@eiffel tmp]$ ldd -r /dbs/64bits/ifx/CSDK-4.50.FC6/lib/*/*.so | grep libcrypt
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffff88cf5000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffffa4796000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffff9a6e5000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffffb3e54000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffffb9bfe000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffffabfb7000)
     

    Using the original esql script, having SYSLIB="-lm -lz -ldl -lcrypt":

    [comp@eiffel tmp]$ esql -o xx.bin xx.ec
    [comp@eiffel tmp]$ ldd -r ./xx.bin
    ...
      libcrypt.so.2 => /lib64/libcrypt.so.2 (0x0000ffffaec49000)
    ...

    Using the patched esql script, having SYSLIB="-lm -lz -ldl /usr/lib64/libcrypt.so.1":

    [comp@eiffel tmp]$ ldd -r ./xx.bin
    ...
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000ffff9764c000)

    Which is to me, the recommended dependency until IBM/HCL provides a CSDK that depends on libcrypt.so.2 ...

    Seb



    ------------------------------
    Sebastien FLAESCH
    ------------------------------



  • 12.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    IBM Champion
    Posted Thu January 25, 2024 07:53 AM
    Edited by Andreas Legner Thu January 25, 2024 07:59 AM

    Also, on our systems (SLES 12.3) we happen to have:

    # ll libcrypt*
    -rwxr-xr-x 1 root root   57744 Jun  6  2017 libcrypt-2.22.so
    -r-xr-xr-x 1 root root 2447744 Feb  6  2017 libcrypto.so.1.0.0
    lrwxrwxrwx 1 root root      16 Jan 25 13:39 libcrypt.so.1 -> libcrypt-2.22.so

    So both - seemingly - v1 + v2, but actually v2 only, and no libcrypt.so as such.

    And an esql/c binary would have this in ldd:

            libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f10abe62000)

    So how does -lcrypt decide this?  Why did it go for v2 in your case? Would the compiler version play into this?

    And I'd assume the -lcypt simply is passed to the linker and Informix / esql won't have any say in what is going to happen with it.



    ------------------------------
    Andreas Legner
    ------------------------------



  • 13.  RE: Informix CSDL 4.50 on Linux ARM dependency to libcrypt.so.1 + building with esql => libcrypt.so.2

    Posted Thu January 25, 2024 08:51 AM
    Edited by Sebastien FLAESCH Thu January 25, 2024 09:22 AM

    Andreas,

    Yes, esql uses the -lcrypt linker option with gcc, which instructs the gcc compiler / ld linker to find the libcrypt.so.? shared lib the be referenced.

    I suggest that you read about gcc, ld, and .so versioning on Linux

    From my understanding:

    You can can multiple versions of a shared lib on a production system (libcrypt.so.1 and libcrypt.so.2). These files usually are symbolic links to the "real" lib, with additional (minor) version numbers, that can change when updating the packages. For ex, on our RHE 9.2, we have in /usr/lib64: libcrypt.so.1 -> libcrypt.so.1.1.0 and libcrypt.so.2 -> libcrypt.so.2.0.0

    The first number in .so.1 or .so.2 is a major version identifying ABI compatibility (any binary linked with libcrypt.so.1 can work with any libcrypt.so.1.*)

    On your SLES 12.3 system it's confusing to me, because libcrypt.so.1 -> libcrypt-2.22.so (note that "-2" (minus 2) is part of the filename!) - you better make sure it's done intentionally by SUSE.

    On Linux, you typically have 2 kind of packages: The runtime package, installing shared libs with version numbers; and the development package, installing also .h header files and a generic filename without version numbers that points to the latest shared lib.

    On our RHE 9.2: libcrypt.so -> libcrypt.so.2.0.0

    [comp@eiffel ~]$ rpm -qf /usr/lib64/libcrypt.so
    libxcrypt-devel-4.4.18-3.el9.aarch64

    [comp@eiffel ~]$ rpm -qf /usr/lib64/libcrypt.so.1
    libxcrypt-compat-4.4.18-3.el9.aarch64

    [comp@eiffel ~]$ rpm -qf /usr/lib64/libcrypt.so.2
    libxcrypt-4.4.18-3.el9.aarch64

    To compile/link a binary, you need the development package. When passing -lcrypt option to gcc/ld, the linker resolves to the share lib name pointed by libcrypt.so, limiting to the major version number. As result, depending on the OS where the binary is built, you get a dep to libcrypt.so.1 or libcrypt.so.2 ... and consequently, since esql also links binaries, there can be a difference between the libcrypt.so.? dependency of the provided Informix CSDK libs and the binary build by CSDK users, on their own platform.

    I think that for now, we have to patch the esql script to get binaries dependent to libcrypt.so.1, like the libs of Informix CSDK that IBM/HCL provides, because you probably have libcrypt.so -> libcrypt.so.1 (or just libcrypt.so.1 -> whatever) on the machine where the CSDK libs are compiled/linked.

    Once IBM/HCL provides a new CSDK with libs dependent to libcrypt.so.2, we can use esql on our system, without patching it.

    Seb



    ------------------------------
    Sebastien FLAESCH
    ------------------------------