List:MySQL++« Previous MessageNext Message »
From:Ina J. Date:August 22 2011 9:02am
Subject:Re: MySQL++ not working with libstdc++6
View as plain text  
I reinstalled mysql++ and g++ and libstdc++, but no luck with those. Then I
made a simple main program from the example simple1.cpp

int main()
{

mysqlpp::Connection conn(false);
if (conn.connect(DBNAME, DBADDRESS, DBUSER, DBPWD, DBPORT)) {
// Retrieve a subset of the sample stock table set up by resetdb
// and display it.
mysqlpp::Query query = conn.query("SELECT * from Meter");
} else {
cerr << "DB connection failed: " << conn.error() << endl;
return 1;
}

return 1;
}


And valgrind says this:

==24122== Use of uninitialised value of size 8
==24122==    at 0x54FE181: std::locale::operator=(std::locale const&) (in
/usr/lib/libstdc++.so.6.0.13)
==24122==    by 0x54FCC6E: std::ios_base::_M_init() (in
/usr/lib/libstdc++.so.6.0.13)
==24122==    by 0x55117C8: std::basic_ios<char, std::char_traits<char>
>::init(std::basic_streambuf<char, std::char_traits<char> >*) (in
/usr/lib/libstdc++.so.6.0.13)
==24122==    by 0x526D163: mysqlpp::Query::Query(mysqlpp::Connection*, bool,
char const*) (ostream:83)
==24122==    by 0x525CA4F: mysqlpp::Connection::query(char const*)
(connection.cpp:264)
==24122==    by 0x44152F: main (main.cc:29)
==24122==  Uninitialised value was created by a stack allocation
==24122==    at 0x4414AF: main (main.cc:22)
==24122==
==24122==
==24122== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- c
==24122==
==24122== Process terminating with default action of signal 11 (SIGSEGV)
==24122==  Bad permissions for mapped region at address 0x441699
==24122==    at 0x54FE181: std::locale::operator=(std::locale const&) (in
/usr/lib/libstdc++.so.6.0.13)
==24122==    by 0x54FCC6E: std::ios_base::_M_init() (in
/usr/lib/libstdc++.so.6.0.13)
==24122==    by 0x55117C8: std::basic_ios<char, std::char_traits<char>
>::init(std::basic_streambuf<char, std::char_traits<char> >*) (in
/usr/lib/libstdc++.so.6.0.13)
==24122==    by 0x526D163: mysqlpp::Query::Query(mysqlpp::Connection*, bool,
char const*) (ostream:83)
==24122==    by 0x525CA4F: mysqlpp::Connection::query(char const*)
(connection.cpp:264)
==24122==    by 0x44152F: main (main.cc:29)
==24122==
==24122== HEAP SUMMARY:
==24122==     in use at exit: 94,177 bytes in 69 blocks
==24122==   total heap usage: 119 allocs, 50 frees, 117,895 bytes allocated

I'd say this puts the error to the mysql++ side??

-Ina

2011/8/21 Ina J. <inarvaj@stripped>

> But the same code has been working without problems before the libstdc++6
> was updated. But any suggestions how to fix it?? Or avoid it?? Should I use
> the other constructor for a Query?? It's pretty obvious I have to create a
> query to get the data from the MySQL server.
>
> -Ina
>
>
> 2011/8/19 Jonathan Wakely <mysql@stripped>
>
>> On 19 August 2011 15:10, Linda Messerschmidt wrote:
>> > On Fri, Aug 19, 2011 at 7:18 AM, Ina J. <inarvaj@stripped> wrote:
>> >> The complain is coming from this line of my code:
>> >> mysqlpp::Query q = connection.query("SELECT * from Meter");
>> >> and the connection has been connected successfully earlier.
>> >
>> > I believe this is not correct.  Assigning something with a basic_ios
>> > inside never works.
>>
>> That isn't an assignment, it's a copy construction.
>>
>> > Try:
>> >
>> > mysqlpp::Query q(connection.query("SELECT * from Meter"));
>>
>> This is exactly equivalent.
>>
>> The error seems to indicate a race condition in the initialization of
>> the std::ios_base base class.  I've seen someone report a similar
>> error in that libstdc++ code before, but I think it's correct (I can't
>> see a problem anyway) so it could be user error, but I'm not sure.
>>
>
>

Thread
MySQL++ not working with libstdc++6Ina J.19 Aug
  • Re: MySQL++ not working with libstdc++6Linda Messerschmidt19 Aug
    • Re: MySQL++ not working with libstdc++6Jonathan Wakely19 Aug
      • Re: MySQL++ not working with libstdc++6Ina J.21 Aug
        • Re: MySQL++ not working with libstdc++6Ina J.22 Aug
          • Re: MySQL++ not working with libstdc++6Adrian Cornish22 Aug
            • Re: MySQL++ not working with libstdc++6Warren Young22 Aug
              • Re: MySQL++ not working with libstdc++6Adrian Cornish22 Aug
                • Re: MySQL++ not working with libstdc++6Ina J.23 Aug
                  • Re: MySQL++ not working with libstdc++6Ina J.23 Aug
                    • Re: MySQL++ not working with libstdc++6Jonathan Wakely23 Aug
                      • Re: MySQL++ not working with libstdc++6Ina J.23 Aug