FAQ
Hello,

I am new to a lot of things, including mySQL++, and even mySQL, so I
probably try many stupid things, and I probably don't know much what I am
talking about.

I have problems getting started using mySQL++ using Xcode under MacOS X
10.5.6 (10.5.7 soon I suppose too). I have Xcode 3.1.3.

First let me say that I was able to successfully use the native C API for
mySQL, as well as the mySQL "C++ Connector" (both from Xcode). This probably
rules out an installation problem with either mySQL or my development tools.

The problem is that the provided Xcode project file fails to build.

1- The provided mySQL++ Xcode project fails to build with the same recurring
compile-time error: config.h: no such file or directory.

This error is rather mysterious as config.h is indeed there. I was able to
work around that issue by adding "." and ".." to the header search path
setting.

2- The modified Xcode project now compiles OK, but fails at link time,
because the linker doesn't find 38 symbols, such as:

"_mysql_escape_string", "_mysql_real_escape_string",
"_mysql_next_result", "_mysql_thread_id", "_mysql_shutdown",
"_mysql_errno", "_mysql_error", "_mysql_stat",
"_mysql_info", "_mysql_init", "_mysql_select_db", etcŠ

These symbols seems to be from mySQL C API, (and indeed, they show up in a
dump by nm of libmysqlclient.a), so I tried to work around that by adding
/usr/local/mysql/lib to the library search paths and the following option to
Other link flags: -llibmysqlclient

This doesn't fix any of the errors above.

I also added libmysqlclient.a to the Xcode project manually, but that didn't
make a difference.

At this point, I don't know what I can do to fix the Xcode project. Any
idea?

3- Since I could not use the Xcode project to build mySQL++, I reverted to
the classic configure/make scheme. Everything went smoothly.

However, the standard make procedure (AFAICS), doesn't build the examples. I
am now faced with building and running at least one example. I chose
simple1.

Using the provided Xcode projects fails as described above, so I created a
new Xcode project from scratch, just for that example. I modified the search
header, search library settingds, and I added the dynamic library
/usr/local/lib/libmysqlpp.dylib.

Also to avoid having to use command line parameters, I replaced the connect
line as :

//conn.connect(db, server, user, pass)
conn.connect("test", "localhost", "root", "")

With that in place, the example builds fine in debug mode, but crashes with
a bus error at run time on line

mysqlpp::Query query = conn.query("select item from stock");

The stack crawl is

#0 0x000fa6e1 in __gnu_cxx::__exchange_and_add
#1 0x000c4ac4 in std::locale::_Impl::_M_replace_category
#2 0x000c42fa in std::locale::operator=
#3 0x000c3f1e in std::ios_base::_M_init
#4 0x000cf207 in std::basic_ios<char, std::char_traits<char> >::init
#5 0x0006f084 in OptionalExceptions [inlined] at noexceptions.h:45
#6 0x0006f084 in mysqlpp::Query::Query at query.cpp:45
#7 0x00060808 in mysqlpp::Connection::query at connection.cpp:264

At this point, I feel stuck. What did I miss? Is that crash really a bug, or
related to the build problems I described above? I have no idea.

Does somebody have a working Xcode project with one of the samples that I
could download somewhere, so I could try to find what I missed?

Any suggestion welcome.

Search Discussions

  • Warren Young at May 13, 2009 at 2:40 pm

    On May 13, 2009, at 4:17 AM, Jean-Denis Muys wrote:

    The problem is that the provided Xcode project file fails to build.
    No big surprise there: you're probably the first to try it. You're
    certainly the first to try it and then report what happened. Xcode
    support is something we're just supposed to get for free from
    Bakefile, but clearly it needs more work. I imagine most Mac OS X
    users of MySQL++ are building from the command line. I know I am.
    2- The modified Xcode project now compiles OK, but fails at link time,
    because the linker doesn't find 38 symbols, such as:

    "_mysql_escape_string", "_mysql_real_escape_string",
    "_mysql_next_result", "_mysql_thread_id", "_mysql_shutdown",
    "_mysql_errno", "_mysql_error", "_mysql_stat",
    "_mysql_info", "_mysql_init", "_mysql_select_db", etc…

    These symbols seems to be from mySQL C API Yes.
    I tried to work around that by adding
    /usr/local/mysql/lib to the library search paths and the following
    option to
    Other link flags: -llibmysqlclient
    The link flag needs to be -lmysqlclient. Unixy linkers assume the
    "lib" prefix.
    However, the standard make procedure (AFAICS), doesn't build the
    examples.
    Sure it does. Perhaps you haven't yet read README-examples.txt?
    The stack crawl is

    #0 0x000fa6e1 in __gnu_cxx::__exchange_and_add
    #1 0x000c4ac4 in std::locale::_Impl::_M_replace_category
    #2 0x000c42fa in std::locale::operator=
    #3 0x000c3f1e in std::ios_base::_M_init
    #4 0x000cf207 in std::basic_ios<char, std::char_traits<char>
    ::init
    #5 0x0006f084 in OptionalExceptions [inlined] at noexceptions.h:45
    #6 0x0006f084 in mysqlpp::Query::Query at query.cpp:45
    #7 0x00060808 in mysqlpp::Connection::query at connection.cpp:264
    I don't know what's going on here. Wild guess: you're using the wrong
    build options in your project, differing in some key way from the way
    the library is built, so that the RTL crashes when you try to call
    across the boundary.

    Try the examples first. Once you prove to yourself that the code can
    work, you can work on building something functional through Xcode.
    Is that crash really a bug
    Surely if the library was so horribly broken that you can't even
    construct a Query object, someone would have reported it by now.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupplusplus @
categoriesmysql
postedMay 13, '09 at 10:17a
activeMay 13, '09 at 2:40p
posts2
users2
websitemysql.com
irc#mysql

2 users in discussion

Warren Young: 1 post Jean-Denis Muys: 1 post

People

Translate

site design / logo © 2022 Grokbase