The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

5. Porting, Compiling and Obtaining Programs

Q: How Do I Compile Programs?
Q: How Do I Install GNU Software?
Q: Where Can I Get Java?
Q: How Do I Port XXX to Linux?
Q: What Is ld.so and How Do I Get It?
Q: How Do I Upgrade the Libraries without Trashing the System?
Q: Can I Use Code or a Compiler Compiled for a 486 on a 386?
Q: What Does ``gcc -O6'' Do?
Q: What Do I Do About Errors Trying to Compile the Kernel?
Q: How Do I Make a Shared Library?
Q: Why Are My Programs So Large?
Q: Does Linux Support Threads or Lightweight Processes?
Q: Where Can I Find Kermit for Linux?
Q: How Do I Use Linux with a Cable Modem?
Q: Is There an ICQ Program That Runs under Linux?

A: The Sun Microsystems Java runtime environments and developer's kits are at http://java.sun.com/java/

You can also get the source code, which is licensed by Sun Microsystems.

A: The home page of IBM's Jikes Java compiler is http://www10.software.ibm.com/developerworks/opensource/jikes.

A: There is a version of Sun's HotJava browser for Linux at: http://www.java.sun.com/products/hotjava/.

A: Kaffee, a free Java clone, is available from: http://www.kaffe.org.

A: There is a resource page of free and commercial Java packages at: http://www.blackdown.org/java-linux.html.

A: Netscape Communicator comes with its own version of the Java Runtime Environment, so if you need Java only to view Web graphics, you may already have the runtime version of the Java Virtual Machine and libraries that you need installed on your system. You can download Communicator from http://www.netscape.com.

A:

WarningYou should always have a rescue disk set ready when you perform this procedure, in the likely event that something goes wrong!

This procedure is especially difficult if you're upgrading very old libraries like libc4. But you should be able to keep libc4 on the same system with libc5 libraries for the programs that still need them. The same holds true for upgrading from libc5 to the newer-yet glibc2 libraries.

The problem with upgrading dynamic libraries is that the moment you remove the old libraries, the utilities that you need to upgrade to the new version of the libraries don't work. There are ways around around this. One is to temporarily place a spare copy of the run time libraries, which are in [/lib/], in [/usr/lib/], or [/usr/local/lib/], or another directory that is listed in the [/etc/ld.so.conf] file.

For example, when upgrading libc5 libraries, the files in [/lib/] might look something like:

libc.so.5 libc.so.5.4.33 libm.so.5 libm.so.5.0.9

These are the C libraries and the math libraries. Copy them to another directory that is listed in [/etc/ld.so.conf], like [/usr/lib/]:

 $ cp -df /lib/libc.so.5* /usr/lib/

  $ cp -df /lib/libm.so.5* /usr/lib/

  $ ldconfig

Be sure to run ldconfig to upgrade the library configuration.

The files [libc.so.5] and [libm.so.5] are symbolic links to the actual library files. When you upgrade, the new links will not be created if the old links are still there, unless you use the -f flag with cp. The -d flag to cp will copy the symbolic link itself, and not the file it points to.

If you need to overwrite the link to the library directly, use the -f flag with ln.

For example, to copy new libraries over the old ones, try this. Make a symbolic link to the new libraries first, then copy both the libraries and the links to [/lib/], with the following commands.

 $ ln -sf ./libm.so.5.0.48 libm.so.5

  $ ln -sf ./libc.so.5.0.48 libc.so.5

  $ cp -df libm.so.5* /lib

  $ cp -df libc.so.5* /lib

Again, remember to run ldconfig after you copy the libraries.

If you are satisfied that everything is working correctly, you can remove the temporary copies of the old libraries from [/usr/lib/] or wherever you copied them.

A: The files [/usr/include/linux/] and [/usr/include/asm/] are often soft links to the directories where the kernel headers are. They are usually under [/usr/src/kernel*/].

If you don't have the kernel sources, download them. Refer to the answer: (``How To Upgrade/Recompile a Kernel'')

Then, use rm to remove any garbage, and ln to create the links:

 $ rm -rf /usr/include/linux /usr/include/asm

  $ ln -sf /usr/src/linux/include/linux /usr/include/linux

  $ ln -sf /usr/src/linux/include/asm- /usr/include/asm

The assembly language files reside in architecture-specific directories, so you need to link /usr/src/include/asm to /usr/src/linux/include/asm-i386 on PC compatible systems, to /usr/src/linux/include/asm-sparc on Sun Sparc systems, to /usr/src/linux/include/asm-ppc on PPC systems, and so on.

You'll also find that you may need to do `make config' as in a newly-unpacked kernel source tree, to create [linux/autoconf.h].

A: With an ELF compiler (``What's All This about ELF? glibc?''), the most common cause of large executables is the lack of an appropriate .so library link for one of the libraries you're using. There should be a link like [libc.so] for every library like [libc.so.5.2.18].

With an [a.out] compiler the most common cause of large executables is the -g linker (compiler) flag. This produces (as well as debugging information in the output file) a program which is statically linkedone which includes a copy of the C library instead of a dynamically linked copy.

Other things worth investigating are -O and -O2, which enable optimization (check the GCC documentation), and -s (or the strip command) which strip the symbol information from the resulting binary (making debugging totally impossible).

You may wish to use -N on very small executables (less than 8K with the -N), but you shouldn't do this unless you understand its performance implications, and definitely never with daemons.

A: As well as the Unix multiprocessing model involving heavyweight processes, which is of course part of the standard Linux kernel, there are several implementations of lightweight processes or threads. Recent kernels implement a thread model, kthreads. In addition, there are the following packages available for Linux.

Please contact the authors of the packages in question for details.

Q; Where Can I Find lint for Linux?|lint-for-linux

A: Roughly equivalent functionality is built into GCC. Use the -Wall option to turn on most of the useful extra warnings. See the GCC manual for more details (type F1-i in Emacs and select the entry for GCC).

There is a freely available program called lclint that does much the same thing as traditional lint. The announcement and source code are available at on ftp://larch.lcs.mit.edu/pub/Larch/lclint/; on the World Wide Web, look at http://lclint.cs.virginia.edu/.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру