Issue 8127 - 32 bit windows build fails with mingw
Summary: 32 bit windows build fails with mingw
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: build (show other issues)
Version: 2.4.40
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-05 11:54 UTC by frank.offermanns@caseris.de
Modified: 2015-07-02 17:43 UTC (History)
0 users

See Also:


Attachments
0001-ftello-compat-for-windows-slapadd-meter.patch (704 bytes, patch)
2015-05-05 18:37 UTC, ebackes@symas.com
Details

Note You need to log in before you can comment on or make changes to this issue.
Description frank.offermanns@caseris.de 2015-05-05 11:54:21 UTC
Full_Name: Frank Offermanns
Version: 2.4.40
OS: Windows
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (217.7.149.50)


Build fails for 32 bit  msys/mingw (and config --prefix=/mingw
--enable-accesslog --with-tls --enable-syncprov)
Probably only 32 bit windows build has this error. 

slapadd.o: In function `getrec0':
C:/msys/1.0/openldap-2.4.41Git/servers/slapd/slapadd.c:116: undefined reference
to `ftello'
slapadd.o: In function `slapadd':
C:/msys/1.0/openldap-2.4.41Git/servers/slapd/slapadd.c:486: undefined reference
to `ftello'
libbackends.a(mdbmdb.o): In function `mdb_cursor_push':
C:/msys/1.0/openldap-2.4.41Git/servers/slapd/back-mdb/./../../../libraries/liblm
db/mdb.c:5001: undefined reference to `GetFileSizeEx'
collect2: ld returned 1 exit status
make[2]: *** [slapd.exp] Error 1
make[2]: Leaving directory `/openldap-2.4.41Git/servers/slapd'
make[1]: *** [all-common] Error 1
make[1]: Leaving directory `/openldap-2.4.41Git/servers'
make: *** [all-common] Error 1
Comment 1 ebackes@symas.com 2015-05-05 18:37:19 UTC
Hello,

Give this a try; it's a patch vs RE24 but should be broadly
applicable.  Still investigating your trouble with GetFileSizeEx from
mdb.c.

Which MinGW distribution are you using, exactly?

-- 
Emily Backes
Symas Corporation
ebackes@symas.com
Comment 2 frank.offermanns@caseris.de 2015-05-06 06:24:13 UTC
Hi,

thanks for your patch. But since I am compilling 32 Bit, it doesn't work. 
I modified your patch to 
#define ftello ftell
Then it works. 

But I still have the GetFileSizeEx problem. 
I use MinGW-5.1.6 and here is my installed.ini:
[settings]
mirror=
installtype=current

[components]
runtime=mingwrt-3.17-mingw32-dev.tar.gz
w32api=w32api-3.14-mingw32-dev.tar.gz
binutils=binutils-2.20-1-mingw32-bin.tar.gz
core=gcc-core-3.4.5-20060117-3.tar.gz
gpp=gcc-g++-3.4.5-20060117-3.tar.gz
g77=
ada=
java=
objc=gcc-objc-3.4.5-20060117-3.tar.gz
make=make-3.81-20090914-mingw32-bin.tar.gz
runtimeDLL=mingwrt-3.17-mingw32-dll.tar.gz

Regards,
Frank




Von:    ebackes@symas.com
An:     openldap-its@OpenLDAP.org
Datum:  05.05.2015 20:40
Betreff:        Re: (ITS#8127) 32 bit windows build fails with mingw
Gesendet von:   "openldap-bugs" <openldap-bugs-bounces@openldap.org>



This is a multi-part message in MIME format.

--Multipart=_Tue__5_May_2015_11_37_19_-0700_mOvLt1ph20aiKu+q
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello,

Give this a try; it's a patch vs RE24 but should be broadly
applicable.  Still investigating your trouble with GetFileSizeEx from
mdb.c.

Which MinGW distribution are you using, exactly?

-- 
Emily Backes
Symas Corporation
ebackes@symas.com

--Multipart=_Tue__5_May_2015_11_37_19_-0700_mOvLt1ph20aiKu+q
Content-Type: text/x-diff;
 name="0001-ftello-compat-for-windows-slapadd-meter.patch"
Content-Disposition: attachment;
 filename="0001-ftello-compat-for-windows-slapadd-meter.patch"
Content-Transfer-Encoding: 7bit

From 330ee6483c404d7e993df41f55a490c7b34ea2bf Mon Sep 17 00:00:00 2001
From: Emily Backes <ebackes@symas.com>
Date: Thu, 5 Feb 2015 18:56:51 -0800
Subject: [PATCH] ftello compat for windows slapadd meter

---
 servers/slapd/slapadd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c
index 8cfdebd..29a3ff4 100644
--- a/servers/slapd/slapadd.c
+++ b/servers/slapd/slapadd.c
@@ -44,6 +44,10 @@ extern int slap_DN_strict;            /* dn.c */
 
 static char csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ];
 
