bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getgroups.c failes to compile


From: Bruno Haible
Subject: Re: getgroups.c failes to compile
Date: Tue, 14 May 2019 03:35:22 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-145-generic; KDE/5.18.0; x86_64; ; )

Hi,

Mohammad Akhlaghi wrote:
> Recently in a build of Gnuastro 0.9 (which uses Gnulib 
> `v0.1-2539-gd6af24178'), we confronted a crash during the build of 
> Gnulib's `getgroups.c' (error summary is in P.S.).

A log of the command "make" would be more useful than a log of the command
"make -j8", because the latter intermingles the output of different
compilations running in parallel. For example, here it looks like the
error messages are coming from the compilation of getopt1.c:

> /bin/sh ../../libtool  --tag=CC   --mode=compile /usr/bin/gcc 
> -DHAVE_CONFIG_H -I. -I../..   -I/usr/local/include  -Wall -O3  -pthread 
> -MT getopt1.lo -MD -MP -MF $depbase.Tpo -c -o getopt1.lo getopt1.c &&\
> mv -f $depbase.Tpo $depbase.Plo
> In file included from getgroups.c:22:0:
> getgroups.c:33:1: error: conflicting types for ‘rpl_getgroups’
>   getgroups (int n _GL_UNUSED, GETGROUPS_T *groups _GL_UNUSED)
>   ^
> ./unistd.h:1216:1: note: previous declaration of ‘rpl_getgroups’ was here
>   _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
>   ^
> Makefile:2208: recipe for target 'getgroups.lo' failed

> As further information, I am also attaching several outputs of the 
> configuration and build which will hopefully provide much more detailed 
> information on the host system and build environment. The two 
> `redirect-*.txt' files are the full outputs of the `./configure'

These logs are more interesting:

> checking for working getgroups... no

On glibc systems, getgroups is expected to work. So, the cause is already
to be found during the autoconfiguration.

> configure:23138: checking type of array argument to getgroups
> configure:23172: /usr/bin/gcc -o conftest -Wall -O3  -pthread 
> -I/usr/local/include -L/usr/local/lib conftest.c -ltiff -llzma -ljpeg -lwcs 
> -lcfitsio -lz -lgsl -lgslcblas -lm   >&5
> configure:23172: $? = 0
> configure:23172: ./conftest
> ./conftest: error while loading shared libraries: libwcs.so.6: cannot open 
> shared object file: No such file or directory
> configure:23172: $? = 127
> configure: program exited with status 127

The error comes from the fact that you have a -L option, the directory in this
option was actually used to locate a shared library (libwcs.so.6 in this case),
but the runtime linker cannot find this shared library.

There are two easy workarounds:
  (a) set the environment variable LD_LIBRARY_PATH=/usr/local/lib
      before the configuration,
  (b) pass LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib".

In the case (a) the binaries that you build will only work when
LD_LIBRARY_PATH=/usr/local/lib is still set. In the case (b) the
binaries will work without this environment variable.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]