In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to configure MySQL source environment in eclipse". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
After some trouble today, I finally set up a debugging environment for MySQL source code. The main purpose is to have some clues when looking at the code, so that these development skills come in handy. It is not so easy for the blind to scan with the naked eye with the command, of course, as to whether the code can be gnawed down or not, that is another matter.
Let me talk about my situation. There is still a little foundation for Java development, so the previous eclipse is quite familiar. As we all know, the source code of InnoDB is cpowerMySQL Server. If you want to debug such an environment, it is actually a little difficult if you don't have platform development experience in this area. Finally, I decided to use eclipse to do it, based on the Windows platform.
There were several pits in it, which made me miserable.
There are a few things to do first.
1) download the MySQL source code
2) download and develop IDE eclipse
3) debugging the compiler environment
4) configure the mode of code debugging
Download the MySQL source code
Download MySQL source code, go directly to www.mysql.com, select Community Edition, download type is source code, you can see the following options.
For example, I chose this version of 5.6.35. The latest one is 5.7, and the earlier one is version 5.5. It's really hard to find the previous one, so we have to go through other channels.
Download IDE eclipse
Eclipse is an IDE for developing a general-purpose platform, but this statement is now challenged by IntelliJ IDEA. At present, the challenge is successful, partly because of some improvements in the interface of the new version, but relatively speaking, eclipse is a tool used by Java developers a little more, and some interviews will ask how many shortcut keys inside, you can ask how I use it. Some friends may ask, eclipse is more used in Java development, what does that have to do with the MySQL source environment. Is it possible to look at C++ code in a Java editor? no.
Because eclipse still has a C++ version of the plug-in, you can download the C++ version exclusive on www.eclipse.org.
Pit point 1
But after downloading, eclipse failed to start, and the error is Failed to load the JNI shared library jvm.dll. Most of this error is related to the number of digits of JDK, such as 32-bit and 64-bit compatibility. The current environment is a JDK6 environment, so it seems that there are not enough children. I will try to download a JDK7 again. The official website can no longer be downloaded directly, so you have to download it through mos.
After configuring the environment, the error received changed, and I felt that I had been fooled by this mistake.
What does an IDE upgrade such a new version of JDK do, and then come back to download JDK8. The installation version is downloaded from the official website. I silently looked at the following domineering hard wide, until the installation was successful. In fact, relatively speaking, I still like the decompressed version.
Eclipse is ready to start. I created a project, and I named it mysql_5_6_35.
At this time, the environment is still basically blank, let's first create it.
After a simple confirmation, a project is created, and the new version of exlipse begins to generate the working directory. The startup interface is still good.
Compiler environment debugging
After launching the eclipse and creating the project, we can import the code in the source package from the specified directory. Of course, as expected, after opening the code, I found that the background began to report the following error. There is something wrong with the compilation environment.
At this time, if the configuration is still very interesting, you can install the gcc,g++ environment on windows. You can refer to the https://sourceforge.net/projects/mingw/ website and download it.
The style of this software is very interesting, when downloading the installation package is the following installation progress, which plug-ins need to be installed, is also basically in this form.
We need not only gcc, but also glossy packages. We need to download new packages on top of the installed software. Finally, you will be prompted that the installation was successful.
You still need to do some basic configuration in eclipse. Find the corresponding menu according to the red block diagram and modify the path in the lower right corner, which is the directory where the software we just installed is located.
For example, if I install it on disk D, it will be configured as the path of the red box below.
At this time, there is another problem, indicating that make is not configured, which makes me a little confused. Gcc is installed, make check is also successful, why the prompt configuration is not it. There's a stem here. We need to rename the following file, which is actually make
After configuring the environment, there will be no problem with compilation.
Configure code debugging mode
In fact, the above environment configuration is also an auxiliary, if we just look at the code, in fact, it is acceptable, but the following function does not work, it will be difficult to view the code. For example, if I click on a method in the code, I can quickly locate the calling function of another file according to the calling relationship, so the logic will be much clearer.
But this function can not be used in eclipse, students who are familiar with Java development should be familiar with the features of this outline, which functions are in a file, and which variables can be understood at a glance, so this situation has to be improved. I found that the reason for not enabling is that I opened one of the files with more than 5000 lines of code. With the default configuration of eclipse, outline cannot be enabled for more than 5000 lines. We can change the configuration of the red box.
After configuration, there is no problem to restart eclipse. You can see the outline information on the right, and the request will be much clearer. Clicking on the code will also have this positioning function, which is much more convenient to look at the code. For example, let's look at the code of InnoDB and go to the file storage/Innobase/handler/ha_innodb.cc, which will be a key interface file for me to learn innodb.
This is the end of the content of "how to configure the MySQL source environment in eclipse". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.