How do I add a photo to my comment or blog entry?
Use of zlib
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > PostgreSQL database development > Use of zlib 26 September 2004 16:43:50

  Top users: 
  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:

Use of zlib

Thomas Hallgren 23 September 2004 14:02:17
 Problem:
PL/Java use a JVM. On some platforms and with some JVM's (Sun's in
particular) a libzip.so is bundled that contains a 1.1.3 version of
functions also provided in zlib (why they do this is beyond me, but they
do so I'll have to live with it). PostgreSQL is linked with zlib by
default. This resuls in a conflict which resuls in a JVM crash.

I can circumvein this crash by using LD_PRELOAD to force a load of the
JVM bundled libzip.so but I suspect that might result in a crash as soon
as PostgreSQL calls on zlib to do something. It's of course possible to
configure postgresql with --without-zlib also provided you have accesst
o the source.

Question:
From what I can understand from the documentation, the only utility in
PostgreSQL that actually uses zlib is pg_dump? If so, why is the
postgres process linked with -lz?

Regards,

Thomas Hallgren


-------------------­--------(end of broadcast)---------­------------------
TIP 7: don't forget to increase your free space map settings

Add comment
Peter Eisentraut 23 September 2004 15:12:29 permanent link ]
 Am Donnerstag, 23. September 2004 13:02 schrieb Thomas Hallgren:> From what I can understand from the documentation, the only utility in> PostgreSQL that actually uses zlib is pg_dump? If so, why is the> postgres process linked with -lz?

Because we are too lazy to fine-tune the build system for cases like this.
The best solution would be to build zlib with symbol versioning.

--
Peter Eisentraut
http://developer.po­stgresql.org/~petere­/

-------------------­--------(end of broadcast)---------­------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresq­l.org so that your
message can get through to the mailing list cleanly

Add comment
Thomas Hallgren 23 September 2004 15:19:03 permanent link ]
 Peter Eisentraut wrote:
Because we are too lazy to fine-tune the build system for cases like > this.>
The best solution would be to build zlib with symbol versioning.>
I'm not so sure. I think zlib is a commodity on most systems. You don't
want to build it at all. Perhaps if I submit a patch that takes care of
the fine-tuning?

- thomas



-------------------­--------(end of broadcast)---------­------------------
TIP 6: Have you searched our list archives?

http://archives.pos­tgresql.org

Add comment
Andrew Dunstan 23 September 2004 16:44:50 permanent link ]
 

Peter Eisentraut wrote:
Am Donnerstag, 23. September 2004 13:02 schrieb Thomas Hallgren:>
From what I can understand from the documentation, the only utility in>>PostgreSQL that actually uses zlib is pg_dump? If so, why is the>>postgres process linked with -lz?>>
Because we are too lazy to fine-tune the build system for cases like this. >The best solution would be to build zlib with symbol versioning.>

Or to be less lazy ;-)­ Is it such a huge task? There have been
complaints before about our maximal linking.

cheers

andrew

-------------------­--------(end of broadcast)---------­------------------
TIP 4: Don't 'kill -9' the postmaster

Add comment
Tom Lane 23 September 2004 17:48:54 permanent link ]
 Peter Eisentraut <peter_e@gmx.net> writes:> Am Donnerstag, 23. September 2004 13:02 schrieb Thomas Hallgren:>> From what I can understand from the documentation, the only utility in>> PostgreSQL that actually uses zlib is pg_dump? If so, why is the>> postgres process linked with -lz?
Because we are too lazy to fine-tune the build system for cases like this.

I was just reading about a linker option (--as-needed or something like
that) that exists in more recent versions of the GNU linker. It means
"only link the libraries actually referenced". Applying this or local
equivalent where available would seem like a fairly painless way to
solve the problem, at least on some platforms.

I agree that trying to keep track of the set of libraries really needed
for each executable would be a hopeless task, but if we can make the
linker fix it for us ...

regards, tom lane

-------------------­--------(end of broadcast)---------­------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresq­l.org so that your
message can get through to the mailing list cleanly

Add comment
Andrew Dunstan 23 September 2004 18:41:16 permanent link ]
 

Tom Lane wrote:
Peter Eisentraut <peter_e@gmx.net> writes:>
Am Donnerstag, 23. September 2004 13:02 schrieb Thomas Hallgren:>>
From what I can understand from the documentation, the only utility in>>>PostgreSQL that actually uses zlib is pg_dump? If so, why is the>>>postgres process linked with -lz?>>>
Because we are too lazy to fine-tune the build system for cases like this. >>
I was just reading about a linker option (--as-needed or something like>that) that exists in more recent versions of the GNU linker. It means>"only link the libraries actually referenced". Applying this or local>equivalent where available would seem like a fairly painless way to>solve the problem, at least on some platforms.>
I agree that trying to keep track of the set of libraries really needed>for each executable would be a hopeless task, but if we can make the>linker fix it for us ...>

