[freetds] Compiling FreeTDS under Windows (howto & question)

Eloy Lafuente stronk7 at moodle.org
Mon Mar 2 04:00:55 EST 2009


James K. Lowden escribió:
> Eloy Lafuente wrote:
>> I've tried to build the PHP extension (dblib.dll) and 
>> have ended with this error:
>>
>> unresolved external symbol _hmac_md5
>>
>> To fix that, I've added the hmac_md5.c and hmac_md5.h to the 
>>   libTDS project sources/includes and, after rebuilding 
>> dblib.lib, PHP dll has been created properly.
> 
> I'm a little confused.  What is the name of the FreeTDS library in 
> Windows, the way you're building it?  And what is the name of the PHP
> extension?  
> 
> hmac_md5 is used for domain logins.  It should be included in whatever
> FreeTDS builds; you can use dumpbin.exe to check.  
> 

Well I really don't know too much about Windows compilers 
and so on. I just know that there is (for MSVC6) one 
"Project Workspace" that right now "contains" three projects:

- FreetTDS.dsp
- LibTDS.dsp
- dblib.dsp

And, by "Building All" in that workspace, I end with one 
dblib.lib that is used later in PHP configure/nmake to end 
with one working dblib.dll PHP shared extension.

Curiously I was able to "build all" perfectly in the freetds 
workspace and only later, when compiling the PHP shared 
extension I got the error about _hmac_md5.

Hence, I added it to the LibTDS.dsp project, rebuilt 
everything again and then PHP didn't gave the error. Note 
the other 2 projects haven't that file.

If it helps, I can send the modified project/workspace files.

>> Just guessing if adding hmac_md5.* to the libTDS project (as 
>> I've done) is the correct way to fix the problem and if that 
>> should be also in the post patch.
> 
> Yes, what you did is roughly right.  Reading between the lines, it's
> likely hmac_md5.c was added to the source tree after the .dsp file you're
> using was created. I don't know how to add it to the patch, though;
> Microsoft's project files are proprietary and fragile.  
> 
> I've worked out a giant makefile.win32 that builds everything under the
> control of nmake.exe.  That should be more stable across compiler
> versions.  I'll add it as soon as I'm convinced it works, or if someone
> expresses interest, whichever comes first.  
> 

Well, if it helps and make things easier (no more MSVC6 
frontend) I can test that here, as far as the objective of 
building that dblib.dll (to use it later to build PHP ext) 
is covered by the Makefile (both debug & release). It could 
make the process easier (at least for me), with everything 
(freetds, php...) under CMD control.

Not sure if I'm able to test other parts like ODBC or 
whatever (note I'm a Mac/Unix user that only have used 
windows occasionally) ;-)

Ciao :-)


More information about the FreeTDS mailing list