0

I am trying to compile mysql_fdw found on github for PostgreSQL 9.5 on Win Server 2008R2 64bit machine.

I use Visual Studio 2012 with toolkit for 64bit systems.

First I installed Mysql C library. I was using steps provided here and the results were successful for the demo extension

http://blog.2ndquadrant.com/compiling-postgresql-extensions-visual-studio-windows/

and I also checked this blog https://www.scribd.com/document/40725510/Build-PostgreSQL-C-Functions-on-Windows

I am unsuccessful at building the mysql extension.

I have error at

mysql_fdw.c(186): error C2065: '_MYSQL_LIBNAME' : undeclared identifier

I am at loss at were the bug is. Is there somebody who can maybe kindly provide me with mysql_FDW precompiled dlls for win 2008R2 64bit and PostgreSQL 9.5. Please

Thank you

Jeca Techy
  • 21
  • 2

1 Answers1

0

_MYSQL_LIBNAME is defined in the Makefile (which you are not using with a MSVC build) and contains the name of the MySQL connector library. On Windows that would be "libmysql.dll".

You have two options:

  • Use the /D compiler switch to define a macro like this:

    /D_MYSQL_LIBNAME="\"libmysql.dll\""
    

    The “double escaping” is necessary because the value of _MYSQL_LIBNAME must contain double quotes.

  • Edit mysql_fdw.c and replace _MYSQL_LIBNAME with "libmysql.dll" (including the double quotes).

Good luck; unfortunately it is always a challenge to build C functions for PostgreSQL on Windows.
I don't even know if mysql_fdw works on Windows (the documentation is rather sparse, and this issue looks a little discouraging).

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
  • Thank you Laurenz, I added /D_MYSQL_LIBNAME="\"libmysql.dll\"" to compiler switch, and did change mysql_dll_handle = dlopen to LoadLibrary and dlsym to GetProcAddress but its not compiling. I have errors: IntelliSense: a value of type "FARPROC" cannot be assigned to an entity of type "bool (*)(MYSQL_STMT *stmt, MYSQL_BIND *bnd)"..:( – Jeca Techy Nov 03 '16 at 20:22
  • Try and open an issue on the Github page. – Laurenz Albe Nov 05 '16 at 12:36