FAQ
Hello!
I'm trying to use Mingw32 to compile windows application using
wxWidgets and mysql++.
I've successfully compiled wxWidgets with mingw and I want to compile mysql++.
But I get an error that socket library is missing.
Code:

leonti@linux-ep9z:~/proba/mysql++-3.0.9> ./configure
prefix=/usr/i686-pc-mingw32 --host=i686-pc-mingw32
--build=`./config.guess` --disable-shared
checking build system type... x86_64-unknown-linux-gnu
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for i686-pc-mingw32-gcc... i686-pc-mingw32-gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-pc-mingw32-gcc accepts -g... yes
checking for i686-pc-mingw32-gcc option to accept ANSI C... none needed
checking whether we are using the Intel C compiler... no
checking for i686-pc-mingw32-g++... i686-pc-mingw32-g++
checking whether we are using the GNU C++ compiler... yes
checking whether i686-pc-mingw32-g++ accepts -g... yes
checking whether we are using the Intel C++ compiler... no
checking whether we are using the Sun C++ compiler... no
checking for i686-pc-mingw32-ranlib... i686-pc-mingw32-ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... yes
checking for i686-pc-mingw32-ar... i686-pc-mingw32-ar
checking for i686-pc-mingw32-strip... i686-pc-mingw32-strip
checking for i686-pc-mingw32-nm... i686-pc-mingw32-nm
checking for command to install directories... /usr/bin/install -c -d
checking if make is GNU make... yes
checking for dependency tracking method... gcc
checking for i686-pc-mingw32-windres... i686-pc-mingw32-windres
checking for i686-pc-mingw32-gcc... (cached) i686-pc-mingw32-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether i686-pc-mingw32-gcc accepts -g... (cached) yes
checking for i686-pc-mingw32-gcc option to accept ANSI C... (cached) none needed
checking how to run the C preprocessor... i686-pc-mingw32-gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking whether -lm is needed to use C math functions... no
checking whether -lsocket is needed... configure: error: failed to
link using -lsocket!

I tried to install more mingw32 packages (on Opensuse 11.1) I thought
were relevant but it didn't help.
Did anyone have any success compiling mysql++ on linux with mingw32?

Leonti

