Issue 8034 - lmdb-0.9.14 | Undefined symbols for architecture ppc: "_posix_memalign" referenced from _mdb_env_copyfd2 | ld: symbol(s) not found for architecture ppc
Summary: lmdb-0.9.14 | Undefined symbols for architecture ppc: "_posix_memalign" refer...
Status: UNCONFIRMED
Alias: None
Product: LMDB
Classification: Unclassified
Component: liblmdb (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-23 13:18 UTC by daniel.ibnzayd@inquisitor.com
Modified: 2020-03-12 15:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description daniel.ibnzayd@inquisitor.com 2015-01-23 13:18:33 UTC
Full_Name: Daniel Ibn Zayd
Version: openldap-2.4.40-r3
OS: PPC
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (166.84.1.2)


This is a followup to a previous ticket. Based on what I learned from that, I
went ahead and tried to install the latest openldap on Gentoo Prefix. It pulls
in lmdb-0.9.14 which I understand now to be the preferred database backend over
db, for example. I successfully fixed one PPC error, replacing -soname with
-install_name (ld throws an error here), but I am left with an error having to
do with _posix-memalign:

Undefined symbols for architecture ppc:
  "_posix_memalign", referenced from:
      _mdb_env_copyfd2 in mdb.o
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status

Over at MacPorts, they are recommending disabling mdb, but this doesn't seem to
be a real fix:

http://trac.macports.org/changeset/130560

The better fix I think would be to test for _posix_memalign, and fall back to
valloc on older Macs.

In terms of C preprocessor macros, I believe "powerpc" and "PPC" to be
drerecated definitions; "__ppc__" and "__PPC__" being valid.

(Reference: http://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros
)

Thank you in advance for your time.
Comment 1 Quanah Gibson-Mount 2015-01-23 16:43:29 UTC
--On Friday, January 23, 2015 1:18 PM +0000 daniel.ibnzayd@inquisitor.com 
wrote:

> Full_Name: Daniel Ibn Zayd
> Version: openldap-2.4.40-r3
> OS: PPC
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (166.84.1.2)
>
>
> This is a followup to a previous ticket. Based on what I learned from
> that, I went ahead and tried to install the latest openldap on Gentoo
> Prefix. It pulls in lmdb-0.9.14 which I understand now to be the
> preferred database backend over db, for example. I successfully fixed one
> PPC error, replacing -soname with -install_name (ld throws an error
> here), but I am left with an error having to do with _posix-memalign:

Just a note:

LMDB should not be pulled separately from OpenLDAP.  I.e., only the bundled 
version of LMDB should be used with a given version of OpenLDAP.

--Quanah



--

Quanah Gibson-Mount
Platform Architect
Zimbra, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration

Comment 2 Howard Chu 2015-01-23 17:10:43 UTC
quanah@zimbra.com wrote:

> Just a note:
>
> LMDB should not be pulled separately from OpenLDAP.  I.e., only the bundled
> version of LMDB should be used with a given version of OpenLDAP.

I've already had this conversation with the gentoo maintainers; they 
refuse to listen to reason. It's all their problem now.

-- 
   -- 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 3 Hallvard Furuseth 2015-01-24 00:40:06 UTC
On 23/01/15 18:10, hyc@symas.com wrote:
>> LMDB should not be pulled separately from OpenLDAP.  I.e., only the bundled
>> version of LMDB should be used with a given version of OpenLDAP.
>
> I've already had this conversation with the gentoo maintainers; they
> refuse to listen to reason. It's all their problem now.

Still, memalign() is a problem.  mdb.c defines HAVE_MEMALIGN,
but it may be wrong for the user to -D"HAVE_MEMALIGN" since that
may omit whatever #include file declares it. <malloc/malloc.h>
(some Apple stuff I think), <malloc.h> dunno what else.

We could drop memalign.  malloc(desired space + 1 OS page), then
adjust for alignment.  On machines with a sane linear address
space where we can tell alignment from the address, anyway.

On weirder hosts, you care about them, omit alignment altogether
if posix_memalign is missing.  And omit O_DIRECT/F_NOCACHE in
mdb_env_copy2().  I gather those are why we need alignment.

Branch "mdb/memalign" in <git://git.uio.no/u/hbf/openldap.git>
has draft code.

Daniel: You can try that branch, and configure with
CPPFLAGS="-DMDB_MEMALIGN_METHOD=2".


I guess the preprocessor test should be "defined(a test for
Darwin: __APPLE__, _MACOSX_ or..?)" and not __PPC__.  PowerPC is
an architecture, while features like posix_memalign are defined
by compilers/operating systems.  The macports issue disables mdb
for Darwin.  Or maybe not, I don't know Mac, Darwin, PPC or
Gentoo, or if you just said this has been resolved, so I'll stay
out of of that issue.

