Gentoo Archives: gentoo-user

From: Joshua Murphy <poisonbl@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Compile program with older libraries
Date: Fri, 25 May 2012 10:57:35
Message-Id: CAOTuDKrbCNkG6qBt0bCAwuSWqr3UyEbC=1+_PWhxsw8zUx_Miw@mail.gmail.com
In Reply to: [gentoo-user] Compile program with older libraries by "Marko Košmerl"
1 On Thu, May 24, 2012 at 9:15 AM, Marko Košmerl <marko06@×××××.com> wrote:
2 > Hi!
3 >
4 > I have some program which I am using in a thin client  which has Gentoo
5 > stage 3 root fs (kernel 2.6.39.4),
6 > lets call it system A.
7 > I've also compiled that program chroot-ed in this stage 3 fs from my
8 > personal computer.
9 >
10 > I have an other thin clients which have older system (B) on it which is
11 > older linux kernel 2.6.16.27.
12 > Library version which are needed are of course different and for that reason
13 > my program
14 > can not be run in this sistem.
15 >
16 > System A:
17 > Linux redondo 2.6.39.4 #18 Mon Mar 19 13:14:32 CET 2012 i586 i586 i386
18 > GNU/Linux
19 > /lib/libc-2.12.2.so
20 > gcc version 4.0.3
21 >
22 > System B:
23 > Linux carlos  2.6.16.27 #1 Sun Mar 25 11:09:40 CEST 2007 i586 i586 i386
24 > GNU/Linux
25 > /lib/libc-2.3.6.so
26 > gcc version 4.0.3
27 >
28 > Shared libraries that my binary uses are (in system A):
29 > linux-gate.so.1 =>  (0xffffe000)
30 > libpthread.so.0 => /lib/libpthread.so.0 (0xf76d6000)
31 > libuuid.so.1 => /lib/libuuid.so.1 (0xf76d1000)
32 > libstdc++.so.6 => /usr/lib/gcc/i486-pc-linux-gnu/4.4.5/libstdc++.so.6
33 > (0xf75da000)
34 > libm.so.6 => /lib/libm.so.6 (0xf75b2000)
35 > libc.so.6 => /lib/libc.so.6 (0xf7468000)
36 > /lib/ld-linux.so.2 (0xf76f3000)
37 > libgcc_s.so.1 => /usr/lib/gcc/i486-pc-linux-gnu/4.4.5/libgcc_s.so.1
38 > (0xf7449000)
39 >
40 > If i try to compile my program using '-static' directive, I still have a
41 > problem with 4 functions:
42 > -initgroups,
43 > -getpwnam,
44 > -getaddrinfo,
45 > -gethostbyname.
46 >
47 > If I got that right, they use functions which are located in NSS shared
48 > libraries.
49 >
50 > I am looking for a way of compiling my program so that I can run it in
51 > system B.
52 > I have libraries available from system B and that is all that I have.
53 >
54 > I need help on getting this done.
55 > I guess gcc versions are the same and as well libgcc_s.so.1 shared library.
56 >
57 > My questions are:
58 > Can I pull those libraries from system B and use it in compilatin process?
59 > Would that work?
60 > I would still need to get include source files of that version, right?
61 > Is there some archive site where I can find so old version of linux kernel
62 > source?
63 > One thing that pops in to my mind is also trying to find gentoo stage 3
64 > tarball of the kernel version 2.6.16.27
65 > and compile the program there...I tried to search that but no luck in
66 > that...
67 >
68 > Any help would be welcomed!
69
70 Well, you could use a chroot on system A to build it against an older
71 copy of the library. I can't find a stage3 with that range of glibc,
72 though if you can still track down sources to piece together a
73 toolchain, LFS 6.2 [1] is from right around that time frame (around
74 '06-'07). If anyone has a 2007.1 range stage3 laying around, though,
75 all the hard work's already done for setting up a perfect chroot as
76 long as it plays well with a newer kernel (or if you can do the build
77 in said chroot on system B), I've had issues with a too-new set of
78 libraries on older kernels more than once, not sure I've tried the
79 other direction.
80
81 [1] http://www.linuxfromscratch.org/lfs/view/6.2
82
83 --
84 Poison [BLX]
85 Joshua M. Murphy

Replies

Subject Author
Re: [gentoo-user] Compile program with older libraries "Marko Košmerl" <marko06@×××××.com>