Search Discussions

  • Jonathan Wakely at Nov 5, 2009 at 7:07 pm

    2009/11/5 Leonti Bielski:
    But I get an error that socket library is missing.
    I could be wrong but I don't think that's what the error means, look
    in config.log to see more detail.
    checking whether -lsocket is needed... configure: error: failed to
    link using -lsocket!
  • Warren Young at Nov 5, 2009 at 7:16 pm

    Leonti Bielski wrote:
    But I get an error that socket library is missing.
    Code:

    leonti@linux-ep9z:~/proba/mysql++-3.0.9> ./configure
    Don't use 'configure' on MinGW. Read README-MinGW.txt, which explains
    the correct build procedure.
  • Leonti Bielski at Nov 5, 2009 at 7:59 pm
    I thought if I compile it under linux I have to configure with --host changed.

    Now I tried to run 'make' and I get this error:

    make -f Makefile.mingw
    i686-pc-mingw32-g++ -c -o mysqlpp_beemutex.o -g -mthreads -DUNICODE
    -D_UNICODE -DMYSQLPP_NO_DLL -DHAVE_MYSQL_SSL_SET
    -I"/home/leonti/proba/mysql-5.1.40-win32/include"
    -MTmysqlpp_beemutex.o -MFmysqlpp_beemutex.o.d -MD -MP lib/beemutex.cpp
    make: -c: Command not found
    make: *** [mysqlpp_beemutex.o] Error 127

    I really don't want to install Windows just to compile a couple of programs :(

    Leonti
    On Thu, Nov 5, 2009 at 8:16 PM, Warren Young wrote:
    Leonti Bielski wrote:
    But I get an error that socket library is missing.
    Code:

    leonti@linux-ep9z:~/proba/mysql++-3.0.9> ./configure
    Don't use 'configure' on MinGW.  Read README-MinGW.txt, which explains the
    correct build procedure.

    --
    MySQL++ Mailing List
    For list archives: http://lists.mysql.com/plusplus
    To unsubscribe:    http://lists.mysql.com/plusplus?unsub=prishelec@gmail.com
  • Leonti Bielski at Nov 5, 2009 at 9:52 pm
    Another reason why I thought I should use ./configure is that it
    worked for wxWidgets:
    http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux

    I'm not sure how this whole --host thing works, but I guess it doesn't
    take into account that I don't need sockets if I'm building for
    Windows.
    I disabled the check by manually editing configure file.
    But now I'm running into another error:
    checking whether -lsocket is needed... checking whether -lnsl is
    needed... checking for MySQL library directory... /usr/lib64
    checking for MySQL include directory... /usr/include/mysql
    checking if we can link to MySQL C API library directly... no
    checking zlib.h usability... yes
    checking zlib.h presence... yes
    checking for zlib.h... yes
    checking for gzread in -lz... yes
    checking whether adding -lz will let MySQL C API link succeed... no
    configure: error: Unable to link to MySQL client library!

    How do I tell configure to look for mysql libs in another directory?

    Thanks.
    Leonti

    On Thu, Nov 5, 2009 at 8:58 PM, Leonti Bielski wrote:
    I thought if I compile it under linux I have to configure with --host changed.

    Now I tried to run 'make' and I get this error:

    make -f Makefile.mingw
    i686-pc-mingw32-g++ -c -o mysqlpp_beemutex.o -g -mthreads -DUNICODE
    -D_UNICODE -DMYSQLPP_NO_DLL -DHAVE_MYSQL_SSL_SET
    -I"/home/leonti/proba/mysql-5.1.40-win32/include"
    -MTmysqlpp_beemutex.o -MFmysqlpp_beemutex.o.d -MD -MP lib/beemutex.cpp
    make: -c: Command not found
    make: *** [mysqlpp_beemutex.o] Error 127

    I really don't want to install Windows just to compile a couple of programs :(

    Leonti
    On Thu, Nov 5, 2009 at 8:16 PM, Warren Young wrote:
    Leonti Bielski wrote:
    But I get an error that socket library is missing.
    Code:

    leonti@linux-ep9z:~/proba/mysql++-3.0.9> ./configure
    Don't use 'configure' on MinGW.  Read README-MinGW.txt, which explains the
    correct build procedure.

    --
    MySQL++ Mailing List
    For list archives: http://lists.mysql.com/plusplus
    To unsubscribe:    http://lists.mysql.com/plusplus?unsub=prishelec@gmail.com
  • Jim Graf at Nov 5, 2009 at 10:16 pm

    On Thu, Nov 5, 2009 at 1:52 PM, Leonti Bielski wrote:

    Another reason why I thought I should use ./configure is that it
    worked for wxWidgets:

    http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux

    I'm not sure how this whole --host thing works, but I guess it doesn't
    take into account that I don't need sockets if I'm building for
    Windows.
    I disabled the check by manually editing configure file.
    But now I'm running into another error:
    checking whether -lsocket is needed... checking whether -lnsl is
    needed... checking for MySQL library directory... /usr/lib64
    checking for MySQL include directory... /usr/include/mysql
    checking if we can link to MySQL C API library directly... no
    checking zlib.h usability... yes
    checking zlib.h presence... yes
    checking for zlib.h... yes
    checking for gzread in -lz... yes
    checking whether adding -lz will let MySQL C API link succeed... no
    configure: error: Unable to link to MySQL client library!

    How do I tell configure to look for mysql libs in another directory?

    Thanks.
    Leonti

    On Thu, Nov 5, 2009 at 8:58 PM, Leonti Bielski wrote:
    I thought if I compile it under linux I have to configure with --host changed.
    Now I tried to run 'make' and I get this error:

    make -f Makefile.mingw
    i686-pc-mingw32-g++ -c -o mysqlpp_beemutex.o -g -mthreads -DUNICODE
    -D_UNICODE -DMYSQLPP_NO_DLL -DHAVE_MYSQL_SSL_SET
    -I"/home/leonti/proba/mysql-5.1.40-win32/include"
    -MTmysqlpp_beemutex.o -MFmysqlpp_beemutex.o.d -MD -MP lib/beemutex.cpp
    make: -c: Command not found
    make: *** [mysqlpp_beemutex.o] Error 127

    I really don't want to install Windows just to compile a couple of
    programs :(
    Leonti
    On Thu, Nov 5, 2009 at 8:16 PM, Warren Young wrote:
    Leonti Bielski wrote:
    But I get an error that socket library is missing.
    Code:

    leonti@linux-ep9z:~/proba/mysql++-3.0.9> ./configure
    Don't use 'configure' on MinGW. Read README-MinGW.txt, which explains
    the
    correct build procedure.

    --
    MySQL++ Mailing List
    For list archives: http://lists.mysql.com/plusplus
    To unsubscribe:
    http://lists.mysql.com/plusplus?unsub=prishelec@gmail.com

    jgraf@gr-icad11 [518]$ gtar -zxf mysql++-3.0.8.tar.gz
    cd mysql++-3.0.8
    jgraf@gr-icad11 [519]$ cd mysql++-3.0.8
    jgraf@gr-icad11 [520]$ ./configure --help|grep -i mysql
    `configure' configures mysql++ 3.0.8 to adapt to many kinds of systems.
    --with-mysql=<path> root directory path of MySQL installation
    --with-mysql-lib=<path> directory path of MySQL library installation
    --with-mysql-include=<path> directory path of MySQL header installation

    for example:

    --with-mysql=/proj/dataprep/jgdata/local/MySQL/mysql

    and
    ls /proj/dataprep/jgdata/local/MySQL/mysql
    bin/ include/ lib/ libexec/ mysql-test/ share/ sql-bench/

    good luck,
    jim
  • Warren Young at Nov 5, 2009 at 10:22 pm

    On Nov 5, 2009, at 12:58 PM, Leonti Bielski wrote:

    I thought if I compile it under linux I have to configure with --
    host changed.
    I didn't see that you're trying to cross-compile.

    I have no advice for you in that case. I haven't used a GCC cross-
    compiler since I was writing PalmOS programs, and I don't remember
    seeing anything on this list, ever, from someone who tried it. No
    doubt it can be done, but you're pioneering.

    If I had to build Windows programs while running Linux, I'd just set
    up a Windows VM.
  • Wahyu Arm at Nov 6, 2009 at 1:44 am
    What version of MinGW are you using? .

    Try to compile mysql + + with MinGW version of windows that run with Wine.
  • Leonti Bielski at Nov 6, 2009 at 2:26 am

    On Fri, Nov 6, 2009 at 10:48 AM, Wahyu Arm wrote:
    What version of MinGW are you using? .

    Try to compile mysql + + with MinGW version of windows that run with Wine.
    Yeah, that's what I did. I just installed Windows version of Mingw
    under Wine and it compiled.
    Not exactly hat I planned but it works :)

    Thank you for your help!

    Leonti
  • Warren Young at Nov 6, 2009 at 7:38 pm

    Leonti Bielski wrote:
    I just installed Windows version of Mingw
    under Wine and it compiled.
    Interesting. I'll add it to the README.

    I assume this means Wine also provides cmd.exe?
  • Leonti Bielski at Nov 6, 2009 at 7:51 pm
    Yeah, steps I made:
    1. Installed MinGW with official installer for windows running:
    wine MinGW*
    2. Added mingw dir to PATH with wine regedit:
    http://www.winehq.org/site/docs/wineusr-guide/environment-variables
    3. I could install mysql under Wine too, but I just downloaded version
    without the installer, and unpacked it.
    4. Modified makefile.gcc to match the directories
    5. Created libmysqlclient.a
    wine mingw32-dlltool -k -d /path/to/mysql++/dir/libmysqlclient.def -l
    libmysqlclient.a
    6. wine mingw32-make -f makefile.gcc and got the library.

    Compiled my programs that use mysql++ library using 'wine
    mingw32-make' and they work as intended.
    And this all without running Windows even in virtual machine :)
    Hope it helps someone in a future!

    Leonti
    On Fri, Nov 6, 2009 at 8:37 PM, Warren Young wrote:
    Leonti Bielski wrote:
    I just installed Windows version of Mingw
    under Wine and it compiled.
    Interesting.  I'll add it to the README.

    I assume this means Wine also provides cmd.exe?

    --
    MySQL++ Mailing List
    For list archives: http://lists.mysql.com/plusplus
    To unsubscribe:    http://lists.mysql.com/plusplus?unsub=prishelec@gmail.com
  • Warren Young at Nov 6, 2009 at 8:54 pm

    Leonti Bielski wrote:
    4. Modified makefile.gcc to match the directories
    Hm! You used Makefile.gcc, not Makefile.mingw? If so, that explains
    why you didn't need cmd.exe.

    It would be interesting if you tried using the .mingw version, too. A
    little Googling shows there is a Wine version of cmd.exe, but that it
    might be somewhat broken:

    http://wiki.jswindle.com/index.php/Cmd

    The question is whether it's broken in ways that impact MySQL++.
    Hope it helps someone in a future!
    Me, too. I'm adding an expanded version of your instructions to
    README-MinGW.txt.
  • Leonti Bielski at Nov 6, 2009 at 9:10 pm
    I'm sorry - I used Makefile.mingw. Sorry for the confusion.

    I didn't need cmd for that, just wine mingw32-make did the trick.
    Maybe when you launch command-line application with wine, it emulates cmd?

    Leonti
    On Fri, Nov 6, 2009 at 9:53 PM, Warren Young wrote:
    Leonti Bielski wrote:
    4. Modified makefile.gcc to match the directories
    Hm!  You used Makefile.gcc, not Makefile.mingw?  If so, that explains why
    you didn't need cmd.exe.

    It would be interesting if you tried using the .mingw version, too.  A
    little Googling shows there is a Wine version of cmd.exe, but that it might
    be somewhat broken:

    http://wiki.jswindle.com/index.php/Cmd

    The question is whether it's broken in ways that impact MySQL++.
    Hope it helps someone in a future!
    Me, too.  I'm adding an expanded version of your instructions to
    README-MinGW.txt.

    --
    MySQL++ Mailing List
    For list archives: http://lists.mysql.com/plusplus
    To unsubscribe:    http://lists.mysql.com/plusplus?unsub=prishelec@gmail.com
  • Warren Young at Nov 6, 2009 at 9:18 pm

    Leonti Bielski wrote:
    I'm sorry - I used Makefile.mingw. Sorry for the confusion.
    No problem. Would you look over this final set of instructions, to see
    if I've interpreted it all correctly?
    Building on Linux
    ~~~~~~~~~~~~~~~~~
    You might need to build Windows executables while not actually
    running Windows. You might think to use MinGW, being a port
    of GCC, the standard compiler on almost every non-Windows OS
    these days.

    The best way to do this is to run MinGW under either Wine or
    some sort of virtual machine running an actual copy of Windows.
    Leonti Bielski provided these instructions for the Wine method:

    1. Install MinGW through Wine:

    $ wine MinGW-5.1.6.exe

    2. Add the MinGW directory to Wine's PATH with Wine regedit:

    http://winehq.org/site/docs/wineusr-guide/environment-variables

    3. Install MySQL under Wine, or at least unpack the Windows
    ZIP file version of MySQL in a place where Wine can find it.
    You don't need to run a Windows MySQL server under Wine.
    We're only doing this to get the MySQL C API library and
    its headers, which MySQL++ builds against. The resulting
    MinGW build of MySQL++ can talk to a native MySQL server
    out in Wine's host environment or on some other machine.

    4. Modify Makefile.mingw to match the install location for
    the MySQL C API files.

    5. Create libmysqlclient.a as described above, except with
    minor differences for running under Wine:

    $ wine mingw32-dlltool -k -d /native/path/libmysqlclient.def...

    6. Build MySQL++ with:

    $ wine mingw32-make -f Makefile.mingw

    You might think it would be simpler to just use a MinGW
    cross-compiler. Unfortunately, this doesn't currently work:

    $ ./configure --target=mingw32
    $ make

    The reason is that our autoconf build system assumes a
    typical POSIX type target, which MinGW is not. We made this
    assumption because we have a perfectly good MinGW build option,
    Makefile.mingw. But, that also won't work on a POSIX system
    because that Makefile assumes external commands run under cmd.exe,
    not some Unixy shell. Thus the advice to build with Makefile.mingw
    under Windows or something sufficiently close to it.

    If you really wanted to, you could extend the autoconf build system
    to make it realize when it's being used to cross-compile for MinGW.
    Patches thoughtfully considered; see HACKERS.txt.
  • Leonti Bielski at Nov 6, 2009 at 9:36 pm

    On Fri, Nov 6, 2009 at 10:17 PM, Warren Young wrote:
    Leonti Bielski wrote:
    I'm sorry - I used Makefile.mingw. Sorry for the confusion.
    No problem.  Would you look over this final set of instructions, to see if
    I've interpreted it all correctly?
    Building on Linux
    ~~~~~~~~~~~~~~~~~
    You might need to build Windows executables while not actually
    running Windows.  You might think to use MinGW, being a port
    of GCC, the standard compiler on almost every non-Windows OS
    these days.

    The best way to do this is to run MinGW under either Wine or
    some sort of virtual machine running an actual copy of Windows.
    Leonti Bielski provided these instructions for the Wine method:

    1. Install MinGW through Wine:

    $ wine MinGW-5.1.6.exe

    2. Add the MinGW directory to Wine's PATH with Wine regedit:

    http://winehq.org/site/docs/wineusr-guide/environment-variables

    3. Install MySQL under Wine, or at least unpack the Windows
    ZIP file version of MySQL in a place where Wine can find it.
    You don't need to run a Windows MySQL server under Wine.
    We're only doing this to get the MySQL C API library and
    its headers, which MySQL++ builds against.  The resulting
    MinGW build of MySQL++ can talk to a native MySQL server
    out in Wine's host environment or on some other machine.

    4. Modify Makefile.mingw to match the install location for
    the MySQL C API files.

    5. Create libmysqlclient.a as described above, except with
    minor differences for running under Wine:

    $ wine mingw32-dlltool -k -d /native/path/libmysqlclient.def...

    6. Build MySQL++ with:
    $ wine mingw32-make -f Makefile.mingw

    You might think it would be simpler to just use a MinGW
    cross-compiler.  Unfortunately, this doesn't currently work:

    $ ./configure --target=mingw32
    $ make

    The reason is that our autoconf build system assumes a
    typical POSIX type target, which MinGW is not.  We made this
    assumption because we have a perfectly good MinGW build option,
    Makefile.mingw.  But, that also won't work on a POSIX system
    because that Makefile assumes external commands run under cmd.exe,
    not some Unixy shell.  Thus the advice to build with Makefile.mingw
    under Windows or something sufficiently close to it.

    If you really wanted to, you could extend the autoconf build system
    to make it realize when it's being used to cross-compile for MinGW.
    Patches thoughtfully considered; see HACKERS.txt.

    --
    MySQL++ Mailing List
    For list archives: http://lists.mysql.com/plusplus
    To unsubscribe:    http://lists.mysql.com/plusplus?unsub=prishelec@gmail.com
    Yeap, the instructions are correct. That's exactly what I did.
    Thank you for including me there :)

    Leonti

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupplusplus @
categoriesmysql
postedNov 5, '09 at 6:49p
activeNov 6, '09 at 9:36p
posts15
users5
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2022 Grokbase