Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile does not account for cross-compiling #11

Open
rkeene opened this issue Jan 22, 2019 · 6 comments
Open

Makefile does not account for cross-compiling #11

rkeene opened this issue Jan 22, 2019 · 6 comments

Comments

@rkeene
Copy link

rkeene commented Jan 22, 2019

tcl-lmdb/Makefile.in

Lines 152 to 161 in 992c681

# Workaround for glibc pthread robust mutex support (glibc < 2.12) fix
ifneq ("$(OS)","Windows_NT")
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
GLIBCCHECK := $(shell expr `ldd --version | grep ^ldd | sed 's/^.* //g'` \< 2.12)
ifeq "$(GLIBCCHECK)" "1"
PKG_CFLAGS += -DMDB_USE_ROBUST=0
endif
endif
endif

This assumes that because one is building ON Linux that one is building FOR Linux, this does not hold true when cross-compiling.

@ray2501
Copy link
Owner

ray2501 commented Jan 23, 2019

Yes, it is try to fix glibc pthread robust mutex support (glibc < 2.12) case on and for Linux build for myself. So I do not account for cross-compiling. Any idea for this?

@rkeene
Copy link
Author

rkeene commented Jan 23, 2019

The LMDB source itself seems to deal with it:

tcl-lmdb/generic/mdb.c

Lines 309 to 328 in 992c681

#ifdef __GLIBC__
#define GLIBC_VER ((__GLIBC__ << 16 )| __GLIBC_MINOR__)
#endif
/** Some platforms define the EOWNERDEAD error code
* even though they don't support Robust Mutexes.
* Compile with -DMDB_USE_ROBUST=0, or use some other
* mechanism like -DMDB_USE_SYSV_SEM instead of
* -DMDB_USE_POSIX_MUTEX. (SysV semaphores are
* also Robust, but some systems don't support them
* either.)
*/
#ifndef MDB_USE_ROBUST
/* Android currently lacks Robust Mutex support. So does glibc < 2.4. */
# if defined(MDB_USE_POSIX_MUTEX) && (defined(__ANDROID__) || \
(defined(__GLIBC__) && GLIBC_VER < 0x020004))
# define MDB_USE_ROBUST 0
# else
# define MDB_USE_ROBUST 1
# endif
#endif /* !MDB_USE_ROBUST */

@ray2501
Copy link
Owner

ray2501 commented Jan 23, 2019

I add this because it results in build failed in the Ubuntu 10.04 environment (glibc 2.11, pthread function is missing or other things).

However, I do not know how to check this in this moment because I updated my environment to newer Ubuntu.

@rkeene
Copy link
Author

rkeene commented Jan 23, 2019

Maybe changing the glibc check to be 2.11 instead of 2.4 is sufficient ?

@ray2501
Copy link
Owner

ray2501 commented Jan 23, 2019

LMDB check glibc < 2.10 when I write code but current LMDB code base check is correct.

I think remove this workaround or instead of check glibc 2.4 is OK. Do you suggest remove the workaround or instead of check glibc 2.4?

@rkeene
Copy link
Author

rkeene commented Jan 23, 2019

Compiling it for Android still fails with the robust check failing, so maybe something better needs to be done as part of autoconf. I'll submit a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants