Hello, I have an old version of Xapian installed in root and a new one installed in my home folder which I want to use. My pkgconfig is configured correctly ,---- | ~ pkg-config --libs xapian-core | -L/home/al/.local/stow/xapian/lib -lxapian `---- So compiling notmuch works until linking when the following command fails ,---- | ~ c++ lib/filenames.o lib/string-list.o lib/message-file.o lib/message-id.o lib/messages.o lib/sha1.o lib/built-with.o lib/string-map.o lib/indexopts.o lib/tags.o lib/database.o lib/parse-time-vrp.o lib/directory.o lib/index.o lib/message.o lib/add-message.o lib/message-property.o lib/query.o lib/query-fp.o lib/config.o lib/regexp-fields.o lib/thread.o lib/thread-fp.o lib/features.o lib/prefix.o lib/open.o lib/init.o lib/parse-sexp.o -Wl,--as-needed -L/home/al/.local/stow/gmime/lib -L/usr/lib64 -lgmime-3.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -L/usr/lib64 -ltalloc -L/usr/lib64 -lz -L/home/al/.local/stow/xapian/lib -lxapian -shared -Wl,--version-script=./lib/notmuch.sym,-soname=libnotmuch.so.5 -Wl,--no-undefined -o lib/libnotmuch.so.5.5.0 util/libnotmuch_util.a parse-time-string/libparse-time-string.a `---- The problem is that GCC orders the library folders left-to-right and the directory `/usr/lib64` is added (multiple times) before the my local directory `/home/al/.local/stow/xapian/lib`. So that the Xapian library file in the /usr/lib64 has a higher priority and is used. Removing all `-L/usr/lib64` manually and running the linking commands, I am able to compile notmuch correctly. Is there a better way to do this via configure? Thanks, -- Al
Al Haji-Ali <abdo.haji.ali@gmail.com> writes:
> Hello,
>
> I have an old version of Xapian installed in root and a new one installed in my home folder which I want to use. My pkgconfig is configured correctly
>
> ,----
> | ~ pkg-config --libs xapian-core
> | -L/home/al/.local/stow/xapian/lib -lxapian
> `----
>
configure actually invokes xapian-config rather than pkg-config (I
forget why offhand). So you probably need to set XAPIAN_CONFIG in the
environment to the one in your /home when running configure.
d
On 09/12/2021, David Bremner wrote:
> configure actually invokes xapian-config rather than pkg-config (I
> forget why offhand). So you probably need to set XAPIAN_CONFIG in the
> environment to the one in your /home when running configure.
Ah OK. My xapian-config is also correctly configured
,----
| ~ xapian-config --libs
| -L/home/al/.local/stow/xapian/lib -lxapian
`----
Notmuch's configure has the correct paths for Xapian as seen in the compilation command I included before. The issue is the order of library folders.
-- Al
Al Haji-Ali <abdo.haji.ali@gmail.com> writes:
> On 09/12/2021, David Bremner wrote:
>> configure actually invokes xapian-config rather than pkg-config (I
>> forget why offhand). So you probably need to set XAPIAN_CONFIG in the
>> environment to the one in your /home when running configure.
>
> Ah OK. My xapian-config is also correctly configured
>
> ,----
> | ~ xapian-config --libs
> | -L/home/al/.local/stow/xapian/lib -lxapian
> `----
>
> Notmuch's configure has the correct paths for Xapian as seen in the compilation command I included before. The issue is the order of library folders.
>
> -- Al
Does it help if you set LDFLAGS on the make command line? Looking at
Makefile.global, LDFLAGS are added before the other computed flags. So
something like
% make V=1 LDFLAGS=-L/home/al/.local/stow/xapian/lib
On 09/12/2021, David Bremner wrote:
> Does it help if you set LDFLAGS on the make command line? Looking at
> Makefile.global, LDFLAGS are added before the other computed flags. So
> something like
>
> % make V=1 LDFLAGS=-L/home/al/.local/stow/xapian/lib
Yep, this works. Thanks!
I feel that gcc should really have a right-to-left order rather than left-to-right libraries are usually preceded by their directory (like in xapian-config and pkg-config). It's curious that I never ran into this problem before.
-- Al