Обсуждение: REQ: build src/backend/postgres w/o -lncurses or -lreadline

Поиск
Список
Период
Сортировка

REQ: build src/backend/postgres w/o -lncurses or -lreadline

От
"Todd R. Eigenschink"
Дата:
When Postgres is configured and decides to use libncurses and
libreadline, the backend gets linked against those two libs, too, even
though it really doesn't use them.  This is just extra wasted size and
(if they're shared libs) dependencies you don't need.

I made this ultra-cheesy change to src/backend/Makefile to take care
of that.

postgres: $(OBJS)
        $(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o $@

to

postgres: $(OBJS)
        $(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ `echo $(LIBS) | sed -e 's/ -lncurses//' -e 's/ -lreadline//'`
-o$@ 



I realize this is a sort of special-purpose request.  It's not a big
deal to build the whole thing, then just relink src/backend/postgres
without those libs.  It just feels dirty to have them there when they
aren't needed.


Todd

Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline

От
Bruce Momjian
Дата:
> When Postgres is configured and decides to use libncurses and
> libreadline, the backend gets linked against those two libs, too, even
> though it really doesn't use them.  This is just extra wasted size and
> (if they're shared libs) dependencies you don't need.
>
> I made this ultra-cheesy change to src/backend/Makefile to take care
> of that.
>
> postgres: $(OBJS)
>         $(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o $@
>
> to
>
> postgres: $(OBJS)
>         $(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ `echo $(LIBS) | sed -e 's/ -lncurses//' -e 's/ -lreadline//'`
-o$@ 
>
>
>
> I realize this is a sort of special-purpose request.  It's not a big
> deal to build the whole thing, then just relink src/backend/postgres
> without those libs.  It just feels dirty to have them there when they
> aren't needed.
>

It is my understanding that having them there causes no bloat in the
binary.  No symbols are resolved in those libs.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline

От
"Todd R. Eigenschink"
Дата:
Bruce Momjian writes:
>> I realize this is a sort of special-purpose request.  It's not a big
>> deal to build the whole thing, then just relink src/backend/postgres
>> without those libs.  It just feels dirty to have them there when they
>> aren't needed.
>>
>
>It is my understanding that having them there causes no bloat in the
>binary.  No symbols are resolved in those libs.

Perhaps not, but the postgres binary then becomes dependent on those
libs being available (if they're shared).


Todd

Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline

От
Bruce Momjian
Дата:
> Bruce Momjian writes:
> >> I realize this is a sort of special-purpose request.  It's not a big
> >> deal to build the whole thing, then just relink src/backend/postgres
> >> without those libs.  It just feels dirty to have them there when they
> >> aren't needed.
> >>
> >
> >It is my understanding that having them there causes no bloat in the
> >binary.  No symbols are resolved in those libs.
>
> Perhaps not, but the postgres binary then becomes dependent on those
> libs being available (if they're shared).

Good point.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline

От
Tom Lane
Дата:
> It is my understanding that having them there causes no bloat in the
> binary.  No symbols are resolved in those libs.
>>
>> Perhaps not, but the postgres binary then becomes dependent on those
>> libs being available (if they're shared).

> Good point.

Autoconf has a bad habit of putting all libraries that it's asked to
check for into a single LIBS list, which makes it quite painful to avoid
linking all those libs to *every* binary built by the distribution.

I don't see much value in fixing this just for libreadline (and even
less in fixing it by disabling readline support entirely).  I think I
recall Peter E. having mentioned that there'd be a better answer in
autoconf 2.50 ... so I'm inclined not to touch the problem until that
comes out.

            regards, tom lane

Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline

От
Peter Eisentraut
Дата:
Tom Lane writes:

> Autoconf has a bad habit of putting all libraries that it's asked to
> check for into a single LIBS list, which makes it quite painful to avoid
> linking all those libs to *every* binary built by the distribution.

PostgreSQL, on the other hand, has the bad habit of using a single
configure script to configure rather separate binaries.  ;-)

> I don't see much value in fixing this just for libreadline (and even
> less in fixing it by disabling readline support entirely).  I think I
> recall Peter E. having mentioned that there'd be a better answer in
> autoconf 2.50 ... so I'm inclined not to touch the problem until that
> comes out.

I don't see how autoconf 2.50 ("any day now") would change anything here.
We could make up new variables like READLINE_LIBS, but where do we stop?
I don't have a good answer.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline

От
"Todd R. Eigenschink"
Дата:
Peter Eisentraut writes:
>> I don't see much value in fixing this just for libreadline (and even
>> less in fixing it by disabling readline support entirely).  I think I
>> recall Peter E. having mentioned that there'd be a better answer in
>> autoconf 2.50 ... so I'm inclined not to touch the problem until that
>> comes out.
>
>I don't see how autoconf 2.50 ("any day now") would change anything here.
>We could make up new variables like READLINE_LIBS, but where do we stop?
>I don't have a good answer.

Short of a separate configure script, there probably isn't one.

If you feel like doing *something*, my patch to "sed" out the
libraries would be really simple.  Otherwise, it's not a big deal for
me to just rebuild src/backend/postgres with a slightly altered
command line.  Once the initial "make" finishes, it only takes about
15 seconds.

And of course, most people don't/won't care or notice.  The extra
unneeded dependencies just make me feel dirty. :-)


Todd