In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you the Linux source code installation example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
Install software under linux, you will inevitably encounter the need for source code installation, and this is a simple. / configure, make, sudo make install three steps, but let many people have a headache, here to install X11 as an example to introduce a little bit of my experience in the installation, in order to learn together, common progress!
First of all, we have to do some preparatory work, the source code installation is not without these tools pkg-config, libtool, autoconf and automake (of course, there are more basic, such as zlib, M4, etc., which are skipped here), of which pkg-config is relatively important, which is the program that provides system information to configure programs, such as the version of the software, the version of the library, and the path of the library, which are only used during compilation. You can open any .pc file under / usr/lib/pkgconfig and you will find information similar to the following (X11 pc file):
Prefix=/usr
Exec_prefix=$ {prefix}
Libdir=$ {exec_prefix} / lib
Includedir=$ {prefix} / include
Xthreadlib=-lpthread
Name: X11
Description: X Library
Version: 1.3.3
Requires: xproto kbproto
Requires.private: xcb > = 1.1.92
Cflags:-I ${includedir}
Libs:-L ${libdir}-lX11
Libs.private:-lpthread
Configure relies on this information to determine whether the software version meets the requirements. Next, let's take a look at how pkg-config works. By default, pkg-config first looks in usr/lib/pkgconfig/ for the corresponding file (x11.pc) corresponding to the relevant package (such as x11). If it is not found, it will also go to the path specified by the environment variable PKG_CONFIG_PATH to find it. If it has not been found, it will report an error. So here we can find some solutions that prompt * * library not found when configure. First, use the command "ldconfig-p | grep library name" to analyze whether the library is installed and its path. If it is empty, it means that the library is not installed. Otherwise, you can find the installation site of the library according to the returned result of the command, and then set its environment variables as follows:
"export PKG_CONFIG_PATH= software location / lib/pkgconfig:$PKG_CONFIG_PATH", there is a common sense that after the software is installed, the .pc files are all in the lib/pkgconf under the installation directory. This will only be valid in the current command window, of course, you can also modify the .bashrc file in the home folder. The file is hidden and can be edited with the command vi .bashrc), add the above command to the end of the file, and log in again. Several others are also indispensable under linux. Libtool is used to manage library. If not, the error prompt is as follows: possibly undefined macro:AC_PROG_LIBTOOL. Autoconf and automake can be used when installing some source packages without configure files (pixman is a typical example, after installing both. / autogen.sh can be installed).
After the preparatory work is done, you can install it. All the commands are as follows:
Tar vxf libX11-6.2.1.tar.gz
Cd libX11-6.2.1
Mkdir X11-build
Cd X11-build
.. / configure-prefix=/usr/local/X11R6
Make
Echo $
Sudo make install
Here are some good installation habits to accumulate: 1. Set up a temporary compilation directory, which in this case is X11-build, so that you can delete the directory after installation, thus saving space and keeping the source directory clean and tidy. 2. Install to the specified directory. In this case, it is / usr/local/X11R6. It is best to install several related ones in the same folder, such as the X11R6 folder here, so that it is easy to manage, otherwise they are all installed under / usr/local by default, which is very messy. 3. Check after compilation is completed. This example is echo $, which means checking the exit status of the previous command. Normal exit of the program returns 0, while error exit returns non-0. You can also use make check, mainly to prevent direct install after make failure, resulting in some inexplicable errors. A more convenient and quick installation method is also introduced here. Connect the installation commands with & &, such as.. / configure-prefix=**&&make&&sudo make install, so that only if the previous command is executed correctly, the later tasks will be executed. How convenient!
In addition, before installation, you can read the readme and install and other documents in the source code package, often have the required software and its download address, as well as some installation tips and configuration options. In addition, type configure-help before configure to see which options can be added. There are several other things that can be installed successfully is ldconfig. If you can't find a library during installation or if you can't find a * * .so file at compile time, you'll need it. The simplest solution is sudo gedit / etc/ld.so.conf. Add the path where the * * .so file is located in the file, and then run ldconfig, but I have a shadow on this thing. I don't know if it is because of using a virtual machine or other reasons. After I have run ldconfig 7 or 8 times, Ubuntu cannot open any windows, and it is even more difficult to enter the system if it is shut down and restarted directly. I do not know if there are any experts who have a solution. A way to replace ldconfig is provided here, that is, the address of the export LD_LIBRARY_PATH=*.so file: $LD_LIBRARY_PATH, I feel much more comfortable with it, that is, it is more troublesome and patient, it is much better than the crash of the system, hehe! In fact, when you encounter problems in configure, you should be lucky, because you can find the missing things according to its obvious hints and install them. Pkgconfig and ldconfig can basically be done with configuration, but it is not so easy when make.
The most common prompt during compilation is that * * things are not found, either the library file or the header file. The library file can basically be completed with the above ldconfig. If you want to configure the included path for the header file, it is similar to the one for the library. The command is as follows:
Export LD_INCLUDE_PATH=/usr/local/include:$LD_INCLUDE_PATH
At this time, the most important thing is to calm down, follow his error to find, such as "No such file or directory" such an error prompt must be nearby, found, include can!
The above is all the contents of the article "sample Analysis of Source Code installation in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.