Only in version 2.15, which as you say is fairly new. And people who
don't use GNU ld won't get it anyway. The docs (
http://sources.redh­at.com/binutils/docs­-2.15/ld/Options.htm­l#Options ) say:

|--as-needed|

|--no-as-needed|
This option affects ELF DT_NEEDED tags for dynamic libraries
mentioned on the command line after the |--as-needed| option.
Normally, the linker will add a DT_NEEDED tag for each dynamic
library mentioned on the command line, regardless of whether the
library is actually needed. |--as-needed| causes DT_NEEDED tags to
only be emitted for libraries that satisfy some reference from
regular objects. |--no-as-needed| restores the default behaviour.


I'm not sure I understand why keeping track of what we need for each
executable is such a difficult task, though. I count 23 executables and
a handful of libraries. Is this such a herculean task?

cheers

andrew


-------------------­--------(end of broadcast)---------­------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresq­l.org so that your
message can get through to the mailing list cleanly

Add comment
Andrew Dunstan 24 September 2004 17:12:59 permanent link ]
 

Thomas Hallgren wrote:
Problem:> PL/Java use a JVM. On some platforms and with some JVM's (Sun's in > particular) a libzip.so is bundled that contains a 1.1.3 version of > functions also provided in zlib (why they do this is beyond me, but > they do so I'll have to live with it). PostgreSQL is linked with zlib > by default. This resuls in a conflict which resuls in a JVM crash.>
I can circumvein this crash by using LD_PRELOAD to force a load of the > JVM bundled libzip.so but I suspect that might result in a crash as > soon as PostgreSQL calls on zlib to do something. It's of course > possible to configure postgresql with --without-zlib also provided you > have accesst o the source.>
Question:> From what I can understand from the documentation, the only utility in > PostgreSQL that actually uses zlib is pg_dump? If so, why is the > postgres process linked with -lz?>

I did a small experiment by installing binutils 2.15 and adding
-Wl,--as-needed to the LDFLAGS, as Tom had suggested might be useful.

This seemed to work quite well and trimmed back the needed libs quite a
bit. However, when you configure --with-openssl, libz is again linked in.

Not sure where that leaves us.

cheers

andrew

-------------------­--------(end of broadcast)---------­------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHer­e" to majordomo@postgresq­l.org)

Add comment
Thomas Hallgren 24 September 2004 18:17:13 permanent link ]
 Andrew Dunstan wrote:
Thomas Hallgren wrote:>
Problem:>> PL/Java use a JVM. On some platforms and with some JVM's (Sun's in >> particular) a libzip.so is bundled that contains a 1.1.3 version of >> functions also provided in zlib (why they do this is beyond me, but >> they do so I'll have to live with it). PostgreSQL is linked with zlib >> by default. This resuls in a conflict which resuls in a JVM crash.>>
I can circumvein this crash by using LD_PRELOAD to force a load of >> the JVM bundled libzip.so but I suspect that might result in a crash >> as soon as PostgreSQL calls on zlib to do something. It's of course >> possible to configure postgresql with --without-zlib also provided >> you have accesst o the source.>>
Question:>> From what I can understand from the documentation, the only utility >> in PostgreSQL that actually uses zlib is pg_dump? If so, why is the >> postgres process linked with -lz?>>
I did a small experiment by installing binutils 2.15 and adding > -Wl,--as-needed to the LDFLAGS, as Tom had suggested might be useful.>
This seemed to work quite well and trimmed back the needed libs quite > a bit. However, when you configure --with-openssl, libz is again > linked in.

From PL/Javas standpoint, I think it would be great if this change
could be incorporated into the 8.0 release. The openssl issue is
something I'll have to investigate. Perhaps it works using the libzip
from the JRE if I use LD_PRELOAD. I'm happy to see that Sun has an open
bug on the subject in their Bug Database (bug 4953050 if anyone is
interested).

Regards,

Thomas Hallgren



-------------------­--------(end of broadcast)---------­------------------
TIP 6: Have you searched our list archives?

http://archives.pos­tgresql.org

Add comment
Bruce Momjian 26 September 2004 03:58:37 permanent link ]
 
I am confused. I just checked my backend binary and I don't see any
unusual libs required:

$ ldd postgres
libz.so => /usr/lib/libz.so (0x2833f000)
libncurses.so.5 => /shlib/libncurses.s­o.5 (0x2834e000)
libdl.so => /shlib/libdl.so (0x2838c000)
libm.so => /shlib/libm.so.0.0 (0x2838f000)
libgcc.so.1 => /shlib/libgcc.so.1 (0x283a0000)
libc.so.2 => /shlib/libc.so.2 (0x283ac000)

The libncurses is a little unusual but I don't see libreadline in there
even though it is on the link line.

