Gentoo Archives: gentoo-user

From: Markos Chandras <hwoarang@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Compile program with older libraries
Date: Thu, 24 May 2012 14:12:45
Message-Id: CAG2jQ8jW0SC+sbsjFAg+-r75Zd-kSk351iZLnAv6JtQcv=8QXQ@mail.gmail.com
In Reply to: Re: [gentoo-user] Compile program with older libraries by "Marko Košmerl"
1 On Thu, May 24, 2012 at 2:58 PM, Marko Košmerl <marko06@×××××.com> wrote:
2 > On compile time I get warnings:
3 > watcher.cpp:(.text+0x85): warning: Using 'initgroups' in statically linked
4 > applications requires at runtime the shared libraries from the glibc version
5 > used for linking
6 > watcher.cpp:(.text+0x16f): warning: Using 'getpwnam' in statically linked
7 > applications requires at runtime the shared libraries from the glibc version
8 > used for linking
9 > client.cpp:(.text+0xb1a): warning: Using 'getaddrinfo' in statically linked
10 > applications requires at runtime the shared libraries from the glibc version
11 > used for linking
12 > reg.cpp:(.text+0x3d6): warning: Using 'gethostbyname' in statically linked
13 > applications requires at runtime the shared libraries from the glibc version
14 > used for linking
15 >
16 > On running it:
17 > ./watcher: /lib/libuuid.so.1: no version information available (required by
18 > ./watcher)
19 > ./watcher: /lib/libc.so.6:e version `GLIBC_2.4' not found (required by
20 > ./watcher)
21 > ./watcher: /lib/libc.so.6: version `GLIBC_2.7' not found (required by
22 > ./watcher)
23 > ./watcher: /lib/libc.so.6: version `GLIBC_2.11' not found (required by
24 > ./watcher)
25 >
26 >
27 > On Thu, May 24, 2012 at 3:33 PM, Markos Chandras <hwoarang@g.o>
28 > wrote:
29 >>
30 >> On Thu, May 24, 2012 at 2:15 PM, Marko Košmerl <marko06@×××××.com> wrote:
31 >> > Hi!
32 >> >
33 >> > I have some program which I am using in a thin client  which has Gentoo
34 >> > stage 3 root fs (kernel 2.6.39.4),
35 >> > lets call it system A.
36 >> > I've also compiled that program chroot-ed in this stage 3 fs from my
37 >> > personal computer.
38 >> >
39 >> > I have an other thin clients which have older system (B) on it which is
40 >> > older linux kernel 2.6.16.27.
41 >> > Library version which are needed are of course different and for that
42 >> > reason
43 >> > my program
44 >> > can not be run in this sistem.
45 >> >
46 >> > System A:
47 >> > Linux redondo 2.6.39.4 #18 Mon Mar 19 13:14:32 CET 2012 i586 i586 i386
48 >> > GNU/Linux
49 >> > /lib/libc-2.12.2.so
50 >> > gcc version 4.0.3
51 >> >
52 >> > System B:
53 >> > Linux carlos  2.6.16.27 #1 Sun Mar 25 11:09:40 CEST 2007 i586 i586 i386
54 >> > GNU/Linux
55 >> > /lib/libc-2.3.6.so
56 >> > gcc version 4.0.3
57 >> >
58 >> > Shared libraries that my binary uses are (in system A):
59 >> > linux-gate.so.1 =>  (0xffffe000)
60 >> > libpthread.so.0 => /lib/libpthread.so.0 (0xf76d6000)
61 >> > libuuid.so.1 => /lib/libuuid.so.1 (0xf76d1000)
62 >> > libstdc++.so.6 => /usr/lib/gcc/i486-pc-linux-gnu/4.4.5/libstdc++.so.6
63 >> > (0xf75da000)
64 >> > libm.so.6 => /lib/libm.so.6 (0xf75b2000)
65 >> > libc.so.6 => /lib/libc.so.6 (0xf7468000)
66 >> > /lib/ld-linux.so.2 (0xf76f3000)
67 >> > libgcc_s.so.1 => /usr/lib/gcc/i486-pc-linux-gnu/4.4.5/libgcc_s.so.1
68 >> > (0xf7449000)
69 >> >
70 >> > If i try to compile my program using '-static' directive, I still have a
71 >> > problem with 4 functions:
72 >> > -initgroups,
73 >> > -getpwnam,
74 >> > -getaddrinfo,
75 >> > -gethostbyname.
76 >> >
77 >> > If I got that right, they use functions which are located in NSS shared
78 >> > libraries.
79 >> >
80 >> > I am looking for a way of compiling my program so that I can run it in
81 >> > system B.
82 >> > I have libraries available from system B and that is all that I have.
83 >> >
84 >> > I need help on getting this done.
85 >> > I guess gcc versions are the same and as well libgcc_s.so.1 shared
86 >> > library.
87 >> >
88 >> > My questions are:
89 >> > Can I pull those libraries from system B and use it in compilatin
90 >> > process?
91 >> > Would that work?
92 >> > I would still need to get include source files of that version, right?
93 >> > Is there some archive site where I can find so old version of linux
94 >> > kernel
95 >> > source?
96 >> > One thing that pops in to my mind is also trying to find gentoo stage 3
97 >> > tarball of the kernel version 2.6.16.27
98 >> > and compile the program there...I tried to search that but no luck in
99 >> > that...
100 >> >
101 >> > Any help would be welcomed!
102 >>
103 >> You can statically compile your program on system A ( use gcc -static
104 >> -o test test.c for example ). Then you should be able to run it in
105 >> system B without any problem
106 >>
107 >
108
109 Why don't you want to compile the program in system B if you already
110 have the libraries around?

Replies

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