Gentoo Archives: gentoo-user

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