Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / 000331.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
4 <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6    <meta name="generator" content="Movable Type 5.2.3" />
7
8    <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9    <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml" />
11
12    <title>Status for Andrew DeFaria: Bluecat RH 8.0 port</title>
13
14    <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15    <link rel="prev" href="http://defaria.com/blogs/Status/archives/000330.html" title="Hybrid OS" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/000332.html" title="LOS178 3.0.0" />
17
18    
19
20    
21
22    <script type="text/javascript" src="http://defaria.com/blogs/Status/mt-site.js"></script>
23 </head>
24 <body class="layout-one-column" onload="individualArchivesOnLoad(commenter_name)">
25    <div id="container">
26       <div id="container-inner" class="pkg">
27
28          <div id="banner">
29             <div id="banner-inner" class="pkg">
30                <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
31                <h2 id="banner-description">Searchable status reports and work log</h2>
32             </div>
33          </div>
34
35          <div id="pagebody">
36             <div id="pagebody-inner" class="pkg">
37                <div id="alpha">
38                   <div id="alpha-inner" class="pkg">
39
40                      <p class="content-nav">
41                         <a href="http://defaria.com/blogs/Status/archives/000330.html">&laquo; Hybrid OS</a> |
42                         <a href="http://defaria.com/blogs/Status/">Main</a>
43                         | <a href="http://defaria.com/blogs/Status/archives/000332.html">LOS178 3.0.0 &raquo;</a>
44                      </p>
45
46                      <a id="a000331"></a>
47                      <div class="entry" id="entry-331">
48                         <h3 class="entry-header">Bluecat RH 8.0 port</h3>
49                         <div class="entry-content">
50                            <div class="entry-body">
51                               <p>This status entry is to hold a log of the issues and resolutions for getting the Bluecat build process from the ancient RH 6.1 to the <i>a little less ancient</i> RH 8.0.</p>
52
53 <ol>
54   <li>Fun with eval, echo and new shell</li>
55
56   <li>Bug in rpm configure</li>
57
58   <li>Static vs. Shared</li>
59 </ol>
60
61                            </div>
62                            <div id="more" class="entry-more">
63                               <h3>Fun with eval, echo and new shell</h3>
64
65 <p>One of the things that the Bluecat do_it script does is to define the series of "steps" that need to be performed in terms of command lines in variables. Later on the $BUILD_STEP is evaluated to determine which set of commands need to be done as follows:</p>
66
67 <div class="code"><pre>
68 echo "---- Step $BUILD_STEP started at `date` ----"
69 su $BUILD_CMD_OWNER -c "mkdir -p $LOGS_PREFIX/step${BUILD_STEP}"
70 cmd=`eval echo $"STEP${BUILD_STEP}_CMD"`
71 su $BUILD_CMD_OWNER -c "$cmd $*"
72 </pre></div>
73
74 <p>Effectively the name of the environment variable holding the proper command(s) for the step is composed with the echo portion. The eval statement is used to "evaluate" that environment variable thus storing the string of commands into the environment variable cmd. This works well in past versions of the OS but it fails in RH 8.0. First here's the behavior on RH 6.1:</p>
75
76 <div class="code"><pre>
77 <font color="blue"><b>RH6.1:</b></font><u>export STEP1_CMD="ls /tmp"</u>
78 <font color="blue"><b>RH6.1:</b></font><u>export BUILD_STEP=1</u>
79 <font color="blue"><b>RH6.1:</b></font><u>echo $"STEP${BUILD_STEP}_CMD"</u>
80 $STEP1_CMD
81 </pre></div>
82
83 <p>However hears the same commands on RH8.0:</p>
84
85 <div class="code"><pre>
86 <font color="red"><b>RH8.0:</b></font><u>export STEP1_CMD="ls /tmp"</u>
87 <font color="red"><b>RH8.0:</b></font><u>export BUILD_STEP=1</u>
88 <font color="red"><b>RH8.0:</b></font><u>echo $"STEP${BUILD_STEP}_CMD"</u>
89 STEP1_CMD
90 </pre></div>
91
92 <p>As you can see the result is missing a $. Prepending a leading \ before the $ fixes this. Adding in the eval portion also works:</p>
93
94 <div class="code"><pre>
95 <font color="red"><b>RH8.0:</b></font><u>eval echo \$"STEP${BUILD_STEP}_CMD"</u>
96 ls /tmp
97 </pre></div>
98
99 <p>However when this is assigned to another environment variable (i.e. cmd) the result is not correct:</p>
100
101 <div class="code"><pre>
102 <font color="red"><b>RH8.0:</b></font><u>cmd=`eval echo \$"STEP${BUILD_STEP}_CMD"`</u>
103 <font color="red"><b>RH8.0:</b></font><u>echo $cmd</u>
104 STEP1_CMD
105 </pre></div>
106
107 <p>Subsituting the syntax of $(<command>) for `<command` however does work:</p>
108
109 <div class="code"><pre>
110 <font color="red"><b>RH8.0:</b></font><u>cmd=$(eval echo \$"STEP${BUILD_STEP}_CMD")</u>
111 <font color="red"><b>RH8.0:</b></font><u>echo $cmd</u>
112 ls /tmp
113 </pre></div>
114
115 <p>Note that the shell (bash) has been majorly updated for RH8.0:</p>
116
117 <div class="code"><pre>
118 <font color="blue"><b>RH6.1:</b></font><u>bash -version</u>
119 GNU bash, version 1.14.7(1)
120 </pre></div>
121
122 <p>Versus:</p>
123
124 <div class="code"><pre>
125 <font color="red"><b>RH8.0:</b></font><u>bash -version</u>
126 GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
127 Copyright (C) 2002 Free Software Foundation, Inc.
128 </pre></div>
129
130 <p>Please note that this new syntax also works flawlessly on the older RH 6.1.</p>
131
132 <h3>Bug in rpm configure</h3>
133
134 <p>When trying to build Bluecat on RH 8.0 and running mktools (to build the local gnutools) I get the following:</p>
135
136 <div class="code"><pre>
137 [int@europa make]$ autoreconf -f -i
138 autoreconf: `aclocal.m4' is updated
139 Makefile.am: installing `./depcomp'
140 WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
141 WARNING: and `config.h.top', to define templates for `config.h.in'
142 WARNING: is deprecated and discouraged.
143
144 WARNING: Using the third argument of `AC_DEFINE' and
145 WARNING: `AC_DEFINE_UNQUOTED' allows to define a template without
146 WARNING: `acconfig.h':
147
148 WARNING:   AC_DEFINE([NEED_MAIN], 1,
149 WARNING:             [Define if a function `main' is needed.])
150
151 WARNING: More sophisticated templates can also be produced, see the
152 WARNING: documentation.
153 autoheader-2.53: `config.h.in' is updated
154 </pre></div>
155
156 <p>Further, after running configure I get the following odd file in /usr/local/bluecat/eng/bluecat/make/.deps: remote-$(REMOTE).Po which causes the make to fail:</p>
157
158 <div class="code"><pre>
159 [int@europa make]$ make
160 Makefile:329: .deps/remote-stub.Po: No such file or directory
161 make: *** No rule to make target `.deps/remote-stub.Po'.  Stop.
162 </pre></div>
163
164 <p>Renaming .deps/remote-$(REMOTE).Po -> .deps/remote-stub.Po allows the make to proceed.</p>
165
166 <h3>Static vs. Shared - Cannot find -lnss_dns</h3>
167
168 <p>During the first real build step, step 2, the build fails when trying to build rpm. ld is unable to find the library nss_dns. Initial investigation shows that there is a nss_dns libs under /usr/lib as .so files but there is no .a file on RH 8.0. There is a .a file on RH 6.1 in /usr/lib. Apparently RH 8.0 no longer offers archive libraries for this. The solution to this problem is to pass -shared to gcc.</p>
169
170 <p>The specific gcc command line is:</p>
171
172 <div class="code"><pre>
173 <font color="blue"><b>int@europa tools:</b></font><u>pwd</u>
174 /var/tmp/rpm-4.2/tools
175 <font color="blue"><b>int@europa tools:</b></font><u>gcc -Wl,--verbose -O2 -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -o rpmgraph <font color="red"><b>-static</b></font> rpmgraph.o  ../lib/.libs/librpm.a /var/tmp/rpm-4.2/rpmdb/.libs/librpmdb.a -L/var/tmp/rpm-4.2/zlib -L/usr/local/lib /var/tmp/rpm-4.2/rpmio/.libs/librpmio.a /var/tmp/rpm-4.2/popt/.libs/libpopt.a ../beecrypt/.libs/libbeecrypt.a -lrt -lpthread -lc -lnss_dns -lnss_files -lresolv</u>
176 ...
177 (/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libc.a)truncate64.o
178 (/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libc.a)truncate.o
179 attempt to open /var/tmp/rpm-4.2/zlib/libnss_dns.a failed
180 attempt to open /usr/local/lib/libnss_dns.a failed
181 attempt to open /usr/lib/gcc-lib/i386-redhat-linux/3.2/libnss_dns.a failed
182 attempt to open /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libnss_dns.a failed
183 attempt to open /usr/i386-redhat-linux/lib/libnss_dns.a failed
184 attempt to open /usr/lib/libnss_dns.a failed
185 attempt to open /usr/local/lib/libnss_dns.a failed
186 attempt to open /lib/libnss_dns.a failed
187 collect2: ld returned 1 exit status
188 </pre></div>
189
190 <p>This is probably due to the -static above. Removing -static fixes this. The question is: Is it OK to remove -static? Second question is how?</p>
191
192
193
194
195                            </div>
196                         </div>
197                         <p class="entry-footer">
198                            <span class="post-footers">Posted by  on April  7, 2005 10:39 AM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000331.html">Permalink</a>
199                         </p>
200                      </div>
201
202                      
203
204                      
205                   </div>
206                </div>
207             </div>
208          </div>
209       </div>
210    </div>
211 </body>
212 </html>