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: Mohammad Akhlaghi
Subject: Re: getgroups.c failes to compile
Date: Fri, 17 May 2019 20:50:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Hi Bruno,

Thank you very much for the great explanation and solution. The elaborations really made things clear and were very useful. We applied the second one (setting `rpath'), and the problem was solved.

To avoid similar situations in the future, it may be good to add a check in the `configure' script so if `getgroups' fails, but the system is a GNU system, the configure script crashes with a warning (after all `make' will crash, but a crash in `configure' is more clear than a crash in `make'). Of course, this test can be done with all components similar to `getgroups' through a single macro/function.

Thanks again for the great and very useful solution,
Cheers,
Mohammad

On 5/14/19 3:35 AM, Bruno Haible wrote:
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]