dbTalk Databases Forums  

Cygwin/Win32/V2.0beta/library help! (MySQLC++ newbie)

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Cygwin/Win32/V2.0beta/library help! (MySQLC++ newbie) in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Patrick McMichael
 
Posts: n/a

Default Cygwin/Win32/V2.0beta/library help! (MySQLC++ newbie) - 08-01-2005 , 10:33 AM






All,
So I've been struggling with getting the v2.0 compiled on my
win32/cygwin build environment for about a week now, and decided that I
couldn't figure it out on my own. I've spent hours trying to get the dang
thing to work correctly, and just can't seem to make it work. I've searched
the mailing list archives but haven't found anything useful (yet - I will,
of course, as soon as I send this post find the perfect post to solve my
problems). The end desired product is to somehow link this into a project
that is being developed using Eclipse - but for now I just want it to work
after building it in the old 'configure', 'make', 'make install' way (saw
Warren's post on this last month so I won't make that mistake).
When I first downloaded the library I built it in Visual Studio in
about 2 minutes. Generated the release and debug dlls no problem, including
their appropriate "Exports Library File" and "C/C++ Inline File" - although
I can't find anyone who will tell me the difference between an Exports
Library File and Import Library File or what the purpose of the C/C++ Inline
File is (this probably gives me away as a newbie if my subject line didn't
already).
Then, pumped that everything was gonna work perfectly, went to build
it in cygwin, under bash. Alas, the configure script died when it got to
looking for the mysql client library business. I realized I had mysql
installed in an unusual location: C:\Program Files\MySQL\ or
/cygdrive/c/Program\ Files/, but it still wouldn't find those libraries even
after I put that path in (using the --with-mysql, --with-mysql-lib, and
--with-mysql-include switches).=20=20
Frustrated, I turned to the MySQL++ website and read the section on
how to twist MySQL++'s arm to get it to build under cygwin. I appreciate
whoever put that short description and links on how to do what he was
talking about up there, but it seems to be missing a few things, or perhaps
just outdated. First, the native windows installation no longer (if it ever
did) contains any dll with the word "client" in it, second it would be nice
for it to note somewhere that configure can't handle a path with a space in
it, no matter how many escapes you put on it (I recall running 'configure'
with the --with-mysql-lib=3D/cygdrive/c/Program\\\ Files/MySQL/lib/opt swit=
ch
at one point). So I followed the directions on the website on using
pexports to generate a definitions file, then using dlltool to generate an
import library '.a' file off the native dll (the only one I had in my mySQL
lib/opt directory was 'libmySQL.dll'). There is a mysqlclient.lib file that
I have no idea what could be used for, but at least has the word 'client' in
it. Once I had accomplished this, I had in my MySQL/lib/opt directory
'libmySQL.dll' and 'libmySQL.a' files - without pexports or dlltool
reporting to me that anything had gone awry. Trying configure yet again, it
still could not find the client library, so I copied and renamed both files
to 'libmysqlclient.dll' and 'libmysqlclient.a'. No dice. Copied everything
in the library directory to a path without spaces (now it is:
/cygdrive/c/mysql/lib/opt). Worked! Of course, had to copy the include files
there as well (/cygdrive/c/mysql/include), since (as I mentioned before)
configure can't seem to function with spaces in the path (snide comment that
it is SO 1990's for a program not to be able to handle spaces). So it
compiled and built all those examples just as I knew it could!
Re-animated about the possibility of achieving the initial goal
(using it in the Eclipse project), I grabbed the .a file I had used to get
the mysql++.dll to compile and added it to the test project I was working on
(in Eclipse). Compiled and built, no more linker errors! Unfortunately, my
hopes were dashed as when I tried to run the program it segfaulted as soon
as it got to the first MySQL++ object (a mysqlpp::Connection type object).
So, I went back to the examples and everyone of them segfaults as well.
Thinking maybe it was a "can't find the dll" segfault, I copied all the dlls
I had to the C:\Windows\System32 directory (in my PATH environment
variable). The dlls I copied were: libmySQL.dll, it's copy
libmysqlclient.dll, and mysql++.dll (freshly successfully? compiled).
At wits end, with no where to go.
Anyone got any ideas?

