AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
Expand all | Collapse all

Compiling of FreeTDS from source on AIX 7.3

  • 1.  Compiling of FreeTDS from source on AIX 7.3

    Posted Mon June 26, 2023 08:27 AM

    One of our developers is trying to compile FreeTDS from source on AIX 7.3
    They are having trouble with the Kerberos piece. they are receiving linker errors during the compile.
    Here are the installed krb5 packages. 
    krb5.client.rte            1.6.0.4 
    krb5.client.samples        1.6.0.4 
    krb5.doc.en_US.html        1.5.0.0 
    krb5.doc.en_US.pdf         1.6.0.4 
    krb5.lic                   1.6.0.4 
    krb5.msg.EN_US.client.rte  1.6.0.4 
    krb5.client.rte            1.6.0.4

     

    The switch for turning on kerberos says all that is needed is to have kerberos configured on the server.  Is the krb5.toolkit also required?

     

    Here is some of the output from the developer.

    ld: 0711-317 ERROR: Undefined symbol: .gss_init_sec_context
    ld: 0711-317 ERROR: Undefined symbol: .gss_release_buffer
    ld: 0711-317 ERROR: Undefined symbol: .gss_release_name
    ld: 0711-317 ERROR: Undefined symbol: .gss_delete_sec_context
    ld: 0711-317 ERROR: Undefined symbol: .gss_import_name

     

    # available Kerberos libs to test/choose from (64-bit libs removed from list):
    #-rw-r--r--    1 user staff        544919 Aug 18 2016  /apps/home/pdb/lib/libgssapi_krb5.so.2.2     x
    #    ends with the following linker errors:
    #    ld: 0711-317 ERROR: Undefined symbol: .gss_init_sec_context
    #    ld: 0711-317 ERROR: Undefined symbol: .gss_release_buffer
    #    ld: 0711-317 ERROR: Undefined symbol: .gss_release_name
    #    ld: 0711-317 ERROR: Undefined symbol: .gss_delete_sec_context
    #    ld: 0711-317 ERROR: Undefined symbol: .gss_import_name
    #-rw-r--r--    1 staff       1418007 Aug 18 2016  /apps/home/pdb/lib/libkrb5.so.3.3            x
    #       same as above*
    #-rw-r--r--    1 staff         89628 Aug 18 2016  /apps/home/pdb/lib/libkrb5support.so.0.1     x
    #       same as above*
    # *did not clean first
    #-rw-r--r--    1 root     system      9512997 Mar 22 10:33 /opt/freeware/lib/libgssapi_krb5.a           x
    #       same as above
    #-rw-r--r--    1 root     system      3460839 Oct 18 2022  /opt/freeware/lib/libgssapi_krb5.so.2.2      x
    #       same as above
    #-rw-r--r--    1 root     system     15770215 Mar 22 10:33 /opt/freeware/lib/libkrb5.a                  x
    #       same as above
    #-rw-r--r--    1 root     system      6347404 Oct 18 2022  /opt/freeware/lib/libkrb5.so.3.3             x
    #       same as above
    #-rw-r--r--    1 root     system      1215718 Oct 18 2022  /opt/freeware/lib/libkrb5support.a           x
    #       same as above
    #-rw-r--r--    1 root     system       583174 Oct 18 2022  /opt/freeware/lib/libkrb5support.so.0.1      x
    #       same as above
    #-rw-r--r--    1 heidev   heidev       544919 Aug 18 2016  /opt/pdb/pdb1/lib/libgssapi_krb5.so          x
    #       same as above
    #-rw-r--r--    1 heidev   heidev       544919 Aug 18 2016  /opt/pdb/pdb1/lib/libgssapi_krb5.so.2.2      x
    #       same as above
    #-rw-r--r--    1 heidev   heidev      1418007 Aug 18 2016  /opt/pdb/pdb1/lib/libkrb5.so                 x
    #       same as above
    #-rw-r--r--    1 heidev   heidev      1418007 Aug 18 2016  /opt/pdb/pdb1/lib/libkrb5.so.3.3             x
    #       same as above
    #-rw-r--r--    1 heidev   heidev        89628 Aug 18 2016  /opt/pdb/pdb1/lib/libkrb5support.so          x
    #       same as above
    #-rw-r--r--    1 heidev   heidev        89628 Aug 18 2016  /opt/pdb/pdb1/lib/libkrb5support.so.0.1      x
    #       same as above
    #-rw-r--r--    1 root     security    2348647 Jan 30 2017  /usr/krb5/lib/libgssapi_krb5.a               x
    #       same as above
    #-rw-r--r--    1 root     security    2576906 Jan 30 2017  /usr/krb5/lib/libkrb5.a                      x
    #       same as above
    #-rw-r--r--    1 root     system        30938 Apr 26 2012  /usr/lib/libtp_krb5.a                        x
    #threadsafe.c: In function 'tds_getservice':
    #threadsafe.c:248:2: error: #error getservbyname_r style unknown
    #  248 | #error getservbyname_r style unknown



    ------------------------------
    Ken Foster
    ------------------------------


  • 2.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 08:05 AM
    Edited by Ranjit Ranjan Fri June 30, 2023 08:05 AM

    Hi

    Which version of FreeTDS you are trying to build. 

    In my system, I get the reported undefined symbols in  libgssapi_krb5.a.  Can you run below command and check if symbols are found. 

    (0) root @ aixoss1-lp2: /
    # dump -X32 -Tov /opt/freeware/lib/libgssapi_krb5.a  | grep -i gss_delete_sec_context
    [370]   0x200018a4    .data      EXP     DS   Ldef        [noIMid] gss_delete_sec_context

    (0) root @ aixoss1-lp2: /
    # dump -X32 -Tov /opt/freeware/lib/libgssapi_krb5.a  | grep -i gss_init_sec_context
    [367]   0x20001880    .data      EXP     DS   Ldef        [noIMid] gss_init_sec_context

    (0) root @ aixoss1-lp2: /
    # rpm -qf /opt/freeware/lib/libgssapi_krb5.a
    krb5-libs-1.20.1-1.ppc



    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 3.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 08:31 AM

    Here is the output from the command.  I will see if i can get the exact steps they are using.

    [root@pdbdeva1][/]dump -X32 -Tov /opt/freeware/lib/libgssapi_krb5.a  | grep ->
    [365]   0x2000222c    .data      EXP     DS   Ldef        [noIMid] gss_delete_sec_context
    [214]   0x20005750    .data      EXP     DS SECdef        [noIMid] gss_delete_sec_context
    [root@pdbdeva1][/]



    ------------------------------
    Ken Foster
    ------------------------------



  • 4.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 09:01 AM
    Edited by Ranjit Ranjan Fri June 30, 2023 09:02 AM

    Okay. 

    I see in the first post, this file is also present at /usr/krb5/lib/libgssapi_krb5.a . Run the above command on this file too and check if symbol is found 

    Looks, Some library path issue.  

    is any value set for LIBPATH in the environment ? 



    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 5.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 09:08 AM

    [root@pdbdeva1][/]dump -X32 -Tov /usr/krb5/lib/libgssapi_krb5.a  | grep -i gss_delete_sec_context
    [214]   0x20005750    .data      EXP     DS SECdef        [noIMid] gss_delete_sec_context
    [root@pdbdeva1][/]env | grep -i path
    MANPATH=:/usr/local/man
    PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/krb5:/usr/krb5/lib:/usr/krb5/bin:/usr/java14/jre/bin:/usr/java14/bin:/opt/IBM/xlC/16.1.0/bin:/usr/local/bin:/usr/etc:/usr/local/bin:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/bin:/usr/opt/ifor/ls/os/aix/bin:/opt/LicenseUseManagement/bin
    CDPATH=.:/usr:/usr/lib:/usr/spool:/:/var/adm:
    LOCPATH=/usr/lib/nls/loc
    NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
    [root@pdbdeva1][/]



    ------------------------------
    Ken Foster
    ------------------------------



  • 6.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 09:52 AM

    Next, we need to check whether the library name is passed to the linker or not, while linking the application. 

    So share the complete failure logs and the steps used for building 



    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 7.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 08:10 AM

    And also, share the steps you are using to build. 



    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 8.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 11:55 AM

    Thanks, both of you.  This freetds-1.3.18 (let me know if you want configure output or build output, and I'll run it again and save everything).  For the target file specified by --enable-krb5=[lib], I tried every version that I could find on the box, minus the 64-bit libs.

    Step 1:

    configure --prefix=/apps/home/pdb --with-libiconv-prefix=/usr --enable-krb5=/usr/krb5/lib/libtp_krb5.a

    Step 2:

    # edit the generated Makefiles as needed (currently there are three)
    cd src/apps
    sed '/^CFLAGS*/s/$/  -I\/home\/gokeefe\/external\/include/' Makefile > Makefile-
    mv Makefile- Makefile
    cd -
     
    cd src/apps/fisql
    sed '/^CFLAGS*/s/$/  -I\/home\/gokeefe\/external\/include/' Makefile > Makefile-
    mv Makefile- Makefile
    cd -
     
    cd src/tds
    sed '/^CFLAGS*/s/$/  -I\/apps\/home\/pdb\/include/' Makefile > Makefile-
    mv Makefile- Makefile
    cd -

    Step 3:

    make clean all install



    ------------------------------
    Greg O'Keefe
    ------------------------------



  • 9.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 12:25 PM

    I am able to build the same version by following below steps.  Try once on the freshly cloned/checkout code . Just to avoid any wrong configuration in existing folder. 

    •   ./configure --prefix=/ranjit/freetds/build --enable-krb5
    •   make
    •   make install

    (0) root @ aixoss1-lp2: /ranjit/freetds/build/bin
    # pwd
    /ranjit/freetds/build/bin

    (0) root @ aixoss1-lp2: /ranjit/freetds/build/bin
    # ls
    bsqldb    bsqlodbc  datacopy  defncopy  fisql     freebcp   osql      tdspool   tsql



    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 10.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 12:59 PM

    I tried that and it failed (see below).  In fact, that is essentially the thing I tried back a few months ago.  I started with configure, added --prefix, added --with-iconv-prefix, and then added --enable-krb5 in various permutations.  The --with-iconv-prefix was in response to the libiconv linker errors, and the --enable-krb5 was in response to runtime connect failures.  Here is my output from the most recent test (configure output and make output attached):

    configure --prefix=/home/gokeefe --enable-krb5 > configure.20230630.out 2>&1
    make > make.20230630.out 2>&1



    ------------------------------
    Greg O'Keefe
    ------------------------------

    Attachment(s)

    out
    make.20230630.out   13 KB 1 version
    out
    configure.20230630.out   15 KB 1 version


  • 11.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 04:30 PM

    I reverted back to the configuration that produced the linker errors for gss_* and ran it again.  Attached are the script that I'm running that calls configure and make (redo.ksh), the configure output, the make output, and the config.log.  This is the problem that I'm trying to solve, the reason why we wanted to install a new version or perhaps a developer version of GSS or Kerberos.  We need something to link in that will provide the definitions for those undefined symbols that trip the linker.



    ------------------------------
    Greg O'Keefe
    ------------------------------

    Attachment(s)

    ksh
    redo.ksh   4 KB 1 version
    log
    config.log   274 KB 1 version
    out
    configure.scripted.2.out   14 KB 1 version
    out
    make.scripted.2.out   29 KB 1 version


  • 12.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 06:56 PM

    This looks fine. At least , this is not reporting KRB related symbol issue.

    Try 'export LDFLAGS="-L/opt/freeware/lib"' in the shell , then below

    •   ./configure --prefix=/ranjit/freetds/build --enable-krb5
    •   make
    •   make install


    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 13.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 06:58 PM

    This looks fine. At least , this is not reporting KRB related symbol issue.

    Try 'export LDFLAGS="-L/opt/freeware/lib"' in the shell , then below

    •   ./configure --prefix=/ranjit/freetds/build --enable-krb5
    •   make
    •   make install


    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 14.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri June 30, 2023 07:45 PM
      |   view attached

    Done, output attached.



    ------------------------------
    Greg O'Keefe
    ------------------------------

    Attachment(s)

    txt
    build_re13.txt   41 KB 1 version


  • 15.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Sat July 01, 2023 01:33 AM

    I see, some further progress in build log. 

    To fix the below error,  you can install readline-devel package using 'dnf install readline-devel'  and try again the same steps for building

    fisql.c:29:10: fatal error: readline/readline.h: No such file or directory
       29 | #include <readline/readline.h>
          |          ^~~~~~~~~~~~~~~~~~~~~



    ------------------------------
    Ranjit Ranjan
    ------------------------------



  • 16.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Mon July 03, 2023 11:46 AM

    Thank  you!  We will do that and post the results.



    ------------------------------
    Greg O'Keefe
    ------------------------------



  • 17.  RE: Compiling of FreeTDS from source on AIX 7.3

    Posted Fri July 07, 2023 01:40 PM
    Edited by Greg O'Keefe Fri July 07, 2023 01:41 PM

    We did not have any krb5 errors, but there is something going on with libiconv.  I ran the build three ways:

    The first did not specify anything about iconv in the configure command:
    configure --prefix=/apps/home/pdb --enable-krb5 > configure.20230707.txt 2>&1
    make clean all > make.20230707.txt 2>&1
    and ended in linker errors:
    ld: 0711-317 ERROR: Undefined symbol: .libiconv_open
    ld: 0711-317 ERROR: Undefined symbol: .libiconv_close
    ld: 0711-317 ERROR: Undefined symbol: .libiconv
     
    The second set the iconv path to one of two candidate locations:
    configure --prefix=/apps/home/pdb --enable-krb5 --with-libiconv-prefix=/opt/freeware > configure.freew
    make clean all > make.freeware.txt 2>&1
    and resulted in the same linker errors:
    ld: 0711-317 ERROR: Undefined symbol: .libiconv_open
    ld: 0711-317 ERROR: Undefined symbol: .libiconv_close
    ld: 0711-317 ERROR: Undefined symbol: .libiconv
     
    The third set a different iconv path:
    configure --prefix=/apps/home/pdb --enable-krb5 --with-libiconv-prefix=/usr > configure.usr.txt 2>&1
    make clean all > make.usr.txt 2>&1
    and completed successfully, but I do not know yet whether it is working. I have installed it for the developer who was asking for it and will know more when he completes his testing.
     
    For now, I have a question about our libiconv installation.  I am told that we have the latest, but i don't know the install path.  I see two main candidates:
     
    -rw-r--r--    1 root     system      3205279 Mar 22 10:32 /opt/freeware/lib/libiconv.a
    -r--r--r--    1 bin      bin          782787 Nov 17 2021  /usr/lib/libiconv.a
     
    I expected the one in /opt/freeware/lib to work, but it did not.  What can I do to test or update libiconv?  Or am I barking up the wrong tree there?
     
    All output files attached.  Thanks!



    ------------------------------
    Greg O'Keefe
    ------------------------------

    Attachment(s)

    txt
    configure.freeware.txt   15 KB 1 version
    txt
    make.20230707.txt   24 KB 1 version
    txt
    make.usr.txt   34 KB 1 version
    txt
    make.freeware.txt   24 KB 1 version
    txt
    configure.usr.txt   14 KB 1 version
    txt
    configure.20230707.txt   15 KB 1 version