-- 
Hallvard


Comment 4 Howard Chu 2015-01-24 09:10:21 UTC
Hallvard Breien Furuseth wrote:
> On 23/01/15 18:10, hyc@symas.com wrote:
>>> LMDB should not be pulled separately from OpenLDAP.  I.e., only the
>>> bundled
>>> version of LMDB should be used with a given version of OpenLDAP.
>>
>> I've already had this conversation with the gentoo maintainers; they
>> refuse to listen to reason. It's all their problem now.
>
> Still, memalign() is a problem.  mdb.c defines HAVE_MEMALIGN,
> but it may be wrong for the user to -D"HAVE_MEMALIGN" since that
> may omit whatever #include file declares it. <malloc/malloc.h>
> (some Apple stuff I think), <malloc.h> dunno what else.
>
> We could drop memalign.  malloc(desired space + 1 OS page), then
> adjust for alignment.  On machines with a sane linear address
> space where we can tell alignment from the address, anyway.

Such an address space is already a requirement for LMDB, since mmaps are 
page-aligned.
>
> On weirder hosts, you care about them, omit alignment altogether
> if posix_memalign is missing.  And omit O_DIRECT/F_NOCACHE in
> mdb_env_copy2().  I gather those are why we need alignment.

Right.

> Branch "mdb/memalign" in <git://git.uio.no/u/hbf/openldap.git>
> has draft code.

Still don't have time to check this myself, may have an opportunity 
tomorrow.
>
> Daniel: You can try that branch, and configure with
> CPPFLAGS="-DMDB_MEMALIGN_METHOD=2".
>
>
> I guess the preprocessor test should be "defined(a test for
> Darwin: __APPLE__, _MACOSX_ or..?)" and not __PPC__.  PowerPC is
> an architecture, while features like posix_memalign are defined
> by compilers/operating systems.  The macports issue disables mdb
> for Darwin.  Or maybe not, I don't know Mac, Darwin, PPC or
> Gentoo, or if you just said this has been resolved, so I'll stay
> out of of that issue.
>
Right. I thought you (OP) were talking about Gentoo Linux on PPC, not 
MacOSX on PPC. Linux on PPC should be using the same glibc as any other 
architecture, and as such ought to already have posix_memalign.

-- 
   -- 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 Hallvard Furuseth 2015-01-24 10:00:00 UTC
On 24/01/15 10:10, Howard Chu wrote:
 >> We could drop memalign.  malloc(desired space + 1 OS page), then
 >> adjust for alignment.  On machines with a sane linear address
 >> space where we can tell alignment from the address, anyway.
 >
 > Such an address space is already a requirement for LMDB, since mmaps 
 > are page-aligned.

I may have used the wrong word.  mmap() must align, but that's no
reason (size_t)pointer has to look sane.  If it wants, the machine
can still have PDP-endian descending address representation with
a checkbit as every 4th bit, while running in a mode with big-
endian integers, all of which shows up in (size_t)pointer.
Anyway, the branch now tries to test for sane-looking addresses.