Thanks,

-Patrick McMichael


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Cygwin/Win32/V2.0beta/library help! (MySQLC++ newbie) - 08-01-2005 , 01:37 PM






Patrick McMichael wrote:
Quote:
I can't find anyone who will tell me the difference between an Exports
Library File and Import Library File
I've never heard of an "exports library file".

An import library is a small library that tells the linker how to link
against a DLL. Think of it as details about a DLL's interface distilled
down into a .lib (or in the case of Cygwin, .a) file.

Quote:
what the purpose of the C/C++ Inline File
I don't know what that is, either. Where do you see that?

Quote:
I realized I had mysql
installed in an unusual location: C:\Program Files\MySQL\
I'd recommend putting it somewhere without spaces in the path, if you're
going to use this with Cygwin. I like c:\mysql, personally.

Quote:
it still wouldn't find those libraries even
after I put that path in (using the --with-mysql, --with-mysql-lib, and
--with-mysql-include switches).
It can't find the import library, or the headers, then.

Quote:
Frustrated, I turned to the MySQL++ website and read the section on
how to twist MySQL++'s arm to get it to build under cygwin. I appreciate
whoever put that short description and links on how to do what he was
talking about up there, but it seems to be missing a few things,
I've rewritten it. It should be crystal clear now.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Patrick McMichael
 
Posts: n/a

Default RE: Cygwin/Win32/V2.0beta/library help! (MySQLC++ newbie) - 08-02-2005 , 05:21 PM



(Sorry Warren, just realized I forgot to send this to the whole list...)

Warren,

Thanks for getting back to me, and for updating the cygwin build
instructions, all very helpful. I think, though, I am still missing
something (or maybe even a whole number of things). My misunderstandings on
libraries aside, which type (dynamically linked or static) of library is
generated by default with configure/make? The configure command says that
by default it builds a --enable-shared=3Dyes library, which I would assume =
is
either going to be a .so or a .dll, right? When I follow your instructions
to the 't' everything works perfectly, and all my examples get built without
errors, but I can't find a ".dll" or a ".so" anywhere! All I see are .exe's
in the example directory, .o's in the lib directory and in lib/.libs I find:
libmysqlpp.a, libmysqlpp.la and libmysqlpp.lai. I would guess that the
libmysqllpp.a file is my MySQL++ library compiled for cygwin, but isn't '.a'
a static library file extension? And I can't use a static library in a
commercial application, can I? The other two files '.la' and '.lai' are
ASCII and are virtually identical, claiming to be 'libtool library' files.

Needless to say, if it is a static library, then it should have been
compiled into the example apps, and none of the example apps run; they all
segfault (I only tried 3 or 4 of them, usequery, simple1, simple2, etc).

Part of my problem I think is that I don't really understand libraries on
either Win32 OR Unix/Linux, and I'm trying to learn them in Cygwin, which is
like a hodgepodge of the two....

Hey, I liked the "twist it's arm" expression, sorry to see it go..

Which MinGW utilities are used? If it's only pexports it can easily be
downloaded, and extracted to the C:\cygwin\bin directory from here (no
building required):

http://www.emmestech.com/software/cy...d_pexports.htm
l

The "libmysql.dll" has to be somewhere in the path, correct? I am assuming
that copying the dll to something like "C:\WINDOWS\system32" or prepending
"C:\mysql\lib\opt" to the PATH variable is acceptable to accomplish this?
I've done both, but neither seems to be working.


Quote:
I can't find anyone who will tell me the difference between an Exports
Library File and Import Library File

I've never heard of an "exports library file".

An import library is a small library that tells the linker how to link=20
against a DLL. Think of it as details about a DLL's interface distilled=
=20
down into a .lib (or in the case of Cygwin, .a) file.

