| 141 | | # Install the license file: |
|---|
| 142 | | |
|---|
| 143 | | install -m644 *_cpp_l_*.lic /opt/doc/icc/licenses |
|---|
| 144 | | |
|---|
| 145 | | # Rebuild the linker cache file: |
|---|
| 146 | | |
|---|
| 147 | | ldconfig |
|---|
| 148 | | |
|---|
| 149 | | # Configure the compiler (you may need to correct your version number of the |
|---|
| 150 | | # first one): |
|---|
| 151 | | |
|---|
| 152 | | sed -e 's/<installpackageid>/l_cc_p_9\.0\.021/' \ |
|---|
| 153 | | -i /opt/doc/icc/csupport |
|---|
| 154 | | |
|---|
| 155 | | sed -e 's/<INSTALLDIR>\/licenses/\/opt\/doc\/icc\/licenses/g' \ |
|---|
| 156 | | -e 's/<INSTALLDIR>\/bin/\/opt\/bin/g' \ |
|---|
| 157 | | -e 's/<INSTALLDIR>\/lib/\/opt\/lib/g' -i /opt/bin/icc |
|---|
| 158 | | |
|---|
| 159 | | sed -e 's/<INSTALLDIR>\/licenses/\/opt\/doc\/icc\/licenses/g' \ |
|---|
| 160 | | -e 's/<INSTALLDIR>\/bin/\/opt\/bin/g' \ |
|---|
| 161 | | -e 's/<INSTALLDIR>\/lib/\/opt\/lib/g' \ |
|---|
| 162 | | -e 's/<INSTALLDIR>\/man/\/opt\/man/g' -i /opt/bin/iccvars.csh |
|---|
| 163 | | |
|---|
| 164 | | sed -e 's/<INSTALLDIR>\/licenses/\/opt\/doc\/icc\/licenses/g' \ |
|---|
| 165 | | -e 's/<INSTALLDIR>\/bin/\/opt\/bin/g' \ |
|---|
| 166 | | -e 's/<INSTALLDIR>\/lib/\/opt\/lib/g' \ |
|---|
| 167 | | -e 's/<INSTALLDIR>\/man/\/opt\/man/g' -i /opt/bin/iccvars.sh |
|---|
| 168 | | |
|---|
| 169 | | sed -e 's/<INSTALLDIR>\/licenses/\/opt\/doc\/icc\/licenses/g' \ |
|---|
| 170 | | -e 's/<INSTALLDIR>\/bin/\/opt\/bin/g' \ |
|---|
| 171 | | -e 's/<INSTALLDIR>\/lib/\/opt\/lib/g' -i /opt/bin/icpc |
|---|
| 172 | | |
|---|
| 173 | | source /opt/bin/iccvars.sh |
|---|
| 174 | | |
|---|
| 175 | | # If you get "bash: man: command not found", don't worry about it right now. |
|---|
| 176 | | |
|---|
| 177 | | # Configure the debugger (make sure the version of the first one is correct): |
|---|
| 178 | | |
|---|
| 179 | | sed -e 's/<INSTALLTIMECOMBOPACKAGEID>/l_cc_p_9\.0\.026/' \ |
|---|
| 180 | | -i /opt/doc/idb/idbsupport |
|---|
| 181 | | |
|---|
| 182 | | sed -e 's/<INSTALLDIR>\/licenses/\/opt\/doc\/icc\/licenses/g' \ |
|---|
| 183 | | -e 's/<INSTALLDIR>\/bin/\/opt\/bin/g' \ |
|---|
| 184 | | -e 's/<INSTALLDIR>\/man/\/opt\/man/g' -i /opt/bin/idbvars.csh |
|---|
| 185 | | |
|---|
| 186 | | sed -e 's/<INSTALLDIR>\/licenses/\/opt\/doc\/icc\/licenses/g' \ |
|---|
| 187 | | -e 's/<INSTALLDIR>\/bin/\/opt\/bin/g' \ |
|---|
| 188 | | -e 's/<INSTALLDIR>\/man/\/opt\/man/g' -i /opt/bin/idbvars.sh |
|---|
| 189 | | |
|---|
| 190 | | source /opt/bin/idbvars.sh |
|---|
| 191 | | |
|---|
| 192 | | # For reasons unknown to me, ICC links to libgcc_s.so. On an LFS system |
|---|
| 193 | | # libgcc_s.so is in /usr/lib. Incase you have /usr on a seperate partition we |
|---|
| 194 | | # need to move libgcc_s.so to /lib: |
|---|
| 195 | | |
|---|
| 196 | | cp /usr/lib/libgcc_s.so.1 /lib/libgcc_s.so.1 && |
|---|
| 197 | | ln -s libgcc_s.so.1 /lib/libgcc_s.so && |
|---|
| 198 | | rm -f /usr/lib/libgcc_s.so* |
|---|
| 199 | | |
|---|
| 200 | | # If you plan to use ICC to compile most of the LFS system, the runtime |
|---|
| 201 | | # library should be moved to /lib: |
|---|
| 202 | | |
|---|
| 203 | | mv /opt/lib/libimf.so /lib && |
|---|
| 204 | | ln -s ../../lib/libimf.so /opt/lib/libimf.so |
|---|
| 205 | | |
|---|
| 206 | | # Now we can use the Intel compiler. You should read: |
|---|
| | 185 | # **************************************** |
|---|
| | 186 | # - INSTALLING ICC - Configuring ICC files |
|---|
| | 187 | # **************************************** |
|---|
| | 188 | |
|---|
| | 189 | # The compiler suite is installed. Now we set it up. First install the |
|---|
| | 190 | # license file: |
|---|
| | 191 | |
|---|
| | 192 | install -v -m444 *.lic /usr/share/doc/icc-${ICC_VERSION}/licenses/ |
|---|
| | 193 | |
|---|
| | 194 | # Configure the compiler: |
|---|
| | 195 | |
|---|
| | 196 | sed -e \ |
|---|
| | 197 | "s/<installpackageid>/l_cc_c_${ICC_V_MAJOR}\.${ICC_V_MINOR}\.${ICC_V_PATCH}/" \ |
|---|
| | 198 | -i /usr/share/doc/icc-${ICC_VERSION}/doc/csupport |
|---|
| | 199 | |
|---|
| | 200 | sed -e \ |
|---|
| | 201 | "s/<INSTALLDIR>\/licenses/\/usr\/share\/doc\/icc-${ICC_VERSION}\/licenses/g" \ |
|---|
| | 202 | -e 's/<INSTALLDIR>\/bin/\/usr\/bin/g' \ |
|---|
| | 203 | -e 's/<INSTALLDIR>\/lib/\/usr\/lib/g' -i /usr/bin/icc |
|---|
| | 204 | |
|---|
| | 205 | sed -e \ |
|---|
| | 206 | "s/<INSTALLDIR>\/licenses/\/usr\/share\/doc\/icc-${ICC_VERSION}\/licenses/g" \ |
|---|
| | 207 | -e 's/<INSTALLDIR>\/bin/\/usr\/bin/g' \ |
|---|
| | 208 | -e 's/<INSTALLDIR>\/lib/\/usr\/lib/g' -i /usr/bin/icpc |
|---|
| | 209 | |
|---|
| | 210 | sed -e \ |
|---|
| | 211 | "s/<INSTALLDIR>\/licenses/\/usr\/share\/doc\/icc-${ICC_VERSION}\/licenses/g" \ |
|---|
| | 212 | -e 's/<INSTALLDIR>\/bin/\/usr\/bin/g' \ |
|---|
| | 213 | -e 's/<INSTALLDIR>\/lib/\/usr\/lib/g' \ |
|---|
| | 214 | -e 's/<INSTALLDIR>\/man/\/usr\/share\/man/g' -i /etc/iccvars.csh |
|---|
| | 215 | |
|---|
| | 216 | sed -e \ |
|---|
| | 217 | "s/<INSTALLDIR>\/licenses/\/usr\/share\/doc\/icc-${ICC_VERSION}\/licenses/g" \ |
|---|
| | 218 | -e 's/<INSTALLDIR>\/bin/\/usr\/bin/g' \ |
|---|
| | 219 | -e 's/<INSTALLDIR>\/lib/\/usr\/lib/g' \ |
|---|
| | 220 | -e 's/<INSTALLDIR>\/man/\/usr\/share\/man/g' -i /etc/iccvars.sh |
|---|
| | 221 | |
|---|
| | 222 | source /etc/iccvars.sh |
|---|
| | 223 | |
|---|
| | 224 | # If you get "bash: manpath: command not found", don't worry about it. |
|---|
| | 225 | |
|---|
| | 226 | # Configure the Intel debugger: |
|---|
| | 227 | |
|---|
| | 228 | sed -e \ |
|---|
| | 229 | "s/<installpackageid>/l_cc_c_${ICC_V_MAJOR}\.${ICC_V_MINOR}\.${ICC_V_PATCH}/" \ |
|---|
| | 230 | -i /usr/share/doc/idb-${ICC_VERSION}/idbsupport |
|---|
| | 231 | |
|---|
| | 232 | sed -e \ |
|---|
| | 233 | "s/<INSTALLDIR>\/licenses/\/usr\/share\/doc\/icc-${ICC_VERSION}\/licenses/g" \ |
|---|
| | 234 | -e 's/<INSTALLDIR>\/bin/\/usr\/bin/g' \ |
|---|
| | 235 | -e 's/<INSTALLDIR>\/man/\/usr\/share\/man/g' -i /etc/idbvars.csh |
|---|
| | 236 | |
|---|
| | 237 | sed -e \ |
|---|
| | 238 | "s/<INSTALLDIR>\/licenses/\/usr\/share\/doc\/icc-${ICC_VERSION}\/licenses/g" \ |
|---|
| | 239 | -e 's/<INSTALLDIR>\/bin/\/usr\/bin/g' \ |
|---|
| | 240 | -e 's/<INSTALLDIR>\/man/\/usr\/share\/man/g' -i /etc/idbvars.sh |
|---|
| | 241 | |
|---|
| | 242 | source /etc/idbvars.sh |
|---|
| | 243 | |
|---|
| | 244 | # - INSTALLING ICC - Configuring system files: |
|---|
| | 245 | |
|---|
| | 246 | # ICC links programs to libgcc_s.so. On an LFS system libgcc_s.so is in |
|---|
| | 247 | # /usr/lib. On some systems libgcc_s.so is in /lib. If you plan to install |
|---|
| | 248 | # software built with ICC to /bin or /sbin, you should move libgcc_s.so to |
|---|
| | 249 | # /lib if it is not already there (this is recommended): |
|---|
| | 250 | |
|---|
| | 251 | mv -v /usr/lib/libgcc_s.so.1 /lib/ && |
|---|
| | 252 | rm -v /usr/lib/libgcc_s.so && |
|---|
| | 253 | ln -vs libgcc_s.so.1 /lib/libgcc_s.so |
|---|
| | 254 | |
|---|
| | 255 | # We also need to tell ICC where to find the headers we installed to |
|---|
| | 256 | # /usr/include/icc: |
|---|
| | 257 | |
|---|
| | 258 | echo "-I/usr/include/icc" >> /usr/bin/icc.cfg |
|---|
| | 259 | echo "-I/usr/include/icc" >> /usr/bin/icpc.cfg |
|---|
| | 260 | echo "-I/usr/include/icc/c++" >> /usr/bin/icpc.cfg |
|---|
| | 261 | |
|---|
| | 262 | # Now we can use the Intel compiler. |
|---|
| | 263 | |
|---|
| | 264 | # Test ICC to see that it is working: |
|---|
| | 265 | |
|---|
| | 266 | echo "int main () {return 0;}" > /tmp/main.c && |
|---|
| | 267 | icc -o /tmp/main /tmp/main.c && |
|---|
| | 268 | /tmp/main && |
|---|
| | 269 | rm /tmp/main{,.c} |
|---|
| | 270 | |
|---|
| | 271 | # If there are no errors then it worked. |
|---|
| | 272 | |
|---|
| | 273 | # You can unset these now: |
|---|
| | 274 | |
|---|
| | 275 | unset ICC_VERSION ICC_V_MAJOR ICC_V_MINOR ICC_V_PATCH |
|---|
| | 276 | |
|---|
| | 277 | # Now we can configure the system to use ICC. |
|---|
| | 278 | |
|---|
| | 279 | # Configure a GNU autoconf site file for ICC. This makes this hint shorter, |
|---|
| | 280 | # and our lives easier. GNU ./configure scripts will search for |
|---|
| | 281 | # "${prefix}/share/config.site" and use it to source environment variables. |
|---|
| | 282 | # Alternately you can put, and name, the "config.site" anywhere and set |
|---|
| | 283 | # the CONFIG_SITE environment variable to point to it: |
|---|
| | 284 | |
|---|
| | 285 | cat > /usr/share/config.site-icc << "EOF" |
|---|
| | 286 | CC="icc" |
|---|
| | 287 | CXX="icpc" |
|---|
| | 288 | LD="xild" |
|---|
| | 289 | AR="xiar" |
|---|
| | 290 | LANG="en" |
|---|
| | 291 | LANGUAGE="en" |
|---|
| | 292 | LC_ALL="C" |
|---|
| | 293 | EOF |
|---|
| | 294 | |
|---|
| | 295 | # If you want to build most of your LFS system with ICC you should export |
|---|
| | 296 | # this site configuration: |
|---|
| | 297 | |
|---|
| | 298 | export CONFIG_SITE="/usr/share/config.site-icc" |
|---|
| | 299 | |
|---|
| | 300 | # If you only want to use ICC for specific packages then you can use this: |
|---|
| | 301 | |
|---|
| | 302 | env CONFIG_SITE="/usr/share/config.site-icc" ./configure... |
|---|
| | 303 | |
|---|
| | 304 | # *************** |
|---|
| | 305 | # - Optimizations |
|---|
| | 306 | # *************** |
|---|
| | 307 | |
|---|
| | 308 | # Now you can read the ICC man pages for more information about its features |
|---|
| | 309 | # and usage. |
|---|
| | 310 | |
|---|
| | 311 | # You should also look at: |
|---|
| 209 | | # And figure out your CFLAGS, if you are using CFLAGS. You can't use |
|---|
| 210 | | # -fomit-frame-pointer or -pipe, and a few others. For the sake of this hint, |
|---|
| 211 | | # and copy pasting, lets set special ICC CFLAGS now. On my Prescott I use this: |
|---|
| 212 | | |
|---|
| 213 | | export ICC_CFLAGS="-ip -xP -O3" |
|---|
| 214 | | export ICC_CXXFLAGS="$ICC_CFLAGS" |
|---|
| 215 | | |
|---|
| 216 | | # Interprocedural optimizations (IPO) is a fantastic feature which optimizes |
|---|
| 217 | | # executables at link time. This allows the compiler to make better judgements. |
|---|
| 218 | | # A similiar option was added to GCC-4.1, -fwhole-program --combine. Using this |
|---|
| 219 | | # option is a bit touchy though. The -ipo flag can only be used on executables, |
|---|
| 220 | | # and not static libraries. Almost every package has static libraries which are |
|---|
| 221 | | # linked into the programs during the build. The HLFS book happens to use the |
|---|
| 222 | | # -fpie option which has the same requirements. To use the ICC -ipo option, check |
|---|
| 223 | | # the HLFS book for the sed commands which add -fpie to Makefile.in's. Replace the |
|---|
| 224 | | # "-pie -fpie" with "-ipo". The sed command for each package is different. |
|---|
| 225 | | # Unfortunetly these commands are not available for most of the BLFS packages. |
|---|
| 226 | | |
|---|
| 227 | | # Run this to break GCC compatability (some packages need this): |
|---|
| 228 | | |
|---|
| 229 | | echo "-no-gcc" >> /opt/bin/icc.cfg |
|---|
| 230 | | |
|---|
| 231 | | # Libraries compiled with ICC should get -gcc added to CFLAGS, so that |
|---|
| 232 | | # programs compiled with GCC can use the libraries compiled with ICC. |
|---|
| 233 | | |
|---|
| 234 | | # INSTALLING PACKAGES (Chapter 6): |
|---|
| 235 | | |
|---|
| 236 | | # Use the GCC4 patches from LFS. |
|---|
| 237 | | |
|---|
| 238 | | # For every package built with ICC make sure to run the testsuite because this |
|---|
| 239 | | # is still expirmental. If one or more tests fail, retry with GCC. If the |
|---|
| 240 | | # results are better with GCC, then use GCC. |
|---|
| 241 | | |
|---|
| 242 | | # Don't worry about: |
|---|
| 243 | | # "icc: warning: PGOPTI instrumentation disables IP optimizations" |
|---|
| 244 | | # This warning is given when using -ip (-fomit-frame-pointer) while generating |
|---|
| 245 | | # code profiles. -ip will work with the second build. |
|---|
| 246 | | |
|---|
| 247 | | # To keep this hint shorter, I won't give complete instructions for every |
|---|
| 248 | | # package, but I'll give notes where needed. |
|---|
| 249 | | |
|---|
| 250 | | # To use ICC profiling we need to add "-prof_gen" and "-prof_dir=$(pwd)" to |
|---|
| 251 | | # CFLAGS/CXXFLAGS for the first build. Then run 'make check' in order to run the |
|---|
| 252 | | # programs and generate profiling data. If you are able to run the programs better |
|---|
| 253 | | # than how 'make check' does, then I suggest you do that. Then 'make clean', and |
|---|
| 254 | | # make again with "-prof_use". You can run 'make check' again if you like, and |
|---|
| 255 | | # finally 'make install'. |
|---|
| 256 | | |
|---|
| 257 | | # In general, use this: |
|---|
| 258 | | |
|---|
| 259 | | env CFLAGS="$ICC_CFLAGS -prof_gen -prof_dir=$(pwd)" \ |
|---|
| 260 | | CXXFLAGS="$ICC_CXXFLAGS -prof_gen -prof_dir=$(pwd)" LC_ALL="C" \ |
|---|
| 261 | | LANG="en" LANGUAGE="en" CC="icc" CXX="icpc" ./configure... |
|---|
| 262 | | |
|---|
| 263 | | # Then 'make && make check && make clean', and final build with: |
|---|
| 264 | | |
|---|
| 265 | | env CFLAGS="$ICC_CFLAGS -prof_use -prof_dir=$(pwd)" \ |
|---|
| 266 | | CXXFLAGS="$ICC_CXXFLAGS -prof_use -prof_dir=$(pwd)" LC_ALL="C" \ |
|---|
| 267 | | LANG="en" LANGUAGE="en" CC="icc" CXX="icpc" ./configure... |
|---|
| 268 | | |
|---|
| 269 | | # Then 'make && make install'. |
|---|
| 270 | | |
|---|
| 271 | | # DB can not be compiled with ICC. |
|---|
| 272 | | |
|---|
| 273 | | # Coreutils can compile with ICC profiling. |
|---|
| 274 | | |
|---|
| 275 | | # Zlib can compile with ICC, but X11 will not be able to link to it, so I do not |
|---|
| 276 | | # suggest it. |
|---|
| 277 | | |
|---|
| 278 | | # Mktemp can compile with ICC profiling. |
|---|
| 279 | | |
|---|
| 280 | | # Iana-Etc has no C/C++ code. |
|---|
| 281 | | |
|---|
| 282 | | # Findutils can be compiled with ICC profiling. |
|---|
| 283 | | |
|---|
| 284 | | # Gawk can compile with ICC profiling. |
|---|
| 285 | | |
|---|
| 286 | | # Ncurses can compile with ICC profiling. We add the -gcc flag because Ncurses |
|---|
| 287 | | # is a library. Ncurses also has C++ code, so CXX flags are also added. |
|---|
| 288 | | |
|---|
| 289 | | # Readline can compile with ICC profiling, and because it is a library -gcc |
|---|
| 290 | | # needs to be added to CFLAGS. |
|---|
| 291 | | |
|---|
| 292 | | # Vim can compile with ICC profiling. |
|---|
| 293 | | |
|---|
| 294 | | # M4 can compile with ICC profiling. |
|---|
| 295 | | |
|---|
| 296 | | # Bison can compile with ICC profiling. |
|---|
| 297 | | |
|---|
| 298 | | # Less can compile with ICC profiling. |
|---|
| 299 | | |
|---|
| 300 | | # Groff can compile with ICC profiling. |
|---|
| 301 | | |
|---|
| 302 | | # Sed can compile with ICC profiling. |
|---|
| 303 | | |
|---|
| 304 | | # Flex can compile with ICC profiling. |
|---|
| 305 | | |
|---|
| 306 | | # Gettext can compile with ICC profiling, but because it's a library add -gcc. |
|---|
| 307 | | |
|---|
| 308 | | # Inetutils can compile with ICC profiling. |
|---|
| 309 | | |
|---|
| 310 | | # For Iproute2 do (Iproute2 needs -gcc): |
|---|
| 311 | | |
|---|
| 312 | | sed -e 's/gcc/icc/g' -i Makefile && |
|---|
| 313 | | sed -e "s|^CCOPTS .*$|& $ICC_CFLAGS -gcc -prof_gen -prof_dir=/tmp|" \ |
|---|
| 314 | | -i Makefile |
|---|
| 315 | | |
|---|
| 316 | | # Then 'make' and 'make clean', and: |
|---|
| 317 | | |
|---|
| 318 | | sed -e 's/prof_gen/prof_use/g' -i Makefile |
|---|
| 319 | | |
|---|
| 320 | | # And 'make' and 'make install'. |
|---|
| 321 | | |
|---|
| 322 | | # Warning! Building Perl with profiling has frozen my desktop, beware. |
|---|
| 323 | | # Perl can compile with ICC profiling. After 'make distclean' you will have to |
|---|
| 324 | | # run ./configure again, substituting -prof_gen with -prof_use. |
|---|
| 325 | | |
|---|
| 326 | | # Texinfo can compile with ICC profiling. |
|---|
| 327 | | |
|---|
| 328 | | # Autoconf and Automake are scripts, and do not need to be compiled with ICC. |
|---|
| 329 | | |
|---|
| 330 | | # Bash compiles with ICC but will crash at runtime. Do not compile Bash with |
|---|
| 331 | | # ICC. |
|---|
| 332 | | |
|---|
| 333 | | # File can compile with ICC profiling. |
|---|
| 334 | | |
|---|
| 335 | | # Libtool can compile with ICC profiling. |
|---|
| 336 | | |
|---|
| 337 | | # For Bzip2 do this after applying the patches (add -gcc to the library): |
|---|
| 338 | | |
|---|
| 339 | | sed -e 's|gcc|icc|g' -i Makefile* && |
|---|
| 340 | | sed -e "s|^CFLAGS.*$|& $ICC_CFLAGS -prof_gen -prof_dir=/tmp|g" -i Makefile && |
|---|
| 341 | | sed -e "s|^CFLAGS.*$|& $ICC_CFLAGS -prof_gen -prof_dir=/tmp -gcc|g" \ |
|---|
| 342 | | -i Makefile-libbz2_so |
|---|
| 343 | | |
|---|
| 344 | | # After 'make clean': |
|---|
| 345 | | |
|---|
| 346 | | make && |
|---|
| 347 | | make -f Makefile-libbz2_so clean && |
|---|
| 348 | | sed -e 's/prof_gen/prof_use/g' -i Makefile* && |
|---|
| 349 | | make -f Makefile-libbz2_so && |
|---|
| 350 | | make clean |
|---|
| 351 | | |
|---|
| 352 | | # Then run 'make' and 'make install'. |
|---|
| 353 | | |
|---|
| 354 | | # Diffutils can compile with ICC profiling. |
|---|
| 355 | | |
|---|
| 356 | | # - For Kbd, after running ./configure, make like this: |
|---|
| 357 | | |
|---|
| 358 | | make CC="icc" CFLAGS="$ICC_CFLAGS -prof_gen -prof_dir=$(pwd)" && |
|---|
| 359 | | make clean && |
|---|
| 360 | | make CC="icc" CFLAGS="$ICC_CFLAGS -prof_use -prof_dir=$(pwd)" |
|---|
| 361 | | |
|---|
| 362 | | # E2fsprogs can compile with ICC profiling. We have to re-run ./configure |
|---|
| 363 | | # like with Perl, substituting -prof_gen with -prof_use on the second pass. |
|---|
| 364 | | |
|---|
| 365 | | # Grep can compile with ICC profiling. |
|---|
| 366 | | |
|---|
| 367 | | # Grub does not compile with ICC. |
|---|
| 368 | | |
|---|
| 369 | | # Gzip can compile with ICC profiling. |
|---|
| 370 | | |
|---|
| 371 | | # Hotplug has no C code. |
|---|
| 372 | | |
|---|
| 373 | | # Man doesn't do profiling, but can compile with ICC: |
|---|
| 374 | | |
|---|
| 375 | | make CC="icc" CFLAGS="$ICC_CFLAGS" |
|---|
| 376 | | |
|---|
| 377 | | # Make can compile with ICC profiling. |
|---|
| 378 | | |
|---|
| 379 | | # - For Module-init-tools you will need to use a patch to disable the static |
|---|
| 380 | | # linking of insmod: |
|---|
| 381 | | # http://www.linuxfromscratch.org/patches/downloads/module-init-tools/\ |
|---|
| 382 | | # module-init-tools-3.2.1-nostatic-1.patch |
|---|
| 383 | | |
|---|
| 384 | | # Module-init-tools can compile with ICC profiling. |
|---|
| 385 | | |
|---|
| 386 | | # Patch can compile with ICC profiling. |
|---|
| 387 | | |
|---|
| 388 | | # Procps does not compile with ICC. |
|---|
| 389 | | |
|---|
| 390 | | # Psmisc can compile with ICC profiling. |
|---|
| 391 | | |
|---|
| 392 | | # Shadow can compile with ICC profiling. |
|---|
| 393 | | |
|---|
| 394 | | # Sysklogd doesn't do profiling, but can compile with ICC: |
|---|
| 395 | | |
|---|
| 396 | | make CC="icc" CFLAGS="-DSYSV $ICC_CFLAGS" |
|---|
| 397 | | |
|---|
| 398 | | # Sysvinit doesn't do profiling, but can compile with ICC: |
|---|
| 399 | | |
|---|
| 400 | | make -C src CC="icc" CFLAGS="$ICC_CFLAGS -D_GNU_SOURCE" |
|---|
| 401 | | |
|---|
| 402 | | # Tar can compile with ICC profiling. |
|---|
| 403 | | |
|---|
| 404 | | # Udev does not compile with ICC. |
|---|
| 405 | | |
|---|
| 406 | | # Util-linux needs GCC for mkfs.minix. |
|---|
| | 314 | # and: |
|---|
| | 315 | # http://sc.tamu.edu/help/intel/9.0/main_cls/mergedProjects/optaps_cls/whnjs.htm |
|---|
| | 316 | |
|---|
| | 317 | # I scribbled some notes while reading the ICC man page, and posted them here: |
|---|
| | 318 | # http://www.linuxfromscratch.org/~robert/new/icc-cflag-notes.txt |
|---|
| | 319 | |
|---|
| | 320 | # We can add our optimizations to the ICC config file. This is what I use for |
|---|
| | 321 | # my Prescott: |
|---|
| | 322 | |
|---|
| | 323 | # The -xP optimization is just like GCC's -march=prescott: |
|---|
| | 324 | |
|---|
| | 325 | echo "-xP" >> /usr/bin/icc.cfg |
|---|
| | 326 | echo "-xP" >> /usr/bin/icpc.cfg |
|---|
| | 327 | |
|---|
| | 328 | # Note that -axP is just like '-march=i586 -mtune=prescott'. |
|---|
| | 329 | |
|---|
| | 330 | # The -fomit-frame-pointer optimization removes frame pointers from object |
|---|
| | 331 | # code, and makes it perform better. Note that this option makes programs |
|---|
| | 332 | # harder to debug: |
|---|
| | 333 | |
|---|
| | 334 | echo "-fomit-frame-pointer" >> /usr/bin/icc.cfg |
|---|
| | 335 | echo "-fomit-frame-pointer" >> /usr/bin/icpc.cfg |
|---|
| | 336 | |
|---|
| | 337 | # The -mno-ieee-fp optimization disables floating-point precision. This breaks |
|---|
| | 338 | # ANSI conformance but increases performance. This can break some software, |
|---|
| | 339 | # if it does then add -mp to CFLAGS. Note that this option makes programs |
|---|
| | 340 | # harder to debug: |
|---|
| | 341 | |
|---|
| | 342 | echo "-mno-ieee-fp" >> /usr/bin/icc.cfg |
|---|
| | 343 | echo "-mno-ieee-fp" >> /usr/bin/icpc.cfg |
|---|
| | 344 | |
|---|
| | 345 | # The -no-prec-div optimization disables floating-point division computations. |
|---|
| | 346 | # Note that the man page entry for this option is not completely correct, |
|---|
| | 347 | # check google for this option. Note that this option makes programs harder |
|---|
| | 348 | # to debug: |
|---|
| | 349 | |
|---|
| | 350 | echo "-no-prec-div" >> /usr/bin/icc.cfg |
|---|
| | 351 | echo "-no-prec-div" >> /usr/bin/icpc.cfg |
|---|
| | 352 | |
|---|
| | 353 | # The -rcd enabled fast float-to-int conversions. This option breaks ANSI |
|---|
| | 354 | # conformance: |
|---|
| | 355 | |
|---|
| | 356 | echo "-rcd" >> /usr/bin/icc.cfg |
|---|
| | 357 | echo "-rcd" >> /usr/bin/icpc.cfg |
|---|
| | 358 | |
|---|
| | 359 | # This option tells ICC which GCC version to be compatable with: |
|---|
| | 360 | |
|---|
| | 361 | echo "-gcc-version=410" >> /usr/bin/icc.cfg |
|---|
| | 362 | echo "-gcc-version=410" >> /usr/bin/icpc.cfg |
|---|
| | 363 | |
|---|
| | 364 | # Use -no-gcc to break GCC compatability. This will perform better, and some |
|---|
| | 365 | # packages will need this. Libraries compiled with ICC should get -gcc |
|---|
| | 366 | # added to CFLAGS, so that programs compiled with GCC can use the libraries |
|---|
| | 367 | # compiled with ICC. I will provide commands to add -gcc to LFS packages, |
|---|
| | 368 | # but you need to keep this in mind with BLFS packages: |
|---|
| | 369 | |
|---|
| | 370 | echo "-no-gcc" >> /usr/bin/icc.cfg |
|---|
| | 371 | echo "-no-gcc" >> /usr/bin/icpc.cfg |
|---|
| | 372 | |
|---|
| | 373 | # Software-based Speculative Pre-computation (-ssp) performs thread based |
|---|
| | 374 | # prefetching and takes advantage of hyper-threading. This option increases |
|---|
| | 375 | # performance signicicantly. See google for more information. This option |
|---|
| | 376 | # should not go together with -prof_gen, but -prof_use is okay. It might |
|---|
| | 377 | # depend on profrun. This is 5 stage profiling: |
|---|
| | 378 | |
|---|
| | 379 | -prof-gen |
|---|
| | 380 | ./a.out |
|---|
| | 381 | -prof-gen-sampling -prof-use |
|---|
| | 382 | profrun -dcache ./a.out |
|---|
| | 383 | -prof-use -ssp |
|---|
| | 384 | |
|---|
| | 385 | # The newer Pentium4 cpus perform Hardware-based Speculative Pre-computation, |
|---|
| | 386 | # so I have never tried to use the -ssp option. |
|---|
| | 387 | |
|---|
| | 388 | # The -ansi-alias optimization will add additional optimizations but must |
|---|
| | 389 | # only be used if the package adheres to the ISO C Standard. The -strict-ansi |
|---|
| | 390 | # option should be used with -ansi-alias, to make sure the source comforms |
|---|
| | 391 | # to ansi. |
|---|
| | 392 | |
|---|
| | 393 | # Interprocedural optimizations (-ipo) is a fantastic feature which optimizes |
|---|
| | 394 | # code at link time, including expanding inline functions across multiple |
|---|
| | 395 | # files. This is equivilent to combining all the source code into a single |
|---|
| | 396 | # file. This allows the compiler to make better judgements. This option can |
|---|
| | 397 | # be very particular and error prone (at compile time). |
|---|
| | 398 | |
|---|
| | 399 | # The -ipo option can take an integer argument to specify the limit of output |
|---|
| | 400 | # files it can generate. By default the limit is 1. -ipo0 will allow the |
|---|
| | 401 | # compiler to decide how many object files to create depending on their size. |
|---|
| | 402 | |
|---|
| | 403 | # The -Ob2 optimization adds -ip, a subset of -ipo but for single file |
|---|
| | 404 | # compilation, and inlines functions at the compiler's descretion. This |
|---|
| | 405 | # option can be used with all code. |
|---|
| | 406 | |
|---|
| | 407 | # -Ob2, -ip, and -ipo can not be used during profile generation (see below) |
|---|
| | 408 | # and will cause a compiler warning if we try. If you decide not to profile |
|---|
| | 409 | # your packages then you can add -ipo0 or -Ob2 to the icc.cfg and icpc.cfg |
|---|
| | 410 | # files. Using -ipo0 on the command line will supersede -ip and -Ob2 in |
|---|
| | 411 | # icc.cfg. If you do not plan to use profiling then you can add -ipo0 to the |
|---|
| | 412 | # icc.cfg and icpc.cfg files. |
|---|
| | 413 | |
|---|
| | 414 | # The -fast option enables "-O3 -ipo -static -no-prec-div -xP". Make sure |
|---|
| | 415 | # your cpu works with the -xP (pentium4 sse3) optimization before using -fast. |
|---|
| | 416 | # Because this optimization statically links programs I do not suggest building |
|---|
| | 417 | # most packages with it. Statically linked programs do not share virtual |
|---|
| | 418 | # memory, and will eventually consume all memory when most of the system is |
|---|
| | 419 | # statically linked. I do suggest using -fast with programs which are freed |
|---|
| | 420 | # from memory quickly and are not run often, like Bzip2. |
|---|
| | 421 | |
|---|
| | 422 | # The -ipo option does not work with private static libraries, which most |
|---|
| | 423 | # packages have. So -ipo has to be surgically added. |
|---|
| | 424 | |
|---|
| | 425 | # In ICC the -g option will disable the default -O2 optimization, unless |
|---|
| | 426 | # -O1/-O2/-O3 are used on the command line. Setting CFLAGS in the environment |
|---|
| | 427 | # will remove the -g option from most packages. |
|---|
| | 428 | |
|---|
| | 429 | # Packages configured with Libtool add the --with-pic configure switch. This |
|---|
| | 430 | # switch will build both shared and static libraries with -fPIC. We can take |
|---|
| | 431 | # advantage of this by adding -gcc beside -fPIC so that -gcc will only be |
|---|
| | 432 | # added to libraries, and not the programs. There is a disadvantage too. |
|---|
| | 433 | # Static libraries compiled with -fPIC will perform slightly slower, however |
|---|
| | 434 | # in LFS we link almost everything dynamically, so this should not become an |
|---|
| | 435 | # issue. In this hint I will provide instructions to add -gcc beside -fPIC |
|---|
| | 436 | # to make shared libraries GCC compatable, but not the static libraries. If |
|---|
| | 437 | # the static libraries cause issues for you, you should rebuild the package |
|---|
| | 438 | # with --with-pic. This way if you compile programs statically with ICC they |
|---|
| | 439 | # will perform as well as possible. |
|---|
| | 440 | |
|---|
| | 441 | # Profile-guided optimizations works by first compiling a program, or library, |
|---|
| | 442 | # with profile generation (-prof_gen). When that program is executed it will |
|---|
| | 443 | # generate data files with details about how the program works at runtime, |
|---|
| | 444 | # such as which functions are called the most and how they relate to other |
|---|
| | 445 | # functions. Then the program is recompiled to use the profiling data with |
|---|
| | 446 | # -prof_use. This means compiling the package twice, but also means the |
|---|
| | 447 | # installed package will perform as well as possible. You do not have to do |
|---|
| | 448 | # this, but I do. If you choose not to profile your packages you can skip |
|---|
| | 449 | # much of the rest of this hint and simply use the config.site file as-is. |
|---|
| | 450 | |
|---|
| | 451 | # Rather than resetting our CFLAGS twice for every profiled package, it's |
|---|
| | 452 | # easier to use a script. Some packages use 'libtool' to build packages, |
|---|
| | 453 | # and using 'make CC="icc -prof_gen"' for these packages will not work. When |
|---|
| | 454 | # profiling packages I suggest reconfiguring them. Also, some packages do not |
|---|
| | 455 | # use CFLAGS/CXXFLAGS for all components because the package developer may |
|---|
| | 456 | # not want particular parts of the programs optimized. So it is best to modify |
|---|
| | 457 | # the CC/CXX environment variables, instead of CFLAGS/CXXFLAGS, when using |
|---|
| | 458 | # -prof_gen and -prof_use. |
|---|
| | 459 | |
|---|
| | 460 | # The following commands will add the profiling options to a few scripts, |
|---|
| | 461 | # including additional optimizations when profile data is being used: |
|---|
| | 462 | |
|---|
| | 463 | cat > /usr/bin/prof_gen-env << "EOF" |
|---|
| | 464 | unset CONFIG_SITE |
|---|
| | 465 | export LANG="en" |
|---|
| | 466 | export LANGUAGE="en" |
|---|
| | 467 | export LC_ALL="C" |
|---|
| | 468 | export LD="xild" |
|---|
| | 469 | export AR="xiar" |
|---|
| | 470 | export CFLAGS="-O2" |
|---|
| | 471 | export CXXFLAGS="-O2" |
|---|
| | 472 | export CC="icc -prof_gen -prof_dir=$(pwd)" |
|---|
| | 473 | export CXX="icpc -prof_gen -prof_dir=$(pwd)" |
|---|
| | 474 | "$@" |
|---|
| | 475 | EOF |
|---|
| | 476 | chmod -v +x /usr/bin/prof_gen-env |
|---|
| | 477 | |
|---|
| | 478 | cat > /usr/bin/prof_use-env << "EOF" |
|---|
| | 479 | unset CONFIG_SITE |
|---|
| | 480 | export LANG="en" |
|---|
| | 481 | export LANGUAGE="en" |
|---|
| | 482 | export LC_ALL="C" |
|---|
| | 483 | export LD="xild" |
|---|
| | 484 | export AR="xiar" |
|---|
| | 485 | export CFLAGS="-O2 -ipo0" |
|---|
| | 486 | export CXXFLAGS="-O2 -ipo0" |
|---|
| | 487 | export CC="icc -prof_use -prof_dir=$(pwd)" |
|---|
| | 488 | export CXX="icpc -prof_use -prof_dir=$(pwd)" |
|---|
| | 489 | nice -n 19 "$@" |
|---|
| | 490 | EOF |
|---|
| | 491 | chmod -v +x /usr/bin/prof_use-env |
|---|
| | 492 | |
|---|
| | 493 | cat > /usr/bin/prof_use-fast-env << "EOF" |
|---|
| | 494 | unset CONFIG_SITE |
|---|
| | 495 | export LANG="en" |
|---|
| | 496 | export LANGUAGE="en" |
|---|
| | 497 | export LC_ALL="C" |
|---|
| | 498 | export LD="xild" |
|---|
| | 499 | export AR="xiar" |
|---|
| | 500 | export CFLAGS="-O3 -fast -ipo0" |
|---|
| | 501 | export CXXFLAGS="-O3 -fast -ipo0" |
|---|
| | 502 | export CC="icc -prof_use -prof_dir=$(pwd)" |
|---|
| | 503 | export CXX="icpc -prof_use -prof_dir=$(pwd)" |
|---|
| | 504 | nice -n 19 "$@" |
|---|
| | 505 | EOF |
|---|
| | 506 | chmod -v +x /usr/bin/prof_use-fast-env |
|---|
| | 507 | |
|---|
| | 508 | # For some reason most GNU ./configure scripts do not pass environment set |
|---|
| | 509 | # AR to Makefile. We need to use Intel's AR, not GNU's. So we need to create |
|---|
| | 510 | # a 'make' wrapper script which will always override the AR variable. I added |
|---|
| | 511 | # LD for good measure: |
|---|
| | 512 | |
|---|
| | 513 | cat > /usr/bin/icc-make << "EOF" |
|---|
| | 514 | nice make AR="xiar" LD="xild" "$@" |
|---|
| | 515 | EOF |
|---|
| | 516 | chmod -v +x /usr/bin/icc-make |
|---|
| | 517 | |
|---|
| | 518 | # Use 'icc-make' instead of 'make' whenever you are compiling with ICC. |
|---|
| | 519 | |
|---|
| | 520 | # *********************** |
|---|
| | 521 | # - Building LFS packages |
|---|
| | 522 | # *********************** |
|---|
| | 523 | |
|---|
| | 524 | # To build packages without profiling then './configure && icc-make'. The |
|---|
| | 525 | # /usr/share/config.site-icc file will be used. You may want to add |
|---|
| | 526 | # "-O2 -ipo0" to CFLAGS and CXXFLAGS in /usr/share/config.site-icc: |
|---|
| | 527 | |
|---|
| | 528 | echo 'CFLAGS="-ipo0 -O2"' >> /usr/share/config.site-icc |
|---|
| | 529 | echo 'CXXFLAGS="-ipo0 -O2"' >> /usr/share/config.site-icc |
|---|
| | 530 | |
|---|
| | 531 | # Some packages, such as Perl and Bash, generate large amounts of profiling |
|---|
| | 532 | # data. You can expect these packages to use 4GB of storage, and more, during |
|---|
| | 533 | # the build. Packages which generate especially large amounts of profiling |
|---|
| | 534 | # data also take a lot of system resources to process this data. |
|---|
| | 535 | |
|---|
| | 536 | # Some packages do not have testsuites, so we can not easily generate profiling |
|---|
| | 537 | # data for them. With small packages we can manually run common commands to |
|---|
| | 538 | # generating the profiling data. |
|---|
| | 539 | |
|---|
| | 540 | # Beware I have frozen my system while computing profiling data (with Perl). |
|---|
| | 541 | # Since then I began using 'nice -n 19' when using -prof_use, and have not |
|---|
| | 542 | # frozen my system since. You can renice your whole login... first find your |
|---|
| | 543 | # process ID for your LFS chroot with 'ps a | grep /tools/bin/bash', and then |
|---|
| | 544 | # 'renice 10 -p ???'. |
|---|
| | 545 | |
|---|
| | 546 | # The truely best way to generate profiling data is to install the programs. |
|---|
| | 547 | # This way the program will be profiled against your specific system and uses. |
|---|
| | 548 | # If you wish to do this, I'll let you modify the following instructions. You |
|---|
| | 549 | # will need to store the profiling data in a dedicated directory, like |
|---|
| | 550 | # /home/icc/prof_data/coreutils, reboot the system and run it normally for a |
|---|
| | 551 | # few days, then rebuild with make-icc-prof_use (-prof_use). I have never |
|---|
| | 552 | # tried this. |
|---|
| | 553 | |
|---|
| | 554 | # In general, to profile packages, we would do something like this: |
|---|
| | 555 | |
|---|
| | 556 | prof_gen-env ./configure && |
|---|
| | 557 | icc-make && |
|---|
| | 558 | icc-make check && |
|---|
| | 559 | icc-make distclean && |
|---|
| | 560 | prof_use-env ./configure && |
|---|
| | 561 | icc-make && |
|---|
| | 562 | icc-make install |
|---|
| | 563 | |
|---|
| | 564 | # Packages (in the "Linux From Scratch - Version SVN-20061029" order): |
|---|
| | 565 | |
|---|
| | 566 | # You should unset environment CFLAGS/CXXFLAGS, if you set them, so that |
|---|
| | 567 | # ICC will use the optimizations in the icc config files. |
|---|
| | 568 | |
|---|
| | 569 | # You should also run the testsuies whether you are using profiling or not. |
|---|
| | 570 | |
|---|
| | 571 | # - Berkeley DB (and TCL) |
|---|
| | 572 | # DB compiles with ICC, but the testsuite does not work without a full |
|---|
| | 573 | # installation of TCL. Berkeley DB's testsuite takes about 150 SBU (many hours) |
|---|
| | 574 | # to complete. If you are not prepared to do that then simply install Berkeley |
|---|
| | 575 | # DB without profiling, like the LFS book does. These tests will also use |
|---|
| | 576 | # about 4GB of space. |
|---|
| | 577 | |
|---|
| | 578 | # If you want to profile Berkeley DB then install TCL from the BLFS book. |
|---|
| | 579 | # Berkeley DB and TCL contain libraries, so you may want to add the -gcc |
|---|
| | 580 | # option. I built my system using ICC as much as possible, so I did not build |
|---|
| | 581 | # these libraries with -gcc because I have no compatability to worry about. |
|---|
| | 582 | # TCL can also be profiled with ICC. If you want GCC compatability with TCL's |
|---|
| | 583 | # libraries then run this command: |
|---|
| | 584 | |
|---|
| | 585 | sed -e 's/-.*PIC/& -gcc /' -i unix/configure |
|---|
| | 586 | |
|---|
| | 587 | # To profile TCL (make sure the ./configure --options are the same as in the |
|---|
| | 588 | # BLFS book): |
|---|
| | 589 | |
|---|
| | 590 | cd unix && |
|---|
| | 591 | prof_gen-env ./configure --prefix=/usr --enable-threads && |
|---|
| | 592 | icc-make && |
|---|
| | 593 | icc-make test |
|---|
| | 594 | |
|---|
| | 595 | # TCL will fail several tests because networking does not work, and will also |
|---|
| | 596 | # complain about the profiling data files being left behind, that's fine. Then |
|---|
| | 597 | # rebuild TCL to use the profile data and -ipo: |
|---|
| | 598 | |
|---|
| | 599 | icc-make distclean && |
|---|
| | 600 | prof_use-env ./configure --prefix=/usr --enable-threads && |
|---|
| | 601 | icc-make |
|---|
| | 602 | |
|---|
| | 603 | # You can 'make test' again if you're paranoid. Then install TCL. |
|---|
| | 604 | |
|---|
| | 605 | # We need GCC compatability with Berkeley DB libraries for Man-DB: |
|---|
| | 606 | |
|---|
| | 607 | sed -e 's/-.*PIC/& -gcc /' -i dist/configure |
|---|
| | 608 | |
|---|
| | 609 | # Build Berkeley DB just like TCL, with the prof_gen-env and prof_use-env |
|---|
| | 610 | # scripts. Also add TCL and tests to the configure command: |
|---|
| | 611 | |
|---|
| | 612 | cd build_unix && |
|---|
| | 613 | prof_gen-env ../dist/configure --prefix=/usr --enable-cxx \ |
|---|
| | 614 | --enable-tcl --with-tcl=/usr/lib --enable-test && |
|---|
| | 615 | icc-make |
|---|
| | 616 | |
|---|
| | 617 | # Then to run the testsuite open the tclsh shell: |
|---|
| | 618 | |
|---|
| | 619 | tclsh |
|---|
| | 620 | |
|---|
| | 621 | # At the % promt run the tests (this will take hours): |
|---|
| | 622 | |
|---|
| | 623 | source ../test/test.tcl |
|---|
| | 624 | run_parallel 5 run_std |
|---|
| | 625 | exit |
|---|
| | 626 | |
|---|
| | 627 | # Then clean Berkeley DB and rebuild: |
|---|
| | 628 | |
|---|
| | 629 | icc-make realclean && |
|---|
| | 630 | prof_gen-env ../dist/configure --prefix=/usr --enable-cxx \ |
|---|
| | 631 | --enable-tcl --with-tcl=/usr/lib && |
|---|
| | 632 | icc-make |
|---|
| | 633 | |
|---|
| | 634 | # Then install Berkeley DB. |
|---|
| | 635 | |
|---|
| | 636 | # - E2fsprogs |
|---|
| | 637 | # E2fsprogs does not build properly with ICC. Build E2fsprogs with GCC: |
|---|
| | 638 | |
|---|
| | 639 | env -u CONFIG_SITE ../configure... |
|---|
| | 640 | make |
|---|
| | 641 | |
|---|
| | 642 | # - Coreutils |
|---|
| | 643 | # Build Coreutils with profiling: |
|---|
| | 644 | |
|---|
| | 645 | prof_gen-env ./configure --prefix=/usr && |
|---|
| | 646 | icc-make |
|---|
| | 647 | |
|---|
| | 648 | # Then run the testsuite, distclean, and rebuild with the profiling |
|---|
| | 649 | # information: |
|---|
| | 650 | |
|---|
| | 651 | prof_use-env ./configure --prefix=/usr && |
|---|
| | 652 | icc-make |
|---|
| | 653 | |
|---|
| | 654 | # Then install Coreutils. |
|---|
| | 655 | |
|---|
| | 656 | # - Iana-Etc has nothing to compile. |
|---|
| | 657 | |
|---|
| | 658 | # - M4 |
|---|
| | 659 | # M4 is typical. Build and install it just like Coreutils. |
|---|
| | 660 | |
|---|
| | 661 | # - Bison: |
|---|
| | 662 | # Bison is a typical build, like M4. |
|---|
| | 663 | |
|---|
| | 664 | # - Ncurses |
|---|
| | 665 | # Ncurses builds with ICC, but I had serious issues with Bash. So for now |
|---|
| | 666 | # I suggest building Ncurses with GCC: |
|---|
| | 667 | |
|---|
| | 668 | env -u CONFIG_SITE ./configure... |
|---|
| | 669 | |
|---|
| | 670 | # - Procps does not compile with ICC. It will compile with GCC by default. |
|---|
| | 671 | # If you really want a pure ICC system, you can use the Procps utilities from |
|---|
| | 672 | # Busybox. |
|---|
| | 673 | |
|---|
| | 674 | # - Sed |
|---|
| | 675 | # I compile Sed with -fast. If you don't want to, and/or you are not using |
|---|
| | 676 | # the -xP optimization, then build Sed like Coreutils. To build Sed with |
|---|
| | 677 | # -fast: |
|---|
| | 678 | |
|---|
| | 679 | prof_gen-env ./configure... |
|---|
| | 680 | icc-make |
|---|
| | 681 | icc-make check |
|---|
| | 682 | icc-make distclean |
|---|
| | 683 | prof_use-fast-env ./configure... |
|---|
| | 684 | icc-make |
|---|
| | 685 | |
|---|
| | 686 | # Then install Sed. |
|---|
| | 687 | |
|---|
| | 688 | # - Libtool |
|---|
| | 689 | # 'libtool' itself is a script, but the package includes a library. To add |
|---|
| | 690 | # GCC compatability (this is optional): |
|---|
| | 691 | |
|---|
| | 692 | sed -e 's/^CFLAGS =/& -gcc/' -i libltdl/Makefile.in |
|---|
| | 693 | |
|---|
| | 694 | # Then profile Libtool like Coreutils, but use 'make clean' instead of |
|---|
| | 695 | # 'distclean'. |
|---|
| | 696 | |
|---|
| | 697 | # - Perl |
|---|
| | 698 | # Since I started using AR="xiar" I have not been able to get Perl to build |
|---|
| | 699 | # with ICC. Even without AR="xiar" Perl will fail a couple tests. For these |
|---|
| | 700 | # reasons I suggest building Perl with GCC. Just build Perl normally, it will |
|---|
| | 701 | # ignore the config.site file. |
|---|
| | 702 | |
|---|
| | 703 | # - Readline |
|---|
| | 704 | # Readline is a library and you may want to add -gcc (I don't): |
|---|
| | 705 | |
|---|
| | 706 | sed -e 's/^CFLAGS =/& -gcc/' -i {,shlib/}Makefile.in |
|---|
| | 707 | |
|---|
| | 708 | # Readline does not have a testsuite, so it can not easily be profiled. Build |
|---|
| | 709 | # it normally and it will use the config.site file to use ICC. Remember to |
|---|
| | 710 | # use 'icc-make'. |
|---|
| | 711 | |
|---|
| | 712 | # - Zlib can compile with ICC, but X11 will not be able to link to it even if |
|---|
| | 713 | # -gcc is used, so I do not suggest it. To build Zlib with GCC: |
|---|
| | 714 | |
|---|
| | 715 | env -u CONFIG_SITE ./configure... |
|---|
| | 716 | |
|---|
| | 717 | # - Autoconf and Automake are perl scripts. |
|---|
| | 718 | |
|---|
| | 719 | # - Bash |
|---|
| | 720 | # Bash-3.1 can compile with ICC, and bash-3.2 does not. I do not suggest |
|---|
| | 721 | # using Bash-3.2 because I had bad expirence with it (it's screwy). |
|---|
| | 722 | # Bash-3.1 can be built with profiling, but not with -ipo. Remember to use |
|---|
| | 723 | # the bash-3.1 upstream patch. The Bash sources directory will grow to almost |
|---|
| | 724 | # 3GB with profiling data. Build Bash like this: |
|---|
| | 725 | |
|---|
| | 726 | prof_gen-env ./configure... |
|---|
| | 727 | icc-make |
|---|
| | 728 | icc-make tests |
|---|
| | 729 | icc-make distclean |
|---|
| | 730 | nice -n 19 env -u CONFIG_SITE LANG="en" LANGUAGE="en" LC_ALL="C" \ |
|---|
| | 731 | LD="xild" AR="xiar" CC="icc -prof_use -prof_dir=$(pwd)" \ |
|---|
| | 732 | ./configure... |
|---|
| | 733 | icc-make |
|---|
| | 734 | |
|---|
| | 735 | # Then install Bash. |
|---|
| | 736 | |
|---|
| | 737 | # - Bzip2 |
|---|
| | 738 | # I'm building bzip2.so,a with -ipo, and bzip2 and bzip2recover with -fast. |
|---|
| | 739 | # If you are not using -xP then change -fast to -ipo0. |
|---|
| | 740 | |
|---|
| | 741 | icc-make CC=icc CFLAGS="-prof_gen -prof_dir=$(pwd) \ |
|---|
| | 742 | -D_FILE_OFFSET_BITS=64 -O2" \ |
|---|
| | 743 | AR=xiar LD=xild -f Makefile-libbz2_so && |
|---|
| | 744 | icc-make clean && |
|---|
| | 745 | icc-make CC=icc CFLAGS="-prof_gen -prof_dir=$(pwd) \ |
|---|
| | 746 | -D_FILE_OFFSET_BITS=64 -O2" \ |
|---|
| | 747 | AR=xiar LD=xild |
|---|
| | 748 | |
|---|
| | 749 | # The bzip2 testsuite tests the bzip2 which has libbz2.a linked to it, so |
|---|
| | 750 | # the libbz2.so shared libraries doesn't get tested and doesn't generate |
|---|
| | 751 | # profiling data. We can do this ourselves: |
|---|
| | 752 | |
|---|
| | 753 | dd if=/dev/urandom of=urandom.file bs=1M count=17 |
|---|
| | 754 | env LD_PRELOAD=./libbz2.so.1.0 ./bzip2-shared urandom.file |
|---|
| | 755 | env LD_PRELOAD=./libbz2.so.1.0 ./bzip2-shared -d urandom.file.bz2 |
|---|
| | 756 | cat CHANGES LICENSE bzip2 | \ |
|---|
| | 757 | env LD_PRELOAD=./libbz2.so.1.0 ./bzip2-shared -4 -c > non-random.bz2 |
|---|
| | 758 | env LD_PRELOAD=./libbz2.so.1.0 ./bzip2-shared -d non-random.bz2 |
|---|
| | 759 | env LD_PRELOAD=./libbz2.so.1.0 ./bzip2-shared --help |
|---|
| | 760 | |
|---|
| | 761 | # Then rebuild Bzip2 with the profiling data: |
|---|
| | 762 | |
|---|
| | 763 | icc-make clean && |
|---|
| | 764 | icc-make -f Makefile-libbz2_so clean && |
|---|
| | 765 | icc-make CC=icc CFLAGS="-prof_use -prof_dir=$(pwd) -O -gcc -ipo0 -O2 \ |
|---|
| | 766 | -D_FILE_OFFSET_BITS=64" AR=xiar LD=xild -f Makefile-libbz2_so && |
|---|
| | 767 | icc-make clean && |
|---|
| | 768 | icc-make CC=icc CFLAGS="-prof_use -prof_dir=$(pwd) -D_FILE_OFFSET_BITS=64 \ |
|---|
| | 769 | -ipo0 -fast" AR=xiar LD=xild |
|---|
| | 770 | |
|---|
| | 771 | # Then when installing bzip2, do not install the 'bzip2-shared' version, |
|---|
| | 772 | # install the statically linked (with -fast) 'bzip2' file instead. |
|---|
| | 773 | |
|---|
| | 774 | # - Diffutils does not have a testsuite. You can build it with ICC the way the |
|---|
| | 775 | # LFS book builds Diffutils. Remember to use 'icc-make'. |
|---|
| | 776 | |
|---|
| | 777 | # - File |
|---|
| | 778 | # File builds with ICC, and does not have a testsuite, just like Diffutils. |
|---|
| | 779 | |
|---|
| | 780 | # - Findutils |
|---|
| | 781 | # Findutils can be compiled with ICC profiling, just like Coreutils or M4. |
|---|
| | 782 | # I compile Findutils with -fast because 'find' and 'locate' usually do |
|---|
| | 783 | # intense operations and don't stay in memory after. To build Findutils with |
|---|
| | 784 | # -fast: |
|---|
| | 785 | |
|---|
| | 786 | prof_gen-env ./configure... |
|---|
| | 787 | icc-make |
|---|
| | 788 | icc-make check |
|---|
| | 789 | icc-make distclean |
|---|
| | 790 | prof_use-fast-env ./configure... |
|---|
| | 791 | icc-make |
|---|
| | 792 | |
|---|
| | 793 | # Then install Findutils. |
|---|
| | 794 | |
|---|
| | 795 | # - Flex |
|---|
| | 796 | # Build and install Flex typically, like Coreutils and M4. |
|---|
| | 797 | |
|---|
| | 798 | # - Grub does not compile with ICC: |
|---|
| | 799 | |
|---|
| | 800 | env -u CONFIG_SITE ./configure... |
|---|
| | 801 | |
|---|
| | 802 | # - Gawk |
|---|
| | 803 | # Build and install Gawk typically, like Flex. I used -fast with Gawk, via |
|---|
| | 804 | # prof_use-fast-env. |
|---|
| | 805 | |
|---|
| | 806 | sed -e 's/CFLAGS =/& -fast/' -i {,awklib/}Makefile && |
|---|
| | 807 | make-icc-prof_use |
|---|
| | 808 | |
|---|
| | 809 | # Then install Gawk. |
|---|
| | 810 | |
|---|
| | 811 | # - Gettext |
|---|
| | 812 | # Gettext contains libraries, so you may want to add -gcc (I don't): |
|---|
| | 813 | |
|---|
| | 814 | find gettext-runtime/ -name Makefile.in \ |
|---|
| | 815 | -exec sed -e 's/^CFLAGS =/& -gcc/' -i {} \; |
|---|
| | 816 | |
|---|
| | 817 | # I couldn't get Gettext to build with -ipo, but it builds with profiling. |
|---|
| | 818 | # After 'make distclean': |
|---|
| | 819 | |
|---|
| | 820 | nice -n 19 env -u CONFIG_SITE LANG="en" LANGUAGE="en" LC_ALL="C" \ |
|---|
| | 821 | LD="xild" AR="xiar" CC="icc -prof_use -prof_dir=$(pwd)" ./configure.. |
|---|
| | 822 | |
|---|
| | 823 | # - Grep |
|---|
| | 824 | # Build and install Grep typically. I used -fast for Grep too. |
|---|
| | 825 | |
|---|
| | 826 | # - Groff |
|---|
| | 827 | # Groff does not build with -ipo, and does not have a testsuite. Build Groff |
|---|
| | 828 | # like this: |
|---|
| | 829 | |
|---|
| | 830 | env -u CONFIG_SITE CC="icc" CXX="icpc" LD="xild" AR="xiar" \ |
|---|
| | 831 | LANG="en" LANGUAGE="en" LC_ALL="C" ... |
|---|
| | 832 | |
|---|
| | 833 | # Remember to use 'icc-make'. |
|---|
| | 834 | |
|---|
| | 835 | # - Gzip |
|---|
| | 836 | # Gzip doesn't have a testsuite, but we can mimick one: |
|---|
| | 837 | |
|---|
| | 838 | dd if=/dev/urandom of=urandom.file bs=2M count=10 |
|---|
| | 839 | ./gzip -9 urandom.file |
|---|
| | 840 | ./gzip -d urandom.file.gz |
|---|
| | 841 | cat AUTHORS README README-alpha ChangeLog | ./gzip -4 -c > non-random.gz |
|---|
| | 842 | ./gzip -d non-random.gz |
|---|
| | 843 | |
|---|
| | 844 | # I build Gzip with -fast too. |
|---|
| | 845 | |
|---|
| | 846 | # - Inetutils |
|---|
| | 847 | # Inetutils does not have a testsuite but will compile with ICC. |
|---|
| | 848 | |
|---|
| | 849 | # - Iproute2 |
|---|
| | 850 | # Iproute2 needs the -gcc option, and does not have a testsuite: |
|---|
| | 851 | |
|---|
| | 852 | icc-make SBINDIR=/sbin CC="icc -gcc" && |
|---|
| | 853 | icc-make SBINDIR=/sbin CC="icc -gcc" install |
|---|
| | 854 | |
|---|
| | 855 | # - Kdb |
|---|
| | 856 | # Kbd does not have a testsuite: |
|---|
| | 857 | |
|---|
| | 858 | icc-make CC="icc" |
|---|
| | 859 | |
|---|
| | 860 | # - Less |
|---|
| | 861 | # Less does not have a testsuite. Configure and build it normally. |
|---|
| | 862 | |
|---|
| | 863 | # - Make |
|---|
| | 864 | # Build and install Make typically. |
|---|
| | 865 | |
|---|
| | 866 | # - Man-DB |
|---|
| | 867 | # Man-DB does not have a testsuite. Configure and build it normally. |
|---|
| | 868 | |
|---|
| | 869 | # - Mktemp |
|---|
| | 870 | # Mktemp does not have a testsuite, but we can simulate one: |
|---|
| | 871 | |
|---|
| | 872 | ./mktemp --help |
|---|
| | 873 | ./mktemp -V |
|---|
| | 874 | ./mktemp -p . && ./mktemp -p . XXXXXXXX |
|---|
| | 875 | ./mktemp -p . -d && ./mktemp -p . -d XXXXXXXX |
|---|
| | 876 | |
|---|
| |
|---|