Results 1 to 5 of 5

Thread: mysql plugin not compiling from source

  1. #1
    Join Date
    Jun 2014
    Posts
    15
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default mysql plugin not compiling from source

    i have qt 5.2.1 in centos6.6 (32 bit) linux, in vmware machine. mysql in another VM. mysql is connection from client

    to server is successful. But when i want to build plugin for mysql database connectivity by command :
    Qt Code:
    1. # /opt/Qt5.2.1/5.2.1/gcc/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
    2. # make
    To copy to clipboard, switch view to plain text mode 
    this gives following error :
    Qt Code:
    1. /export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/mysys/my_getsystime.c:44: undefined
    2. reference to `clock_gettime'
    3. collect2: error: ld returned 1 exit status
    4. make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
    To copy to clipboard, switch view to plain text mode 
    how to solvw this

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,708
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: mysql plugin not compiling from source

    Try adding librt to the linker:
    Qt Code:
    1. # /opt/Qt5.2.1/5.2.1/gcc/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r -lrt" mysql.pro
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2014
    Posts
    15
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: mysql plugin not compiling from source

    this " -lrt" adding give following error:-
    -------------------------------------------
    Qt Code:
    1. /usr/lib/mysql/libmysqlclient_r.a(client_plugin.c.o): In function `do_add_plugin':
    2. /export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:179:
    3.  
    4. undefined reference to `dlclose'
    5. /usr/lib/mysql/libmysqlclient_r.a(client_plugin.c.o): In function `mysql_client_plugin_deinit':
    6. /export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:306:
    7.  
    8. undefined reference to `dlclose'
    9. /usr/lib/mysql/libmysqlclient_r.a(client_plugin.c.o): In function `mysql_load_plugin_v':
    10. /export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:393:
    11.  
    12. undefined reference to `dlopen'
    13. /export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:422:
    14.  
    15. undefined reference to `dlsym'
    16. /export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:413:
    17.  
    18. undefined reference to `dlerror'
    19. /export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:425:
    20.  
    21. undefined reference to `dlclose'
    22. collect2: error: ld returned 1 exit status
    23. make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,708
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: mysql plugin not compiling from source

    this is not the result of adding librt.
    Adding librt solved the error you posted at first, now you are having another lib missing:
    Now you have to add '-ldl'.
    And if you continue getting such errors, google for the functions which the linker is complaining about and see in which lib they are defined, and add them to you linker line until all the dependencies are satisfied.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Jun 2014
    Posts
    15
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: mysql plugin not compiling from source

    Thanks high_flyer, you solved my problem. I added -lrt and -ldl like this:-

    Qt Code:
    1. # /opt/Qt5.2.1/5.2.1/gcc/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r -lrt -ldl" mysql.pro
    2.  
    3. #make
    4. # make install
    To copy to clipboard, switch view to plain text mode 

    and the problem was gone.

    And finally tell me how to set this thread as SOLVED.

Similar Threads

  1. Compiling and instaling Qt Creator from source error
    By Kaluss in forum Installation and Deployment
    Replies: 0
    Last Post: 19th June 2015, 11:52
  2. Compiling from source Qt 4.7.3 with win32-msvc2010 in Win7x64
    By rvc in forum Installation and Deployment
    Replies: 2
    Last Post: 15th August 2011, 13:19
  3. error while compiling qtmobility from source
    By Aladin in forum Installation and Deployment
    Replies: 4
    Last Post: 5th May 2011, 17:24
  4. Problem with compiling MySQL Plugin (Win7 x64)
    By GwynBleidD in forum Installation and Deployment
    Replies: 3
    Last Post: 24th April 2011, 12:13
  5. Replies: 1
    Last Post: 14th July 2009, 10:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.