This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Tell gcc/glibc not to use symbols higher than X.Y


[Hope this is correct mailing list for this question, if not please let
me know where I should post it.]

I want to build binary which will run on any modern Linux distribution
without external dependencies. As far as I understand I can do it by
using shared linking against glibc and link everything else statically.
I'm using Ubuntu 10.04 as my build environment. Problem is that resulted
binary contains some symbols which any too new for another distributions
(eg., CentOS 5.7 have only glibc 2.5):
00000000      DF *UND*	00000000  GLIBC_2.11  __longjmp_chk
00000000      DF *UND*	00000000  GLIBC_2.7   __isoc99_sscanf

Which solutions I have found so far:

1) To use LSB. Seems to be right decision on the first glance, but it
looks like distributions do not install LSB loader by default. At least
Ubuntu 10.04 and CentOS 5.7 do not have any /lib/* installed by
default. So binary will not work in these distributions out of the box.
More over I get some misleading error message like "file not found",
rather than something more meaningful like "LSB not installed, do
apt-get install lsb" when I try to run it on Ubuntu without LSB

2) Use something like "__asm__(".symver realpath,realpath@GLIBC_2.2.5")"
in the code, like described here:
Does not work for me because it seems there no earlier symbol of

3) Build old glibc and tell gcc to use it header/libs. I have not tried
this yet, but I think it should work. However what I'm looking for is a
more simple way, in which I can tell my current glibc not to use any
symbols which are newer than 2.3.4 for example. Something like
MACOSX_DEPLOYMENT_TARGET environment variable in Mac OS X, but for
glibc. Is it possible? Or I really should use custom older glibc build?

Best regards,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]