I. Background Summary:
- Recently, the project needs to be debugged under the Linux system, and I often encounter commands such as cmake, make, make install and configure. I searched the difference on the Internet, and found that most of them are copied and pasted the same content, but there is no substantial significance, so I hereby make a learning record.
Make install
-
2.1 make is simply used to compile link source files. It compiles and links project files to generate executable files, dynamic libraries, static libraries, etc., based on makefiles in directories. The most important step to make is to learn how to write or to learn how to get a correct Makefile. If programmers write Makefile myself is more troublesome, and depending on the compiler platform, compile the corresponding rules is also different, specific content can be viewed here: (simple version) zhuanlan.zhihu.com/p/47390641 no wonder some netizens said: Life is short, so I chose to skip the makefile and use cmake instead. We’ll talk about that later.
-
2.2 make Install This command is used when installing software or dependent libraries (such as OpencV and FFmpeg). As mentioned earlier, after make, dynamic libraries, executables, etc. Why do we need to make install when we already have the executables? Install: Install: For some programs and dependent libraries, we not only need to compile links to get executable files and dynamic libraries, but also need to copy the corresponding files to the corresponding location (also makefiles to perform operations) so that other applications can call and find them. For example, when compiling opencV source code, executing the make install directive copies some of the compiled files to the correct location so that other programs can call OpencV. PS: For general project development, it is enough to get the executable after make.
Cmake and make have to tell the story
- As mentioned above, the Makefile is a bit of a chore to write, so is there any way we can write it? Yes, that’s cmake (and configure). The great thing about cmake is that it is platform-neutral. Once you write cmakelists. TXT, you can get the corresponding Makefile on any platform that supports cmake, and cmakelists. TXT is very easy to write. You can learn how to write your own cmakelists. TXT file in less than an hour. The following two is when I learn cmake today to see tutorials, recommend to everyone: (1) the main speak cmake grammar: blog.csdn.net/u011536013/… (2) the sample Demo, from easy to difficult: blog.csdn.net/zhuiyunzhug…
4. Configure leads to the same destination
- There are two ways to install Linux. One is: cmake.. /configure make-j8 make install configure make-insatll /configure make-j8 make install configure make-insatll (Configure is a directive in the AutoCOF library, which must be pre-installed with its dependent libraries.) It is worth noting that cmake syntax is concise and easy to understand by comparison. Can check the configure grammar tutorial: www.cnblogs.com/xuezhileika…
5. Reference links
- Blog.csdn.net/qq_27825451…
2020/7/19 “all the articles in this site, welcome to reprint, please indicate the article source: blog.csdn.net/ll159825344…