List:MySQL++« Previous MessageNext Message »
From:Nils Mangelsen Date:April 14 2004 6:59pm
Subject:unexplainable problem with mysql++: all programs create a segmentation
fault
View as plain text  
Hi,

this is my first try to use a mailinglist and I hope it works.

I'm writing because I've got a huge problem with mysql++ and can not figure out 
how to solve it :(

I'm a programmer and sometimes also an administrator of the browsergame 
"vinsels" (http://vinsels.de) and we used up to now the mysql++-API for the 
program which calculates one time per hour the ticks of the game. Now we have 
got a new server running with Debian 3.0 woody and we do not get any programs 
using mysql++ running :/

Because it has been everytime hard to get mysql++ compiled and to get programs 
using mysql++ get compiled I testet everything at home before I tried to install 
it on the server. Thus I set up Debian about ten times within the last two weeks 
and tried about 20 times to get programs with mysql++ running. In the end I 
thought everything must work well because I was able to compile and install 
mysql++ and I was also able to compile programs using mysql++. But there is one 
problem: I never tested wheter the compiled programs also work - and they don't...

I'll first explain which commands I exactly ran to compile and install mysql++:

The system is at the beginning Debian 3.0 woody with an mysql-server already 
installed and running.
I made no further changes after the installation of Debian.
Here are the commands I used:

step 1 - installing two libs that are needed to compile mysql++:

1.1: apt-get install libmysqlclient10-dev
1.2: apt-get install zlib1g-dev

step 2 - I found out that Debian woody comes with gcc 3.0 but without g++ 3.0 so 
I installed it:

2.1: apt-get install g++-3.0

step 3 - the standard compiler of woody is gcc 2.95 so we have to create new 
links in /usr/bin to use version 3.0:

3.1: unlink /usr/bin/gcc
3.2: ln -s /usr/bin/gcc-3.0 /usr/bin/gcc
3.3: unlink /usr/bin/g++
3.4: ln -s /usr/bin/g++-3.0 /usr/bin/g++

step 4 - installing wget and download the needed files (I downloaded all three 
patches because I later tested other versions of gcc):

4.1: apt-get install wget

4.2: wget 
"http://dev.mysql.com/get/Downloads/mysql++/mysql++-1.7.9.tar.gz/from/http://sunsite.informatik.rwth-aachen.de/mysql/"
4.3: wget 
"http://dev.mysql.com/get/Downloads/mysql++/mysql++-gcc-3.0.patch.gz/from/http://sunsite.informatik.rwth-aachen.de/mysql/"
4.4: wget 
"http://dev.mysql.com/get/Downloads/mysql++/mysql++-gcc-3.2.patch.gz/from/http://sunsite.informatik.rwth-aachen.de/mysql/"
4.5: wget 
"http://dev.mysql.com/get/Downloads/mysql++/mysql++-gcc-3.2.2.patch.gz/from/http://ftp.gwdg.de/pub/misc/mysql/"

step 5 - unpacking:

5.1: tar xzvf mysql++-1.7.9.tar.gz
5.2: gunzip mysql++-gcc-3.0.patch.gz
5.3: gunzip mysql++-gcc-3.2.patch.gz
5.4: gunzip mysql++-gcc-3.2.2.patch.gz

step 6 - patching:

6.1: patch -p1 -d mysql++-1.7.9 < mysql++-gcc-3.0.patch

step 7 - compilation and installation:

7.1: cd mysql++-1.7.9
7.2: automake
7.3: autoconf
7.4: ./configure
7.5: make
7.6: make install
7.7: echo '/usr/local/lib' >> /etc/ld.so.conf
7.8: ldconfig

Now mysql++ is installed (everything works well up to this point).

step 8 - writing a little program to test it:

#include "/usr/local/include/sqlplus.hh"
 

int main()
         {
         Connection con("test"); //I also tried Connection 
con("test","localhost","user","password");
 

         return(0);
         }

step 9 - compiling the test program:

9.1: g++ -o mysqltest mysqltest.cpp -I /usr/include/sqlplus/ -I 
/usr/include/mysql/ -L /usr/local/lib -lsqlplus

step 10 - running the test program:

10.1: ./mysqltest

The only output is this:
Segmentation fault



This is the point where I began trying different versions of gcc and g++.

Above described is 3.0 with mysql++ and patch for 3.0.

Then I installed 3.3.3 and tried to compile mysql++ with all three patches (3.0, 
3.2, 3.2.2) but I didn't compile (any error during "make").

So I installed 3.2.3 and tried to compile mysql++ with all three patches (3.0, 
3.2, 3.2.2) - successful but when I try to run the test program (after I 
compiled it) it again creates only a segmentation fault.

Then I uninstalled mysql++ and tried to install it with apt-get: "apt-get 
install libsqlplus-dev".
I had to modifiy the first line of the test program and also the command to 
compile it. Then I was able to compile the test program but when I started it I 
also only got a "Segmentation fault".

So I ended up uninstalling it ("apt-get remove libsqlplus-dev") and tried again 
compiling mysql++ without any patches with gcc 2.95. It worked and I compiled my 
test program. But when I run it I get this error: "./mysqltest: relocation 
error: ./mysqltest: undefined symbol: __15MysqlConnectionPCcN31b"

This is the first time I get no segmentation fault - but this error is not less 
confusing :(



I began thinking that the mysql-server could be the problem and looked at the 
/etc/mysql/my.cnf. I found a line "skip-networking" and changed it to 
"#skip-networking" but it didn't help so I changed it back to "skip-networking" 
(yes I restarted mysqld after any changes :).



I am a little bit pressed for time and I just don't know why it doesn't work.
Would by very nice if somebody can help me :D

With kind regards
Nils Mangelsen

Thread
unexplainable problem with mysql++: all programs create a segmentationfaultNils Mangelsen14 Apr
  • Re: unexplainable problem with mysql++: all programs create a segmentationfaultSinisa Milivojevic20 Apr