Are some OS's adding libs that aren't required by the binary?

-------------------­--------------------­--------------------­----------------

Andrew Dunstan wrote:>
Thomas Hallgren wrote:>
Problem:> > PL/Java use a JVM. On some platforms and with some JVM's (Sun's in > > particular) a libzip.so is bundled that contains a 1.1.3 version of > > functions also provided in zlib (why they do this is beyond me, but > > they do so I'll have to live with it). PostgreSQL is linked with zlib > > by default. This resuls in a conflict which resuls in a JVM crash.> >
I can circumvein this crash by using LD_PRELOAD to force a load of the > > JVM bundled libzip.so but I suspect that might result in a crash as > > soon as PostgreSQL calls on zlib to do something. It's of course > > possible to configure postgresql with --without-zlib also provided you > > have accesst o the source.> >
Question:> > From what I can understand from the documentation, the only utility in > > PostgreSQL that actually uses zlib is pg_dump? If so, why is the > > postgres process linked with -lz?> >
I did a small experiment by installing binutils 2.15 and adding > -Wl,--as-needed to the LDFLAGS, as Tom had suggested might be useful.>
This seemed to work quite well and trimmed back the needed libs quite a > bit. However, when you configure --with-openssl, libz is again linked in.>
Not sure where that leaves us.>
cheers>
andrew>
-------------------­--------(end of broadcast)---------­------------------> TIP 2: you can get off all lists at once with the unregister command> (send "unregister YourEmailAddressHer­e" to majordomo@postgresq­l.org)>

--
Bruce Momjian | http://candle.pha.p­a.us
pgman@candle.pha.pa­.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

-------------------­--------(end of broadcast)---------­------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresq­l.org so that your
message can get through to the mailing list cleanly

Add comment
Dennis Bjorklund 26 September 2004 07:28:15 permanent link ]
 On Sat, 25 Sep 2004, Bruce Momjian wrote:
I am confused. I just checked my backend binary and I don't see any> unusual libs required:>
$ ldd postgres> libz.so => /usr/lib/libz.so (0x2833f000)> libncurses.so.5 => /shlib/libncurses.s­o.5 (0x2834e000)> libdl.so => /shlib/libdl.so (0x2838c000)> libm.so => /shlib/libm.so.0.0 (0x2838f000)> libgcc.so.1 => /shlib/libgcc.so.1 (0x283a0000)> libc.so.2 => /shlib/libc.so.2 (0x283ac000)>
The libncurses is a little unusual but I don't see libreadline in there> even though it is on the link line.>
Are some OS's adding libs that aren't required by the binary?

This is the output in Fedora Core 2, and it includes readline:

$ ldd /usr/bin/postgres
linux-gate.so.1 => (0x00240000)
libpam.so.0 => /lib/libpam.so.0 (0x00cf1000)
libssl.so.4 => /lib/libssl.so.4 (0x0014e000)
libcrypto.so.4 => /lib/libcrypto.so.4­ (0x00241000)
libkrb5.so.3 => /usr/lib/libkrb5.so­.3 (0x0052a000)
libcom_err.so.2 => /lib/libcom_err.so.­2 (0x00e56000)
libz.so.1 => /usr/lib/libz.so.1 (0x00aca000)
libreadline.so.4 => /usr/lib/libreadlin­e.so.4 (0x00111000)
libtermcap.so.2 => /lib/libtermcap.so2 (0x00f25000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00406000)
libresolv.so.2 => /lib/libresolv.so.2­ (0x00f8a000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00215000)
libdl.so.2 => /lib/libdl.so.2 (0x00908000)
libm.so.6 => /lib/tls/libm.so.6 (0x008a5000)
libc.so.6 => /lib/tls/libc.so.6 (0x00592000)
libgssapi_krb5.so.2­ => /usr/lib/libgssapi_­krb5.so.2 (0x00a57000)
libk5crypto.so.3 => /usr/lib/libk5crypt­o.so.3 (0x00ccd000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x004ca000)


--
/Dennis BjГ¶rklund


-------------------­--------(end of broadcast)---------­------------------
TIP 6: Have you searched our list archives?

http://archives.pos­tgresql.org

Add comment
Tom Lane 26 September 2004 08:43:17 permanent link ]
 Bruce Momjian <pgman@candle.pha.p­a.us> writes:> I am confused. I just checked my backend binary and I don't see any> unusual libs required:
$ ldd postgres> libz.so => /usr/lib/libz.so (0x2833f000)> libncurses.so.5 => /shlib/libncurses.s­o.5 (0x2834e000)

I do not believe either of those are actually *used* by the backend.

regards, tom lane

-------------------­--------(end of broadcast)---------­------------------
TIP 4: Don't 'kill -9' the postmaster

Add comment
Andrew Dunstan 26 September 2004 16:28:34 permanent link ]
 

