Use of LevelDB, use of LevelDB
Google's open-source project LevelDB is good, but it left a big pitfall. It tortured me for a day or two and I checked a lot of information. I found that the problem was similar to mine. I wrote down my notes here.
Reference: https://github.com/google/leveldb Google source address http://www.tanhao.me/pieces/1397.html/ tan notes http://blog.rpplusplus.me/blog/2014/01/20/build-leveldb/ txx's bloghttp: // www. ifun. cc/blog/2014/02/09/leveldb-for-ios/Haven's bloghttp: // your HOKUANG's BLOG
Personal Demo: https://github.com/ZHANGMRXIN/LevelDBTest
Problems: 1. The source code file cloned from GitHub fails to be compiled. Check whether the following files are missing. The red box is copied from the files successfully cloned from other places. After the code is compiled, the Blue Box file is generated. For the moment, both of them are retained, so that they can be selected during compilation.
2. leveldb/db. h file not found. The cause of this problem is that the header file. h of the compiled static library. a file sets the search path incorrectly. For specific settings, see. In addition, if the search path of the static library. a file is incorrect, you need to reset it. For details, refer:
3. one of the most challenging problems (a pitfall left by Google) is to use the Makefile file in the source code for compilation. If compiled files are used in the project. file a, an error will be reported. arm64...... cannot be found ....., I tried both the 32-bit and 64-bit real machine and simulator, and all reported errors .... this problem is what Google left us. The Makefile file is quite problematic when it involves the ubuntures of the real machine and simulator. It's mainly about. cc. o: And. c. o: There.
Original file:
The modified Makefile file is applicable to the real machine and simulator (including 32-bit and 64-bit:
After solving the preceding three problems, you can re-compile the. a file. Then it can be used normally.
Compile command: 1. first cd to the root directory of the source code directory. 2. Compile CXXFLAGS =-stdlib = libc ++ make PLATFORM = IOS or CXXFLAGS =-stdlib = libstdc ++ make PLATFORM = IOS using commands, it is used to use the c ++ standard library, where the new and old libraries are used separately. Libc ++ supports the c ++ 11 standard, which corresponds to the two libraries ibc ++. dylib and libstdc ++. dylib referenced in xcode respectively.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.