Ad Widget

Collapse

Error in db.c with MySQL functions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KarmaPolice
    Member
    • Oct 2005
    • 95

    #1

    Error in db.c with MySQL functions

    I am trying to compile beta3... I have the following setup:

    PHP 5.1.1
    MySQL 5.0.16
    RedHat EL 3

    My configure line is: ./configure --prefix=/opt/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql --with-net-snmp

    I have gotten it to configure properly, however when i go to do "make install" it errors out as follows:

    Code:
    gcc  -g -O2   -o zabbix_server -L/usr/local/mysql/lib -lmysqlclient -lm -lz   -L/usr/lib -lnetsnmp -lcrypto  evalfunc.o expression.o actions.o zlog.o functions.o server.o ../libs/zbxsysinfo/libzbxsysinfo.a ../libs/zbxsysinfo/linux/libzbxsysinfo2.a ../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a escalator/libzbxescalator.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a  ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcommon/libzbxcommon.a -lresolv -lnsl
    evalfunc.o(.text+0x81): In function `evaluate_COUNT':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server/evalfunc.c:93: undefined reference to `mysql_free_result'
    evalfunc.o(.text+0x129): In function `evaluate_SUM':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server/evalfunc.c:142: undefined reference to `mysql_free_result'
    evalfunc.o(.text+0x1d5): In function `evaluate_AVG':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server/evalfunc.c:192: undefined reference to `mysql_free_result'
    evalfunc.o(.text+0x289): In function `evaluate_MIN':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server/evalfunc.c:242: undefined reference to `mysql_free_result'
    evalfunc.o(.text+0x33d): In function `evaluate_MAX':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server/evalfunc.c:292: undefined reference to `mysql_free_result'
    evalfunc.o(.text+0x3f1):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server/evalfunc.c:342: more undefined references to `mysql_free_result' follow
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0xc): In function `DBclose':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:50: undefined reference to `mysql_close'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x25): In function `DBconnect':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:72: undefined reference to `mysql_init'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x55):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:74: undefined reference to `mysql_real_connect'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x85):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:79: undefined reference to `mysql_error'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0xcc):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:88: undefined reference to `mysql_select_db'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0xec):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:90: undefined reference to `mysql_error'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x132): In function `DBexecute':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:133: undefined reference to `mysql_query'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x158):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:136: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x169):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:136: undefined reference to `mysql_error'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x186):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:138: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x19d):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:138: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x1b4):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:138: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x20a): In function `DBselect':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:185: undefined reference to `mysql_query'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x230):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:188: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x241):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:188: undefined reference to `mysql_error'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x25e):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:190: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x275):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:190: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x28c):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:190: undefined reference to `mysql_errno'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x2dd): In function `DBget_field':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:233: undefined reference to `mysql_data_seek'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x2e5):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:234: undefined reference to `mysql_fetch_row'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x309):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:237: undefined reference to `mysql_error'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x329):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:238: undefined reference to `mysql_error'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x362): In function `DBinsert_id':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:255: undefined reference to `mysql_insert_id'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x374): In function `DBaffected_rows':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:269: undefined reference to `mysql_affected_rows'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x3a2): In function `DBnum_rows':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:313: undefined reference to `mysql_num_rows'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x44d): In function `DBget_function_result':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:365: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x514): In function `DBget_prev_trigger_value':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:417: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x548):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:392: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x59e):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:401: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x5cc):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:408: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x63c):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:421: more undefined references to `mysql_free_result' follow
    ../libs/zbxdbhigh/libzbxdbhigh.a(db.o)(.text+0x2b5): In function `DBselect':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/db.c:201: undefined reference to `mysql_store_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(action.o)(.text+0x10d): In function `DBget_action_by_actionid':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/action.c:92: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(action.o)(.text+0x307): In function `DBadd_action_to_linked_hosts':
    /U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/action.c:131: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(action.o)(.text+0x33a):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/action.c:137: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(action.o)(.text+0x5c6):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/action.c:180: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(action.o)(.text+0x5d7):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/action.c:182: undefined reference to `mysql_free_result'
    ../libs/zbxdbhigh/libzbxdbhigh.a(graph.o)(.text+0x154):/U/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/libs/zbxdbhigh/graph.c:105: more undefined references to `mysql_free_result' follow
    collect2: ld returned 1 exit status
    make[3]: *** [zabbix_server] Error 1
    make[3]: Leaving directory `/usr/local/custom/unix/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server'
    make[2]: *** [install-recursive] Error 1
    make[2]: Leaving directory `/usr/local/custom/unix/csg/zabbix-1.1.b3/zabbix-1.1beta3/src/zabbix_server'
    make[1]: *** [install-recursive] Error 1
    make[1]: Leaving directory `/usr/local/custom/unix/csg/zabbix-1.1.b3/zabbix-1.1beta3/src'
    make: *** [install-recursive] Error 1

    What I have come to find is that many of the mysql functions in the db.c file should be mysqli for example the php function "mysql_store_result" doesn't exist, yet it is called... there is however a "mysqli_store_result" function....

    Not quite sure if this is an error with my setup as much as an error with mysql or php... but any help in how to resolve this would be appreciated.
    Last edited by KarmaPolice; 09-12-2005, 23:24.
  • KarmaPolice
    Member
    • Oct 2005
    • 95

    #2
    I did a little parsing out and the functions i'm seeing this problem for are as follows:

    mysql_free_result
    mysql_close
    mysql_init
    mysql_error
    mysql_init
    mysql_real_connect
    mysql_select_db
    mysql_query
    mysql_errno
    mysql_data_seek
    mysql_fetch_row
    mysql_insert_id
    mysql_affected_rows
    mysql_num_rows
    mysql_free_result
    mysql_store_result


    Now obviously some of these functions actually do exist in php... however for some reason they aren't being recognized... any help is appreciated.

    Comment

    • KarmaPolice
      Member
      • Oct 2005
      • 95

      #3
      I think the error is with the way the libraries are linked in the makefile... but i can't figure out what it should look like.

      Comment

      • pdwalker
        Senior Member
        • Dec 2005
        • 166

        #4
        Where is your copy of mysql 5 installed?

        Are you absolutely sure your configure parameter is correct? (--with-mysql=/usr/local/mysql)

        - Paul

        Comment

        • KarmaPolice
          Member
          • Oct 2005
          • 95

          #5
          100% positive that is where it is located...

          Comment

          • pdwalker
            Senior Member
            • Dec 2005
            • 166

            #6
            go to your /usr/local/mysql/lib directory. Are the libraries in there? Or are they located in the /usr/local/mysql/lib/mysql subdirectory?

            If they are in the latter, symbolically link the files in /usr/local/mysql/lib/mysql to /usr/local/mysql/lib

            - Paul

            Comment

            • KarmaPolice
              Member
              • Oct 2005
              • 95

              #7
              the files are indeed in /usr/local/mysql/lib (i have no mysql subdirectories under /usr/local/mysql/lib or /usr/local/mysql/include)

              Comment

              • pdwalker
                Senior Member
                • Dec 2005
                • 166

                #8
                What the errors are saying is that the linker cannot resolve the references to the functions that are in the mysql libraries.

                The -L/usr/local/mysql/lib parameter in the make file is correct according to what you have told us.

                The only things that I can think of are

                1/ the user you are compiling under cannot accesss the mysql lib directory.

                2/ mysql 5 is not really there

                3/ something else that hasnt occurred to me.

                Sorry I cannot help more than that.

                - Paul

                Comment

                • KarmaPolice
                  Member
                  • Oct 2005
                  • 95

                  #9
                  so that's kinda what i think it is too... but i can't figure out what that compile line should be... right now it is (and yes, i moved mysql to the default location so those linked dirs are correct) :

                  gcc -g -O2 -o zabbix_server -L/usr/lib/mysql -lmysqlclient -lm -lz -L/usr/lib -lnetsnmp -lcrypto evalfunc.o expression.o actions.o zlog.o functions.o server.o ../libs/zbxsysinfo/libzbxsysinfo.a ../libs/zbxsysinfo/linux/libzbxsysinfo2.a ../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a escalator/libzbxescalator.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcommon/libzbxcommon.a -lresolv -lnsl


                  which looks fine, the only thing i see "missing" that i would usually have would be a -I to include some files... but i don't know if that is neccesary... anyway, i've tried reinstalling mysql a couple different ways, and the files are definitely there and reachable... so... i'm really not sure...
                  Last edited by KarmaPolice; 12-12-2005, 21:50.

                  Comment

                  • KarmaPolice
                    Member
                    • Oct 2005
                    • 95

                    #10
                    just tried this again with beta4 and still no dice... i'm really stumped here... as i have mysql installed in the default place from the rpms of their site... i figure that setup has probably been exhaustively tested and it seems others are getting it to compile fine...

                    Comment

                    • pdwalker
                      Senior Member
                      • Dec 2005
                      • 166

                      #11
                      At this point, without access to your machine I cannot think of why it would be a problem.

                      Just one last suggestion.

                      When you ran the configure script, did you add this parameter?

                      --with-mysql=/path/to/your/mysql?

                      in my case, it was --with-mysql=/usr/local/site/mysql

                      - Paul

                      Comment

                      • KarmaPolice
                        Member
                        • Oct 2005
                        • 95

                        #12
                        Yeah, i figured it out... the library files in the new version get put in a different place then zabbix was looking for them... so... even though mysql.h was still in the correct place libmysqlclient.so was in a different directory and so it wasn't able to find that one despite passing the configure check (maybe a catch for that file should be added as well?)...

                        Anyway, i copied the .so to where the rest of the .h files were located and it worked fine...

                        Thanks for all your help, really appreciate it... weirdness with my setup or in general i am not sure... but for everyone's info there is the solution i found.

                        Comment

                        • Nelson O. Aponte
                          Junior Member
                          • Mar 2007
                          • 5

                          #13
                          Hey how u doing?
                          I'm having the same problem with Zabbix 1.3.3 (the ./configure works perfectly, but I get the error on the make install)

                          I'm running SuSe Enterprise Server 10
                          MySQL Server 5.0.37-0.glibc23 i386
                          Php5 5.1.2.29-5 i586
                          I also have MySQL-devel, mysql-client, the modules for php, etc., the schema and data loaded on the database

                          MySQL is not on /usr/local/mysql, but it's on the default path set by the rpm, I also moved the libmysqlclient.so 15 and libmysqlclient.so 15.0.0 to the place where the mysql.h is located but it doesn't work.

                          The command I'm ussing is:
                          ./configure --enable-server --with-mysql --with-net-snmp –
                          with-libcurl # for MySQL + WEB monitoring

                          I appreciate any help you can provide
                          By the way, I'm not an advanced Linux user, I just have some basic knowledge.
                          Thanks

                          Comment

                          • Nelson O. Aponte
                            Junior Member
                            • Mar 2007
                            • 5

                            #14
                            For anyone trying to solve this issue, check the installation guide provided on this web page: http://www.netadmintools.com/art526.html.
                            It works perfectly combined with the link to the libmysql.so library.
                            ln -s /usr/lib/libmysqlclient.so.14.0.0 /usr/lib/mysql/libmysqlclient.so

                            By the way, it didn't work for me with version 1.3.3, just with 1.1.6 and 1.1.7.

                            Bye
                            Last edited by Nelson O. Aponte; 16-04-2007, 03:26.

                            Comment

                            Working...