Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8784865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:12:40+00:00 2026-06-13T21:12:40+00:00

I remember, years ago when I started using mySQL, it was a nightmare to

  • 0

I remember, years ago when I started using mySQL, it was a nightmare to set up things “just so,” so that the libraries were found (especially mySQL libraries!). In my case, I believe ldconfig was the tool that sorted things out. Flash forward to 2012 – have just installed a new “primary” system that includes 64-bit Ubuntu 12.04, and I’m in the process of making sure all my sources will compile. Imagine my surprise that I’m back in the same boat with libmysqlclient.

My web searches have revealed much to try, nothing that helps. Along the way, I found this trick: gcc … mysql_config --cflags --libs – very nice, but that didn’t help.

So, for example, the result of:

gcc -D_FILE_OFFSET_BITS=64 `mysql_config --cflags --libs` \
            -o check-my-ip \
            -s check-my-ip.c ../common/ini-file.c

is

 /tmp/ccxAgCqr.o: In function `updateTables':
 /usr/local/src/check-my-ip/check-my-ip.c:373: undefined reference to `mysql_init'
 /usr/local/src/check-my-ip/check-my-ip.c:374: undefined reference to `mysql_real_connect'
 /usr/local/src/check-my-ip/check-my-ip.c:381: undefined reference to `mysql_error'
 /usr/local/src/check-my-ip/check-my-ip.c:381: undefined reference to `mysql_errno'
 /usr/local/src/check-my-ip/check-my-ip.c:397: undefined reference to `mysql_field_count'
 /usr/local/src/check-my-ip/check-my-ip.c:398: undefined reference to `mysql_use_result'
 /usr/local/src/check-my-ip/check-my-ip.c:399: undefined reference to `mysql_fetch_row'
 /usr/local/src/check-my-ip/check-my-ip.c:419: undefined reference to `mysql_free_result'
 /usr/local/src/check-my-ip/check-my-ip.c:422: undefined reference to `mysql_field_count'
 /usr/local/src/check-my-ip/check-my-ip.c:429: undefined reference to `mysql_close'
 /tmp/ccxAgCqr.o: In function `myQuery':
 /usr/local/src/check-my-ip/check-my-ip.c:439: undefined reference to `mysql_query'
 /usr/local/src/check-my-ip/check-my-ip.c:441: undefined reference to `mysql_error'
 /tmp/ccxAgCqr.o: In function `indexExists':
 /usr/local/src/check-my-ip/check-my-ip.c:464: undefined reference to `mysql_field_count'
 /usr/local/src/check-my-ip/check-my-ip.c:465: undefined reference to `mysql_use_result'
 /usr/local/src/check-my-ip/check-my-ip.c:466: undefined reference to `mysql_fetch_row'
 /usr/local/src/check-my-ip/check-my-ip.c:471: undefined reference to `mysql_free_result'
 collect2: ld returned 1 exit status
 make: *** [check-my-ip] Error 1

Output from mysql_config –cflags –libs is:

-I/usr/include/mysql -DBIG_JOINS=1  -fno-strict-aliasing  -g
-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl

These are some other commands that may be helpful in diagnosis:

$ ldconfig -p | grep mysql

    libmysqlclient.so.18 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
    libmysqlclient.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmysqlclient.so

 $ ls -l /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
 lrwxrwxrwx 1 root root 24 Jun 11 10:21 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
 $ ls -l /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0
 -rw-r--r-- 1 root root 3408136 Jun 11 10:21 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0

I did an aptitude search libmysql and noted that there are 37 lines, most of which have the i386 designation (like: libmysqld-pic:i386),
and I notice that there are zero lines with x86_64 (or -64) in that output; is that part of the problem? (Here are those 37 lines)

 $ aptitude search libmysql
 p   libmysql++-dev                            - MySQL C++ library bindings (development)
 p   libmysql++-dev:i386                       - MySQL C++ library bindings (development)
 p   libmysql++-doc                            - MySQL C++ library bindings (documentation and exampl
 p   libmysql++3                               - MySQL C++ library bindings (runtime)
 p   libmysql++3:i386                          - MySQL C++ library bindings (runtime)
 p   libmysql-cil-dev                          - MySQL database connector for CLI
 p   libmysql-diff-perl                        - module for comparing the table structure of two MySQ
 p   libmysql-java                             - Java database (JDBC) driver for MySQL
 p   libmysql-ocaml                            - OCaml bindings for MySql
 p   libmysql-ocaml:i386                       - OCaml bindings for MySql
 p   libmysql-ocaml-dev                        - OCaml bindings for MySql
 p   libmysql-ocaml-dev:i386                   - OCaml bindings for MySql
 v   libmysql-ocaml-dev-dnim6:i386             -
 v   libmysql-ocaml-dev-jygp6                  -
 v   libmysql-ocaml-dnim6:i386                 -
 v   libmysql-ocaml-jygp6                      -
 p   libmysql-ruby                             - Transitional package for ruby-mysql
 v   libmysql-ruby:i386                        -
 p   libmysql-ruby1.8                          - Transitional package for ruby-mysql
 v   libmysql-ruby1.8:i386                     -
 p   libmysql-ruby1.9.1                        - Transitional package for ruby-mysql
 v   libmysql-ruby1.9.1:i386                   -
 p   libmysql6.4-cil                           - MySQL database connector for CLI
 i   libmysqlclient-dev                        - MySQL database development files
 p   libmysqlclient-dev:i386                   - MySQL database development files
 v   libmysqlclient15-dev                      -
 v   libmysqlclient15-dev:i386                 -
 i A libmysqlclient18                          - MySQL database client library
 p   libmysqlclient18:i386                     - MySQL database client library
 p   libmysqlcppconn-dev                       - MySQL Connector for C++ (development files)
 p   libmysqlcppconn-dev:i386                  - MySQL Connector for C++ (development files)
 p   libmysqlcppconn5                          - MySQL Connector for C++ (library)
 p   libmysqlcppconn5:i386                     - MySQL Connector for C++ (library)
 i   libmysqld-dev                             - MySQL embedded database development files
 p   libmysqld-dev:i386                        - MySQL embedded database development files
 p   libmysqld-pic                             - MySQL database development files
 p   libmysqld-pic:i386                        - MySQL database development files

Here’s the content of /usr/lib/mysql

$ find /usr/lib/mysql
/usr/lib/mysql
/usr/lib/mysql/plugin
/usr/lib/mysql/plugin/qa_auth_client.so
/usr/lib/mysql/plugin/auth.so
/usr/lib/mysql/plugin/qa_auth_server.so
/usr/lib/mysql/plugin/semisync_master.so
/usr/lib/mysql/plugin/libdaemon_example.so
/usr/lib/mysql/plugin/ha_example.so
/usr/lib/mysql/plugin/adt_null.so
/usr/lib/mysql/plugin/auth_test_plugin.so
/usr/lib/mysql/plugin/auth_socket.so
/usr/lib/mysql/plugin/qa_auth_interface.so
/usr/lib/mysql/plugin/semisync_slave.so
/usr/lib/mysql/plugin/mypluglib.so

I don’t know what else to try, where else to look, and would appreciate any pointers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:12:41+00:00Added an answer on June 13, 2026 at 9:12 pm

    Linker flags should always be specified last:

    gcc -D_FILE_OFFSET_BITS=64 `mysql_config --cflags` \
            -o check-my-ip \
            -s check-my-ip.c ../common/ini-file.c \
            `mysql_config --libs`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can remember that many years ago (in 2005) I was using BackgroundWorker in
I remember many years ago using a program that would allow Classic ASP websites
I remember some years ago, when I learned C using Turbo C, it had
One of the awesome things I remember in Visual Basic 6 from years ago
I remember from 3 years ago that it was an absolutely huge pain to
I remember from 3 years ago that it was an absolutely huge pain to
I slightly remember from age old PHP days (years ago) that different functions wanted
From my age old php days (years ago) I slightly remember that I had
I remember reading an article or post somewhere years ago that suggested including a
Quite a few years ago, I remember that I struggled with a multiple site

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.