what the purpose of the C/C++ Inline File=20

I don't know what that is, either. Where do you see that?
Regarding the "Exports Library File" and the "C/C++ Inline File" these are
the file types given by Windows to the ".exp" and ".lib" files respectively
when I build MySQL++ under VS .NET 7.1. When I hit build in Visual Studio,
it builds "mysql++.dll", "mysql++.exp", and "mysql++.lib" files along with
all the individual ".obj" object files. None of them are ASCII, but I
assume they each have a purpose.

Also, I've tried running pexports and dlltool on the MySQL++ .dll I
generated with Visual Studio, but it causes dlltool to crash. Bummer.

Thanks again for the help, and any further assistance you could offer would
be of great value.

-Patrick McMichael


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
Warren Young
 
Posts: n/a

Default Re: Cygwin/Win32/V2.0beta/library help! (MySQLC++ newbie) - 08-04-2005 , 01:14 PM



--------------070500020204040503050408
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Warren Young wrote:
Quote:
for now, you're going to have to force it to use static libraries,
I've been chasing this on the Cygwin mailing list. Some kind folk there
have given me the clues necessary to get the library building using
shared objects. It even runs, for a sufficiently restricted definition
of "runs".



First, you need to build MySQL from source. I had the best luck with
4.1. You must give the "--without-server" configure flag, because a)
you only need the client libraries; and b) the server doesn't build
correctly under Cygwin anyway. Say "make install" once it's built.

Second, you need to go into /usr/local/lib/mysql (assuming you let it
install in the default location) and give this monster of a command:

gcc -shared -o cygmysqlclient-4.1.13.dll \
-Wl,--out-implib=libmysqlclient.dll.a -Wl,--export-all-symbols \
-Wl,--enable-auto-import -Wl,--whole-archive libmysqlclient.a \
-Wl,--no-whole-archive -lcrypt -lz

Then, apply the attached patch to MySQL++.

Having applied that, you will need to run MySQL++'s bootstrap script.
Partly this integrates the patch changes, and partly it updates the
tarball versions of scripts like libtool with Cygwin-aware versions.

Finally, you're ready to build MySQL++. It should build just fine. But
you'll find that the example programs hang, hard. Simple1, for
instance, hangs on line 199 of examples/util.cpp, during a return from
Query::store(const char*)! I think there's some compiler or binutils
type of problem here, but I could be wrong.



I'm posting this saga in case someone (Patrick?) wants to try debugging
this further. Me, I'm finished unless someone else comes up with
something. I've fought this damned thing for days now, and I don't even
use Cygwin for this. Time to move on.

"program, vt.: To engage in a pastime similar to banging one's head
against a wall, but with fewer opportunies for reward." -- The Jargon File

--------------070500020204040503050408
Content-Type: text/plain;
name="cygwin-mysqlpp.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="cygwin-mysqlpp.patch"

Index: common.am
================================================== =================
--- common.am (revision 1000)
+++ common.am (working copy)
@@ -1,4 +1,4 @@
INCLUDES = -I$(top_srcdir)/lib
-LIBS = -lz -l@MYSQL_C_LIB@
+LIBS = -lz -lmysqlclient.dll

MYSQLPP_LIB = $(top_builddir)/lib/libmysqlpp.la
Index: lib/Makefile.am
================================================== =================
--- lib/Makefile.am (revision 1000)
+++ lib/Makefile.am (working copy)
@@ -22,7 +22,7 @@

lib_LTLIBRARIES=libmysqlpp.la

-libmysqlpp_la_LDFLAGS=-version-info @MYSQLPP_LIBTOOL_VERSION@
+libmysqlpp_la_LDFLAGS=-version-info @MYSQLPP_LIBTOOL_VERSION@ -no-undefined

libmysqlpp_la_SOURCES = \
coldata.cpp connection.cpp datetime.cpp fields.cpp field_names.cpp \


--------------070500020204040503050408
Content-Type: text/plain; charset=us-ascii


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw
--------------070500020204040503050408--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.