[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: relocatable-lib and "make distcheck"
From: |
Bruno Haible |
Subject: |
Re: relocatable-lib and "make distcheck" |
Date: |
Sun, 02 Apr 2017 21:59:41 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-70-generic; KDE/5.18.0; x86_64; ; ) |
Hi Reuben,
> > See https://github.com/rrthomas/enchant.git branch
> > relocatable-build-problem
> >
> > ./autogen.sh
> > make
> > make distclean
> >
> > shows the error. Let me know if you need it cut down more.
> >
>
> I've cut down the build system and code to pretty much trivial levels.
> Hopefully that's enough for you to see what the problem is (either mine or
> relocatable's).
Yes, this time I can analyze it.
In configure.ac you use
AC_LIBOBJ([relocatable])
Don't use AC_LIBOBJ. Especially, don't use AC_LIBOBJ with gnulib.
Rationale: AC_LIBOBJ has some design limitations. Some of the gnulib logic
is devoted to overcoming these limitations.
$ grep 'relocate (' */*.c
lib/relocatable.c:relocate (const char *pathname)
src/lib.c:enchant_relocate (const char *path)
src/lib.c: char *newpath = (char *) relocate (path);
src/lib.c: conf_dirs = g_slist_append (conf_dirs, enchant_relocate
(PKGDATADIR));
src/lib.c: char *sysconfdir = enchant_relocate (SYSCONFDIR);
src/lib.c: char *module_dir = enchant_relocate (PKGLIBDIR);
src/lib.c: return enchant_relocate (INSTALLPREFIX);
So, you need the relocate() function only in lib.c, which is part of
libenchant_la_SOURCES. libenchant_la_LIBADD already contains libgnu.la,
so there is no point in the extra AC_LIBOBJ.
When you do so, you get a link error
./.libs/libenchant.so: undefined reference to `relocate'
./.libs/libenchant.so: undefined reference to `set_relocation_prefix'
The reason is, when I look at the difference between modules/relocatable-lib
and modules/relocatable-lib-lgpl, the missing AC_LIBOBJ invocation there.
This is a mistake in my commit from 2011-05-21
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=357d319ff8af64cc9dcce17868a4c40260f6cccc
Fixing it as follows:
2017-04-02 Bruno Haible <address@hidden>
relocatable-lib-lgpl: Fix link error (regression from 2011-06-16).
* modules/relocatable-lib-lgpl (configure.ac): Add AC_LIBOBJ invocation,
like it was done in modules/relocatable-lib on 2011-05-21 and in
modules/relocatable-prog on 2011-08-15.
Reported by Reuben Thomas <address@hidden>.
diff --git a/modules/relocatable-lib-lgpl b/modules/relocatable-lib-lgpl
index 26abd40..11b1400 100644
--- a/modules/relocatable-lib-lgpl
+++ b/modules/relocatable-lib-lgpl
@@ -13,6 +13,9 @@ strdup
configure.ac:
gl_RELOCATABLE_LIBRARY
+if test $RELOCATABLE = yes; then
+ AC_LIBOBJ([relocatable])
+fi
Makefile.am:
DEFS += -DNO_XMALLOC
- Re: relocatable-lib and "make distcheck",
Bruno Haible <=