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
  • 1.  C compiler doesn't find function in library

    Posted Fri April 08, 2022 09:18 AM
    Hello,

    I have a working community-mysql-server 8.0.20 on aix 7.2

    mysql --version
    mysql Ver 8.0.20 for AIX on powerpc (Source distribution)

    C-API library is installed in

    ls -l /opt/freeware/lib/libmysqlclient.a
    -rwxr-xr-x 1 root system 8703555 Mar 10 08:40 /opt/freeware/lib/libmysqlclient.a

    When I compile following program "version.c" with IBM xlc compiler

    #include <mysql.h>
    #include <stdio.h>

    int main()
    {
    printf("MySQL client version: %s\n",mysql_get_client_info());
    }

    xlc -c version.c -I/opt/freeware/include/mysql

    a version.o object file is created that's OK, no errors while compiling to an object file



    But when I compile it to an executable "version" program, the compiler doesn't find the function in the library

    xlc -o version version.c -L/opt/freeware/lib -lmysqlclient

    ld: 0711-317 ERROR: Undefined symbol: .mysql_get_client_info
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

    Is that because the the program compiled witth IBM xlc compiler is linked to libmysqlclient.a that was compiled with another compiler ?

    I tried to compile with gcc-8 too but that does the same

    ld: 0711-317 ERROR: Undefined symbol: .mysql_get_client_info
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

    What can be the reason that compiler doesn't find the function in lib ?

    Kind regards,

    Johan Volders



    ------------------------------
    Johan Volders
    ------------------------------


  • 2.  RE: C compiler doesn't find function in library

    Posted Fri April 08, 2022 09:37 AM
    The mysql server build is 64bit. By default, AIX development env is 32bit. So you need to pass "-q64" for xlc & "-maix64" for gcc. Another option is to set OBJECT_MODE=64.

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



  • 3.  RE: C compiler doesn't find function in library

    Posted Fri April 08, 2022 09:49 AM

    Compiled with gcc and option -maix64

     

    Executable version is created now, execution gives

     

    P8:/home/myc/TEST>./version

    exec(): 0509-036 Cannot load program version because of the following errors:

            0509-130 Symbol resolution failed for /opt/freeware/lib/libmysqlclient.a

    [libmysqlclient.so.21] because:

            0509-136   Symbol _ZSt11__once_call (number 177) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol _ZSt15__once_callable (number 178) is not exported fro

    m

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol __once_proxy (number 193) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

     

            0509-192 Examine .loader section symbols with the

                     'dump -Tv' command.

     

     

    Let's try now what xlc with option -q64 does

     

    FOAM-TTP-mailbanner-PCB-N

    https://be.foamglas.com/nl-be/homepage

     



    The information contained in this communication and its attachment(s) is intended only for the use of the individual to whom it is addressed and
    may contain information that is privileged, confidential, or exempt from disclosure. If the reader of this message is not the intended recipient,
    you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this
    communication in error, please notify postmaster@owenscorning.com and delete the communication without retaining any copies. Thank you.

    Translations available: http://www.owenscorning.com/emailfooter.html





  • 4.  RE: C compiler doesn't find function in library

    Posted Fri April 08, 2022 09:52 AM
    Try to compile with pthread support. 
    "gcc -pthread"

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



  • 5.  RE: C compiler doesn't find function in library

    Posted Fri April 08, 2022 10:02 AM

    gcc-8 `mysql_config --cflags` \

    -o version version.c \

    `mysql_config --libs` \

    -maix64 \

    -pthread

     

    P8:/home/myc/TEST>./version

    exec(): 0509-036 Cannot load program version because of the following errors:

            0509-130 Symbol resolution failed for /opt/freeware/lib/libmysqlclient.a

    [libmysqlclient.so.21] because:

            0509-136   Symbol _ZSt11__once_call (number 177) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol _ZSt15__once_callable (number 178) is not exported fro

    m

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol __once_proxy (number 193) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-192 Examine .loader section symbols with the

                     'dump -Tv' command.

     

     

    Looks the same

     

     

    FOAM-TTP-mailbanner-PCB-N

    https://be.foamglas.com/nl-be/homepage

     



    The information contained in this communication and its attachment(s) is intended only for the use of the individual to whom it is addressed and
    may contain information that is privileged, confidential, or exempt from disclosure. If the reader of this message is not the intended recipient,
    you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this
    communication in error, please notify postmaster@owenscorning.com and delete the communication without retaining any copies. Thank you.

    Translations available: http://www.owenscorning.com/emailfooter.html





  • 6.  RE: C compiler doesn't find function in library

    Posted Fri April 08, 2022 10:16 AM

    Xlc also creates an executable but same errors I believe

     

    xlc -q64 `mysql_config --cflags` \

    -o version version.c \

    `mysql_config --libs`

     

    P8:/home/myc/TEST>./version

    exec(): 0509-036 Cannot load program version because of the following errors:

            0509-130 Symbol resolution failed for /opt/freeware/lib/libmysqlclient.a

    [libmysqlclient.so.21] because:

            0509-136   Symbol _ZSt11__once_call (number 177) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol _ZSt15__once_callable (number 178) is not exported fro

    m

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol __once_proxy (number 193) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-192 Examine .loader section symbols with the

                     'dump -Tv' command.

     

    Xlc with extra option -qthreaded also same error when running the executable

     

    xlc -q64 -qthreaded `mysql_config --cflags` \

    -o version version.c \

    `mysql_config --libs`

     

    P8:/home/myc/TEST>./version

    exec(): 0509-036 Cannot load program version because of the following errors:

            0509-130 Symbol resolution failed for /opt/freeware/lib/libmysqlclient.a

    [libmysqlclient.so.21] because:

            0509-136   Symbol _ZSt11__once_call (number 177) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol _ZSt15__once_callable (number 178) is not exported fro

    m

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-136   Symbol __once_proxy (number 193) is not exported from

                       dependent module /opt/freeware/lib/libstdc++.a[libstdc++.so.6

    ].

            0509-192 Examine .loader section symbols with the

                     'dump -Tv' command.

     

     

     

     

     

     

     

     

     

    FOAM-TTP-mailbanner-PCB-N

    https://be.foamglas.com/nl-be/homepage

     



    The information contained in this communication and its attachment(s) is intended only for the use of the individual to whom it is addressed and
    may contain information that is privileged, confidential, or exempt from disclosure. If the reader of this message is not the intended recipient,
    you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this
    communication in error, please notify postmaster@owenscorning.com and delete the communication without retaining any copies. Thank you.

    Translations available: http://www.owenscorning.com/emailfooter.html





  • 7.  RE: C compiler doesn't find function in library
    Best Answer

    Posted Fri April 08, 2022 10:27 AM
    You can add "-L/opt/freeware/lib/pthread/ppc64" in the compile command.

    gcc-8 `mysql_config --cflags` -o version version.c -L/opt/freeware/lib/pthread/ppc64 `mysql_config --libs` -maix64 -pthread

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



  • 8.  RE: C compiler doesn't find function in library

    Posted Fri April 08, 2022 11:04 AM

    gcc-8 `mysql_config --cflags` \

    -o version version.c \

    -L/opt/freeware/lib/pthread/ppc64 \

    `mysql_config --libs` \

    -maix64 -pthread

     

    P8:/home/myc/TEST>./version

    MySQL client version: 8.0.20

     

    The program works like expected, tried the same for xlc compiler

    add "-L/opt/freeware/lib/pthread/ppc64" in the compile command

     

    xlc -q64 -qthreaded `mysql_config --cflags` \

    -o version version.c \

    -L/opt/freeware/lib/pthread/ppc64 \

    `mysql_config --libs`

     

    P8:/home/myc/TEST>./version

    MySQL client version: 8.0.20

     

    Program here works also now.

    Thank you very much and have a nice weekend

     

    Johan Volders

     

     

     

    FOAM-TTP-mailbanner-PCB-N

    https://be.foamglas.com/nl-be/homepage

     



    The information contained in this communication and its attachment(s) is intended only for the use of the individual to whom it is addressed and
    may contain information that is privileged, confidential, or exempt from disclosure. If the reader of this message is not the intended recipient,
    you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this
    communication in error, please notify postmaster@owenscorning.com and delete the communication without retaining any copies. Thank you.

    Translations available: http://www.owenscorning.com/emailfooter.html