bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Using relocatable-prog with relocatable libraries
@ 2021-04-05 21:55 Reuben Thomas
  2021-04-05 22:36 ` Reuben Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Thomas @ 2021-04-05 21:55 UTC (permalink / raw)
  To: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

I use relocatable-prog in a project which builds a binary that links
against a library which itself is installed publicly.

Therefore, I build gnulib with -DIN_LIBRARY.

This causes gnulib to be built with a static copy of compute_curr_prefix,
named local_compute_curr_prefix. Therefore, when linking, the call to
compute_curr_prefix in progreloc.c's prepare_relocate function does not
find a link target, and linking fails.

I read through the documentation (mostly relocatable-maint.texi), and
couldn't find anything that seemed to relate to this. I can't see how I can
build gnulib both with and without -DIN_LIBRARY (unless of course I build
two copies of gnulib).

Have I missed something? I was surprised that I hadn't come across this
problem before, but I found that I've used relocatable-lib-lgpl before, but
not relocatable-prog (because in fact I was working with an LGPLed project).

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 2026 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using relocatable-prog with relocatable libraries
  2021-04-05 21:55 Using relocatable-prog with relocatable libraries Reuben Thomas
@ 2021-04-05 22:36 ` Reuben Thomas
  2021-04-05 22:42   ` Reuben Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Thomas @ 2021-04-05 22:36 UTC (permalink / raw)
  To: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

On Mon, 5 Apr 2021 at 22:55, Reuben Thomas <rrt@sc3d.org> wrote:

>
> Have I missed something? I was surprised that I hadn't come across this
> problem before, but I found that I've used relocatable-lib-lgpl before, but
> not relocatable-prog (because in fact I was working with an LGPLed
> project).
>

The comment about "all the copies of relocatable.c" in progreloc.c is
surely is clue, but I cannot see how more than one copy of relocatable.c is
ever compiled…

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 1122 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using relocatable-prog with relocatable libraries
  2021-04-05 22:36 ` Reuben Thomas
@ 2021-04-05 22:42   ` Reuben Thomas
  2021-04-09  1:41     ` Ben Pfaff
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Thomas @ 2021-04-05 22:42 UTC (permalink / raw)
  To: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

On Mon, 5 Apr 2021 at 23:36, Reuben Thomas <rrt@sc3d.org> wrote:

>
> The comment about "all the copies of relocatable.c" in progreloc.c is
> surely is clue, but I cannot see how more than one copy of relocatable.c is
> ever compiled…
>

Finally found, in relocatable-maint.texi, "If you need more than one
module, or you need to use them with different settings, you will need
multiple copies of gnulib (@pxref{Multiple instances})." Sorry for the
noise!

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 1227 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using relocatable-prog with relocatable libraries
  2021-04-05 22:42   ` Reuben Thomas
@ 2021-04-09  1:41     ` Ben Pfaff
  2021-04-09 10:18       ` Reuben Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Pfaff @ 2021-04-09  1:41 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: bug-gnulib

On Mon, Apr 5, 2021 at 3:43 PM Reuben Thomas <rrt@sc3d.org> wrote:
>
> On Mon, 5 Apr 2021 at 23:36, Reuben Thomas <rrt@sc3d.org> wrote:
>>
>>
>> The comment about "all the copies of relocatable.c" in progreloc.c is surely is clue, but I cannot see how more than one copy of relocatable.c is ever compiled…
>
>
> Finally found, in relocatable-maint.texi, "If you need more than one module, or you need to use them with different settings, you will need multiple copies of gnulib (@pxref{Multiple instances})." Sorry for the noise!

Do you think it should be better documented, or documented somewhere
else? (I'm only getting to my email now.)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using relocatable-prog with relocatable libraries
  2021-04-09  1:41     ` Ben Pfaff
@ 2021-04-09 10:18       ` Reuben Thomas
  2021-04-09 20:17         ` Reuben Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Thomas @ 2021-04-09 10:18 UTC (permalink / raw)
  To: Ben Pfaff; +Cc: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 1575 bytes --]

On Fri, 9 Apr 2021 at 02:41, Ben Pfaff <blp@cs.stanford.edu> wrote:

> On Mon, Apr 5, 2021 at 3:43 PM Reuben Thomas <rrt@sc3d.org> wrote:
> >
> > On Mon, 5 Apr 2021 at 23:36, Reuben Thomas <rrt@sc3d.org> wrote:
> >>
> >>
> >> The comment about "all the copies of relocatable.c" in progreloc.c is
> surely is clue, but I cannot see how more than one copy of relocatable.c is
> ever compiled…
> >
> >
> > Finally found, in relocatable-maint.texi, "If you need more than one
> module, or you need to use them with different settings, you will need
> multiple copies of gnulib (@pxref{Multiple instances})." Sorry for the
> noise!
>
> Do you think it should be better documented, or documented somewhere
> else? (I'm only getting to my email now.)
>

Yes, I think it could be clearer that building for a library and for a
program needs different settings, i.e. that when you define IN_LIBRARY, it
won't now work for a program, and therefore you need multiple copies of
gnulib. This is after all likely to be a common case: you want a program to
be relocatable, and it has a library which also needs to access files
relocatably.

While we're at it, this sentence doesn't apply to me, but it's mystifying:
"For installing multiple libraries, at least one of which depends on
another one, use the @code{relocatable-prog} module." Are you supposed to
use relocatable-prog *and* -DIN_LIBRARY? How does using relocatable-prog
help anyway?  (A brief explanation of why it's necessary might aid
comprehension and recall!)

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 2512 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Using relocatable-prog with relocatable libraries
  2021-04-09 10:18       ` Reuben Thomas
@ 2021-04-09 20:17         ` Reuben Thomas
  0 siblings, 0 replies; 6+ messages in thread
From: Reuben Thomas @ 2021-04-09 20:17 UTC (permalink / raw)
  To: Ben Pfaff; +Cc: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

On Fri, 9 Apr 2021 at 11:18, Reuben Thomas <rrt@sc3d.org> wrote:

> On Fri, 9 Apr 2021 at 02:41, Ben Pfaff <blp@cs.stanford.edu> wrote:
>
>> Do you think it should be better documented, or documented somewhere
>> else? (I'm only getting to my email now.)
>>
>
One practical reminder that would be useful: that you need to add a -I flag
to ACLOCAL_AMFLAGS in the top-level Makefile.am for each extra gnulib
invocation—this took me a little working out!
-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 1397 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-09 20:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-05 21:55 Using relocatable-prog with relocatable libraries Reuben Thomas
2021-04-05 22:36 ` Reuben Thomas
2021-04-05 22:42   ` Reuben Thomas
2021-04-09  1:41     ` Ben Pfaff
2021-04-09 10:18       ` Reuben Thomas
2021-04-09 20:17         ` Reuben Thomas

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).