Use Qt Creator as a Linux IDE for Nginx source code compilation and breakpoint debugging
2, source code preparation
Use huang Jianhong’s annotated Chinese version at github.com/huangz1990/…
We decompress the source code, first use GCC compilation, the main purpose is to compile the DEPS library
[root@localhost redis_study]# chmod -r 777 redis-3.0-annotated-unstable [root@localhost redis_study]# CD Redish-3.0-redish-unstable / [root@localhost redish-3.0-redish-unstable]# make Because nginx compiles as a single executable file, Redis generates N executables:
redis-server
redis-cli
redis-benchmark
redis-check-aof
redis-check-dump
redis-sentinel
So, our new Qt Creator must have multiple subproject types:
4, redisqtproject. pro, firecat here only focuses on the most important redis-server and redis-CLI two executable programs
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
redis-server \
redis-cli
Copy the code
Common.pri, because the deps library has been compiled previously, we just need to add the library dependency
isEmpty(PREFIX_SRC) { PREFIX_SRC = .. /.. /src } isEmpty(PREFIX_DEPS) { PREFIX_DEPS = .. /.. /deps } LIBS = -ldl -lpthread -lcrypt -lpcre -lz LIBS += "$$PREFIX_DEPS/hiredis/libhiredis.a" LIBS += "$$PREFIX_DEPS/lua/src/liblua.a" INCLUDEPATH += \ #$$PREFIX_SRC/ \ $$PREFIX_DEPS/hiredis \ #$$PREFIX_DEPS/hiredis/adapters \ $$PREFIX_DEPS/jemalloc/include/ \ $$PREFIX_DEPS/jemalloc/include/jemalloc/internal \ #$$PREFIX_DEPS/jemalloc/include/msvc_compat \ $$PREFIX_DEPS/linenoise \ $$PREFIX_DEPS/lua/src \ $$PREFIX_DEPS/lua/etc HEADERS += \ $$PREFIX_SRC/adlist.h \ $$PREFIX_SRC/ae.h \ $$PREFIX_SRC/anet.h \ $$PREFIX_SRC/asciilogo.h \ $$PREFIX_SRC/bio.h \ $$PREFIX_SRC/cluster.h \ $$PREFIX_SRC/config.h \ $$PREFIX_SRC/crc64.h \ $$PREFIX_SRC/dict.h \ $$PREFIX_SRC/endianconv.h \ $$PREFIX_SRC/fmacros.h \ $$PREFIX_SRC/help.h \ $$PREFIX_SRC/intset.h \ $$PREFIX_SRC/lzf.h \ $$PREFIX_SRC/lzfP.h \ $$PREFIX_SRC/pqsort.h \ $$PREFIX_SRC/rand.h \ $$PREFIX_SRC/rdb.h \ $$PREFIX_SRC/redis.h \ $$PREFIX_SRC/redisassert.h \ $$PREFIX_SRC/release.h \ $$PREFIX_SRC/rio.h \ $$PREFIX_SRC/sds.h \ $$PREFIX_SRC/sha1.h \ $$PREFIX_SRC/slowlog.h \ $$PREFIX_SRC/solarisfixes.h \ $$PREFIX_SRC/testhelp.h \ $$PREFIX_SRC/util.h \ $$PREFIX_SRC/version.h \ $$PREFIX_SRC/ziplist.h \ $$PREFIX_SRC/zipmap.h \ $$PREFIX_SRC/zmalloc.h \ $$PREFIX_DEPS/linenoise/linenoise.hCopy the code
redis-server.pro
TARGET = redis-server include(.. /common.pri) SOURCES += \ $$PREFIX_SRC/adlist.c \ $$PREFIX_SRC/ae.c \ $$PREFIX_SRC/ae_epoll.c \ $$PREFIX_SRC/ae_evport.c \ $$PREFIX_SRC/ae_kqueue.c \ $$PREFIX_SRC/ae_select.c \ $$PREFIX_SRC/anet.c \ $$PREFIX_SRC/aof.c \ $$PREFIX_SRC/bio.c \ $$PREFIX_SRC/bitops.c \ $$PREFIX_SRC/blocked.c \ $$PREFIX_SRC/cluster.c \ $$PREFIX_SRC/config.c \ $$PREFIX_SRC/crc16.c \ $$PREFIX_SRC/crc64.c \ $$PREFIX_SRC/db.c \ $$PREFIX_SRC/debug.c \ $$PREFIX_SRC/dict.c \ $$PREFIX_SRC/endianconv.c \ $$PREFIX_SRC/hyperloglog.c \ $$PREFIX_SRC/intset.c \ $$PREFIX_SRC/lzf_c.c \ $$PREFIX_SRC/lzf_d.c \ $$PREFIX_SRC/memtest.c \ $$PREFIX_SRC/multi.c \ $$PREFIX_SRC/networking.c \ $$PREFIX_SRC/notify.c \ $$PREFIX_SRC/object.c \ $$PREFIX_SRC/pqsort.c \ $$PREFIX_SRC/pubsub.c \ $$PREFIX_SRC/rand.c \ $$PREFIX_SRC/rdb.c \ #$$PREFIX_SRC/redis-benchmark.c \ #$$PREFIX_SRC/redis-check-aof.c \ #$$PREFIX_SRC/redis-check-dump.c \ #$$PREFIX_SRC/redis-cli.c \ #$$PREFIX_SRC/redis.c \ $$PREFIX_SRC/release.c \ $$PREFIX_SRC/replication.c \ $$PREFIX_SRC/rio.c \ $$PREFIX_SRC/scripting.c \ $$PREFIX_SRC/sds.c \ $$PREFIX_SRC/sentinel.c \ $$PREFIX_SRC/setproctitle.c \ $$PREFIX_SRC/sha1.c \ $$PREFIX_SRC/slowlog.c \ $$PREFIX_SRC/sort.c \ $$PREFIX_SRC/syncio.c \ $$PREFIX_SRC/t_hash.c \ $$PREFIX_SRC/t_list.c \ $$PREFIX_SRC/t_set.c \ $$PREFIX_SRC/t_string.c \ $$PREFIX_SRC/t_zset.c \ $$PREFIX_SRC/util.c \ $$PREFIX_SRC/ziplist.c \ $$PREFIX_SRC/zipmap.c \ $$PREFIX_SRC/zmalloc.c \ $$PREFIX_DEPS/linenoise/linenoise.c SOURCES += \ $$PREFIX_SRC/redis.cCopy the code
The redis-cli.pro file is similar and will not be described here.
5. We can finally perform breakpoint debugging and we’re done!
6, Appendix: complete Qt project source download
Download.csdn.net/download/li…