bug-gnulib
[Top][All Lists]
Advanced

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

Re: 'relocatable' project built without --enable-relocatable


From: Bruno Haible
Subject: Re: 'relocatable' project built without --enable-relocatable
Date: Wed, 24 Apr 2024 01:24:05 +0200

Reuben Thomas wrote:
> For a library. For example, from the libpaper commit referenced below,
> using #ifdefs:
> 
> /* Set the prefix directory for relocation. */
> void papersetprefixdir(const char *new_prefix)
> {
> #ifdef ENABLE_RELOCATABLE
>     set_relocation_prefix (INSTALLPREFIX, new_prefix);
> #else
>     (void)new_prefix;
> #endif
> }
> ...
> I'm asking because no package I know of is using set_relocation_prefix
> > explicitly [1]
> 
> I've been using it in Enchant since 2017[1] and in libpaper since 2021[2]
> 
> [1] https://github.com/AbiWord/enchant/commit/a8e771a

OK, I see. What you are doing is perfectly like it should be done:
  - papersetprefixdir is a function part of the public API of your library.
    It needs to be defined unconditionally.
  - set_relocation_prefix is defined in relocatable.c (module relocatable-lib
    or relocatable-lib-lgpl). This file is only compiled when $RELOCATABLE
    is 'yes' or (equivalently) 'defined ENABLE_RELOCATABLE'. When $RELOCATABLE
    is 'no', you get a link error when linking the library.

Can you please try the attached patch?

If it does not help, I would suggest that you move out the papersetprefixdir
function from a .vala compilation unit to a .c compilation unit, so that the
requirements of the Vala language and processor become irrelevant.

Bruno

Attachment: relocatable.diff
Description: Text Data


reply via email to

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