+#ifdef _WIN32
+#define ftello _ftelli64
+#endif 
+
 typedef struct Erec {
                 Entry *e;
                 unsigned long lineno;
-- 
Emily Backes
Symas Corporation
ebackes@symas.com


--Multipart=_Tue__5_May_2015_11_37_19_-0700_mOvLt1ph20aiKu+q--





Comment 3 ebackes@symas.com 2015-05-06 21:51:34 UTC
Hello, Frank.

> thanks for your patch. But since I am compilling 32 Bit, it doesn't work. 
> I modified your patch to 
> #define ftello ftell
> Then it works.

Hm; that should work on 32bit windows.  (it does for me!)  Using
ftell() will limit you to 2GB files.  Then again, that particular case
is only for proress-reporting.  If your LDIF to be slapadd'd is less
than 2GB, it won't matter.

> But I still have the GetFileSizeEx problem. 
> I use MinGW-5.1.6 and here is my installed.ini:

I'll have to try that.  In the mean time, I've had more success
building with the version from winbuilds.org.

-- 
Emily Backes
Symas Corporation
ebackes@symas.com

Comment 4 Howard Chu 2015-05-07 09:51:40 UTC
Frank.Offermanns@caseris.de wrote:
> Dies ist eine mehrteilige Nachricht im MIME-Format.
> --=_alternative 00233070C1257E3D_=
> Content-Type: text/plain; charset="US-ASCII"
>
> Hi,
>
> thanks for your patch. But since I am compilling 32 Bit, it doesn't work.
> I modified your patch to
> #define ftello ftell
> Then it works.

But that will only work for input LDIF files smaller than 4GB.

A better fix is now committed in git master.
>
> But I still have the GetFileSizeEx problem.

GetFileSizeEx is a part of the Win32 API since Windows XP.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364957%28v=vs.85%29.aspx

Sounds like your MinGW is too old or needs a fix. There is nothing to fix in 
OpenLDAP source for this problem.

This ITS is now resolved.

> I use MinGW-5.1.6 and here is my installed.ini:
> [settings]
> mirror=
> installtype=current
>
> [components]
> runtime=mingwrt-3.17-mingw32-dev.tar.gz
> w32api=w32api-3.14-mingw32-dev.tar.gz
> binutils=binutils-2.20-1-mingw32-bin.tar.gz
> core=gcc-core-3.4.5-20060117-3.tar.gz
> gpp=gcc-g++-3.4.5-20060117-3.tar.gz
> g77=
> ada=
> java=
> objc=gcc-objc-3.4.5-20060117-3.tar.gz
> make=make-3.81-20090914-mingw32-bin.tar.gz
> runtimeDLL=mingwrt-3.17-mingw32-dll.tar.gz
>
> Regards,
> Frank
>
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 5 Howard Chu 2015-05-07 09:52:03 UTC
changed notes
changed state Open to Test
moved from Incoming to Build
Comment 6 Howard Chu 2015-05-07 13:38:50 UTC
ebackes@symas.com wrote:
> Hello, Frank.
>
>> thanks for your patch. But since I am compilling 32 Bit, it doesn't work.
>> I modified your patch to
>> #define ftello ftell
>> Then it works.
>
> Hm; that should work on 32bit windows.  (it does for me!)

As I already noted, ftelli64's availability depends on the version of the 
MSVCRT DLL on the system. Frank's MinGW is apparently too old to contain the 
ftelli64 symbol in the libmsvcrt import library.

>  Using
> ftell() will limit you to 2GB files.  Then again, that particular case
> is only for proress-reporting.  If your LDIF to be slapadd'd is less
> than 2GB, it won't matter.
>
>> But I still have the GetFileSizeEx problem.
>> I use MinGW-5.1.6 and here is my installed.ini:
>
> I'll have to try that.  In the mean time, I've had more success
> building with the version from winbuilds.org.

Always quote specific version numbers.
The MSYS I use is

MINGW32_NT-6.1 VIEL64 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys

I'm using MinGW from mingw-w64 (builds both 32 and 64 bit binaries) version 
1.0.8.

http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 7 Quanah Gibson-Mount 2015-06-18 21:26:16 UTC
changed state Test to Release
Comment 8 OpenLDAP project 2015-07-02 17:43:28 UTC
fixed in master
fixed in RE25
fixed in RE24
Comment 9 Quanah Gibson-Mount 2015-07-02 17:43:28 UTC
changed notes
changed state Release to Closed