Dennis Bjorklund wrote:
This is the output in Fedora Core 2, and it includes readline:>
$ ldd /usr/bin/postgres> linux-gate.so.1 => (0x00240000)> libpam.so.0 => /lib/libpam.so.0 (0x00cf1000)> libssl.so.4 => /lib/libssl.so.4 (0x0014e000)> libcrypto.so.4 => /lib/libcrypto.so.4­ (0x00241000)> libkrb5.so.3 => /usr/lib/libkrb5.so­.3 (0x0052a000)> libcom_err.so.2 => /lib/libcom_err.so.­2 (0x00e56000)> libz.so.1 => /usr/lib/libz.so.1 (0x00aca000)> libreadline.so.4 => /usr/lib/libreadlin­e.so.4 (0x00111000)> libtermcap.so.2 => /lib/libtermcap.so2 (0x00f25000)> libcrypt.so.1 => /lib/libcrypt.so.1 (0x00406000)> libresolv.so.2 => /lib/libresolv.so.2­ (0x00f8a000)> libnsl.so.1 => /lib/libnsl.so.1 (0x00215000)> libdl.so.2 => /lib/libdl.so.2 (0x00908000)> libm.so.6 => /lib/tls/libm.so.6 (0x008a5000)> libc.so.6 => /lib/tls/libc.so.6 (0x00592000)> libgssapi_krb5.so.2­ => /usr/lib/libgssapi_­krb5.so.2 (0x00a57000)> libk5crypto.so.3 => /usr/lib/libk5crypt­o.so.3 (0x00ccd000)> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x004ca000)>

Now, to see the things postgres really needs, as opposed to things other
libraries need or that we just throw in for good measure in case
somebody needs them, run this:

LDFLAGS=-Wl,--as-ne­cessary ./configure

without any third-party options (like pam, openssl, kerberos ...),
Alternatively, you can set the flag in src/Makefile.global­

This should work on FC2, which I believe has binutils 2.15.

Almost every line above will disappear.

cheers

andrew

-------------------­--------(end of broadcast)---------­------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresq­l.org

Add comment
Andrew Dunstan 26 September 2004 16:43:50 permanent link ]
 
of course, I meant --as-needed rather than --as-necessary

Andrew Dunstan wrote:
Dennis Bjorklund wrote:>
This is the output in Fedora Core 2, and it includes readline:>>
$ ldd /usr/bin/postgres>>­ linux-gate.so.1 => (0x00240000)>> libpam.so.0 => /lib/libpam.so.0 (0x00cf1000)>> libssl.so.4 => /lib/libssl.so.4 (0x0014e000)>> libcrypto.so.4 => /lib/libcrypto.so.4­ (0x00241000)>> libkrb5.so.3 => /usr/lib/libkrb5.so­.3 (0x0052a000)>> libcom_err.so.2 => /lib/libcom_err.so.­2 (0x00e56000)>> libz.so.1 => /usr/lib/libz.so.1 (0x00aca000)>> libreadline.so.4 => /usr/lib/libreadlin­e.so.4 (0x00111000)>> libtermcap.so.2 => /lib/libtermcap.so2 (0x00f25000)>> libcrypt.so.1 => /lib/libcrypt.so.1 (0x00406000)>> libresolv.so.2 => /lib/libresolv.so.2­ (0x00f8a000)>> libnsl.so.1 => /lib/libnsl.so.1 (0x00215000)>> libdl.so.2 => /lib/libdl.so.2 (0x00908000)>> libm.so.6 => /lib/tls/libm.so.6 (0x008a5000)>> libc.so.6 => /lib/tls/libc.so.6 (0x00592000)>> libgssapi_krb5.so.2­ => /usr/lib/libgssapi_­krb5.so.2 (0x00a57000)>> libk5crypto.so.3 => /usr/lib/libk5crypt­o.so.3 (0x00ccd000)>> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x004ca000)>>
Now, to see the things postgres really needs, as opposed to things > other libraries need or that we just throw in for good measure in case > somebody needs them, run this:>
LDFLAGS=-Wl,--as-ne­cessary ./configure>
without any third-party options (like pam, openssl, kerberos ...), > Alternatively, you can set the flag in src/Makefile.global­>
This should work on FC2, which I believe has binutils 2.15.>
Almost every line above will disappear.>
cheers>
andrew>

-------------------­--------(end of broadcast)---------­------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > PostgreSQL database development > Use of zlib 26 September 2004 16:43:50

see also:
Failed to install Framework 3.0…
Frontpage macro move cursor
Opening a new window for a hyperlink
pass tests:
ДЛЯ РУССКИХ ЧУВАКОВ
see also:
hip hop loui svuitton clothing 5ive…
cheap discount ed ahrdy short pant…
accept paypal 5ive jungel clothing…

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .