From: Mohammad Akhlaghi <mohammad@akhlaghi.org>
To: Bruno Haible <bruno@clisp.org>, bug-gnulib@gnu.org
Cc: Elham Saremi <saremi@ipm.ir>
Subject: Re: getgroups.c failes to compile
Date: Fri, 17 May 2019 20:50:28 +0200 [thread overview]
Message-ID: <fcca5484-3d04-9ff3-7615-c5417a3be502@akhlaghi.org> (raw)
In-Reply-To: <2260855.Gdx5C7bdKa@omega>
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
>
next prev parent reply other threads:[~2019-05-17 18:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-11 22:06 getgroups.c failes to compile Mohammad Akhlaghi
2019-05-14 1:35 ` Bruno Haible
2019-05-17 18:50 ` Mohammad Akhlaghi [this message]
2019-05-18 0:58 ` Bruno Haible
2019-05-18 22:30 ` Mohammad Akhlaghi
2019-05-18 23:14 ` Bruno Haible
2019-05-19 21:15 ` Mohammad Akhlaghi
2019-05-23 16:17 ` Mohammad Akhlaghi
2019-05-25 23:52 ` Bruno Haible
2019-05-26 23:48 ` Mohammad Akhlaghi
2019-05-27 7:17 ` Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fcca5484-3d04-9ff3-7615-c5417a3be502@akhlaghi.org \
--to=mohammad@akhlaghi.org \
--cc=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=saremi@ipm.ir \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).