在Qtcreator下编译Nginx

来源:互联网 发布:java中replaceall 编辑:程序博客网 时间:2024/06/04 18:12

在Qtcreator下编译Nginx

操作系统环境:ubuntu16.04 32位

目录

  • 在Qtcreator下编译Nginx
    • 准备工作
      • 1安装好Qt及其gcc相关的工具链
      • 2创建文件夹NginxQtProject并进入目录NginxQtProject建立空工程NginxQtProject
      • 3进入工程目录下载nginx源码压缩包当前的稳定版本为nginx-1121targz
    • 解压并配置Nginx源码
      • 1解压并配置nginx源码
      • 2上述步骤执行完后在nginx-1121目录下会生成objs文件夹其中有我们后续会添加到qt工程中的代码文件需要特别注意
      • 3添加需要的源代码文件到qt工程所生成的pro文件内容如下所示
      • 4从此可以开始执行qmake并进行build操作了
    • 从此愉快的通过QtCreator进行nginx的代码阅读与修改

准备工作

1、安装好Qt及其gcc相关的工具链;

2、创建文件夹NginxQtProject并进入目录NginxQtProject建立空工程NginxQtProject;

3、进入工程目录,下载nginx源码压缩包,当前的稳定版本为nginx-1.12.1.tar.gz:

    cd NginxQtProject/NginxQtProject    wget http://nginx.org/download/nginx-1.12.1.tar.gz

解压并配置Nginx源码

1、解压并配置nginx源码:

    tar -xvf nginx-1.12.1.tar.gz    cd nginx-1.12.1    ./configure

2、上述步骤执行完后,在nginx-1.12.1目录下会生成objs文件夹,其中有我们后续会添加到qt工程中的代码文件,需要特别注意;

3、添加需要的源代码文件到qt工程,所生成的.pro文件内容如下所示:

TARGET = nginxLIBS = -ldl -lpthread -lcrypt -lpcre -lzINCLUDEPATH += \    nginx-1.12.1/src/core \    nginx-1.12.1/src/event \    nginx-1.12.1/src/event/modules \    nginx-1.12.1/src/os/unix \    nginx-1.12.1/objs \    nginx-1.12.1/src/http \    nginx-1.12.1/src/http/modules \    nginx-1.12.1/src/http \    nginx-1.12.1/src/http/modulesHEADERS += \        nginx-1.12.1/src/core/nginx.h \        nginx-1.12.1/src/core/ngx_config.h \        nginx-1.12.1/src/core/ngx_core.h \        nginx-1.12.1/src/core/ngx_log.h \        nginx-1.12.1/src/core/ngx_palloc.h \        nginx-1.12.1/src/core/ngx_array.h \        nginx-1.12.1/src/core/ngx_list.h \        nginx-1.12.1/src/core/ngx_hash.h \        nginx-1.12.1/src/core/ngx_buf.h \        nginx-1.12.1/src/core/ngx_queue.h \        nginx-1.12.1/src/core/ngx_string.h \        nginx-1.12.1/src/core/ngx_parse.h \        nginx-1.12.1/src/core/ngx_parse_time.h \        nginx-1.12.1/src/core/ngx_inet.h \        nginx-1.12.1/src/core/ngx_file.h \        nginx-1.12.1/src/core/ngx_crc.h \        nginx-1.12.1/src/core/ngx_crc32.h \        nginx-1.12.1/src/core/ngx_murmurhash.h \        nginx-1.12.1/src/core/ngx_md5.h \        nginx-1.12.1/src/core/ngx_sha1.h \        nginx-1.12.1/src/core/ngx_rbtree.h \        nginx-1.12.1/src/core/ngx_radix_tree.h \        nginx-1.12.1/src/core/ngx_rwlock.h \        nginx-1.12.1/src/core/ngx_slab.h \        nginx-1.12.1/src/core/ngx_times.h \        nginx-1.12.1/src/core/ngx_shmtx.h \        nginx-1.12.1/src/core/ngx_connection.h \        nginx-1.12.1/src/core/ngx_cycle.h \        nginx-1.12.1/src/core/ngx_conf_file.h \        nginx-1.12.1/src/core/ngx_module.h \        nginx-1.12.1/src/core/ngx_resolver.h \        nginx-1.12.1/src/core/ngx_open_file_cache.h \        nginx-1.12.1/src/core/ngx_crypt.h \        nginx-1.12.1/src/core/ngx_proxy_protocol.h \        nginx-1.12.1/src/core/ngx_syslog.h \        nginx-1.12.1/src/event/ngx_event.h \        nginx-1.12.1/src/event/ngx_event_timer.h \        nginx-1.12.1/src/event/ngx_event_posted.h \        nginx-1.12.1/src/event/ngx_event_connect.h \        nginx-1.12.1/src/event/ngx_event_pipe.h \        nginx-1.12.1/src/os/unix/ngx_time.h \        nginx-1.12.1/src/os/unix/ngx_errno.h \        nginx-1.12.1/src/os/unix/ngx_alloc.h \        nginx-1.12.1/src/os/unix/ngx_files.h \        nginx-1.12.1/src/os/unix/ngx_channel.h \        nginx-1.12.1/src/os/unix/ngx_shmem.h \        nginx-1.12.1/src/os/unix/ngx_process.h \        nginx-1.12.1/src/os/unix/ngx_setaffinity.h \        nginx-1.12.1/src/os/unix/ngx_setproctitle.h \        nginx-1.12.1/src/os/unix/ngx_atomic.h \        nginx-1.12.1/src/os/unix/ngx_gcc_atomic_x86.h \        nginx-1.12.1/src/os/unix/ngx_thread.h \        nginx-1.12.1/src/os/unix/ngx_socket.h \        nginx-1.12.1/src/os/unix/ngx_os.h \        nginx-1.12.1/src/os/unix/ngx_user.h \        nginx-1.12.1/src/os/unix/ngx_dlopen.h \        nginx-1.12.1/src/os/unix/ngx_process_cycle.h \        nginx-1.12.1/src/os/unix/ngx_linux_config.h \        nginx-1.12.1/src/os/unix/ngx_linux.h \        nginx-1.12.1/src/core/ngx_regex.h \        nginx-1.12.1/objs/ngx_auto_config.h \        nginx-1.12.1/src/http/ngx_http.h \        nginx-1.12.1/src/http/ngx_http_request.h \        nginx-1.12.1/src/http/ngx_http_config.h \        nginx-1.12.1/src/http/ngx_http_core_module.h \        nginx-1.12.1/src/http/ngx_http_cache.h \        nginx-1.12.1/src/http/ngx_http_variables.h \        nginx-1.12.1/src/http/ngx_http_script.h \        nginx-1.12.1/src/http/ngx_http_upstream.h \        nginx-1.12.1/src/http/ngx_http_upstream_round_robin.h \        nginx-1.12.1/src/http/modules/ngx_http_ssi_filter_module.hSOURCES += \        nginx-1.12.1/src/core/nginx.c \        nginx-1.12.1/src/core/ngx_log.c \        nginx-1.12.1/src/core/ngx_palloc.c \        nginx-1.12.1/src/core/ngx_array.c \        nginx-1.12.1/src/core/ngx_list.c \        nginx-1.12.1/src/core/ngx_hash.c \        nginx-1.12.1/src/core/ngx_buf.c \        nginx-1.12.1/src/core/ngx_queue.c \        nginx-1.12.1/src/core/ngx_output_chain.c \        nginx-1.12.1/src/core/ngx_string.c \        nginx-1.12.1/src/core/ngx_parse.c \        nginx-1.12.1/src/core/ngx_parse_time.c \        nginx-1.12.1/src/core/ngx_inet.c \        nginx-1.12.1/src/core/ngx_file.c \        nginx-1.12.1/src/core/ngx_crc32.c \        nginx-1.12.1/src/core/ngx_murmurhash.c \        nginx-1.12.1/src/core/ngx_md5.c \        nginx-1.12.1/src/core/ngx_sha1.c \        nginx-1.12.1/src/core/ngx_rbtree.c \        nginx-1.12.1/src/core/ngx_radix_tree.c \        nginx-1.12.1/src/core/ngx_slab.c \        nginx-1.12.1/src/core/ngx_times.c \        nginx-1.12.1/src/core/ngx_shmtx.c \        nginx-1.12.1/src/core/ngx_connection.c \        nginx-1.12.1/src/core/ngx_cycle.c \        nginx-1.12.1/src/core/ngx_spinlock.c \        nginx-1.12.1/src/core/ngx_rwlock.c \        nginx-1.12.1/src/core/ngx_cpuinfo.c \        nginx-1.12.1/src/core/ngx_conf_file.c \        nginx-1.12.1/src/core/ngx_module.c \        nginx-1.12.1/src/core/ngx_resolver.c \        nginx-1.12.1/src/core/ngx_open_file_cache.c \        nginx-1.12.1/src/core/ngx_crypt.c \        nginx-1.12.1/src/core/ngx_proxy_protocol.c \        nginx-1.12.1/src/core/ngx_syslog.c \        nginx-1.12.1/src/event/ngx_event.c \        nginx-1.12.1/src/event/ngx_event_timer.c \        nginx-1.12.1/src/event/ngx_event_posted.c \        nginx-1.12.1/src/event/ngx_event_accept.c \        nginx-1.12.1/src/event/ngx_event_connect.c \        nginx-1.12.1/src/event/ngx_event_pipe.c \        nginx-1.12.1/src/os/unix/ngx_time.c \        nginx-1.12.1/src/os/unix/ngx_errno.c \        nginx-1.12.1/src/os/unix/ngx_alloc.c \        nginx-1.12.1/src/os/unix/ngx_files.c \        nginx-1.12.1/src/os/unix/ngx_socket.c \        nginx-1.12.1/src/os/unix/ngx_recv.c \        nginx-1.12.1/src/os/unix/ngx_readv_chain.c \        nginx-1.12.1/src/os/unix/ngx_udp_recv.c \        nginx-1.12.1/src/os/unix/ngx_send.c \        nginx-1.12.1/src/os/unix/ngx_writev_chain.c \        nginx-1.12.1/src/os/unix/ngx_udp_send.c \        nginx-1.12.1/src/os/unix/ngx_udp_sendmsg_chain.c \        nginx-1.12.1/src/os/unix/ngx_channel.c \        nginx-1.12.1/src/os/unix/ngx_shmem.c \        nginx-1.12.1/src/os/unix/ngx_process.c \        nginx-1.12.1/src/os/unix/ngx_daemon.c \        nginx-1.12.1/src/os/unix/ngx_setaffinity.c \        nginx-1.12.1/src/os/unix/ngx_setproctitle.c \        nginx-1.12.1/src/os/unix/ngx_posix_init.c \        nginx-1.12.1/src/os/unix/ngx_user.c \        nginx-1.12.1/src/os/unix/ngx_dlopen.c \        nginx-1.12.1/src/os/unix/ngx_process_cycle.c \        nginx-1.12.1/src/os/unix/ngx_linux_init.c \        nginx-1.12.1/src/event/modules/ngx_epoll_module.c \        nginx-1.12.1/src/os/unix/ngx_linux_sendfile_chain.c \        nginx-1.12.1/src/core/ngx_regex.c \        nginx-1.12.1/src/http/ngx_http.c \        nginx-1.12.1/src/http/ngx_http_core_module.c \        nginx-1.12.1/src/http/ngx_http_special_response.c \        nginx-1.12.1/src/http/ngx_http_request.c \        nginx-1.12.1/src/http/ngx_http_parse.c \        nginx-1.12.1/src/http/modules/ngx_http_log_module.c \        nginx-1.12.1/src/http/ngx_http_request_body.c \        nginx-1.12.1/src/http/ngx_http_variables.c \        nginx-1.12.1/src/http/ngx_http_script.c \        nginx-1.12.1/src/http/ngx_http_upstream.c \        nginx-1.12.1/src/http/ngx_http_upstream_round_robin.c \        nginx-1.12.1/src/http/ngx_http_file_cache.c \        nginx-1.12.1/src/http/ngx_http_write_filter_module.c \        nginx-1.12.1/src/http/ngx_http_header_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_chunked_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_range_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_gzip_filter_module.c \        nginx-1.12.1/src/http/ngx_http_postpone_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_ssi_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_charset_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_userid_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_headers_filter_module.c \        nginx-1.12.1/src/http/ngx_http_copy_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_not_modified_filter_module.c \        nginx-1.12.1/src/http/modules/ngx_http_static_module.c \        nginx-1.12.1/src/http/modules/ngx_http_autoindex_module.c \        nginx-1.12.1/src/http/modules/ngx_http_index_module.c \        nginx-1.12.1/src/http/modules/ngx_http_auth_basic_module.c \        nginx-1.12.1/src/http/modules/ngx_http_access_module.c \        nginx-1.12.1/src/http/modules/ngx_http_limit_conn_module.c \        nginx-1.12.1/src/http/modules/ngx_http_limit_req_module.c \        nginx-1.12.1/src/http/modules/ngx_http_geo_module.c \        nginx-1.12.1/src/http/modules/ngx_http_map_module.c \        nginx-1.12.1/src/http/modules/ngx_http_split_clients_module.c \        nginx-1.12.1/src/http/modules/ngx_http_referer_module.c \        nginx-1.12.1/src/http/modules/ngx_http_rewrite_module.c \        nginx-1.12.1/src/http/modules/ngx_http_proxy_module.c \        nginx-1.12.1/src/http/modules/ngx_http_fastcgi_module.c \        nginx-1.12.1/src/http/modules/ngx_http_uwsgi_module.c \        nginx-1.12.1/src/http/modules/ngx_http_scgi_module.c \        nginx-1.12.1/src/http/modules/ngx_http_memcached_module.c \        nginx-1.12.1/src/http/modules/ngx_http_empty_gif_module.c \        nginx-1.12.1/src/http/modules/ngx_http_browser_module.c \        nginx-1.12.1/src/http/modules/ngx_http_upstream_hash_module.c \        nginx-1.12.1/src/http/modules/ngx_http_upstream_ip_hash_module.c \        nginx-1.12.1/src/http/modules/ngx_http_upstream_least_conn_module.c \        nginx-1.12.1/src/http/modules/ngx_http_upstream_keepalive_module.c \        nginx-1.12.1/src/http/modules/ngx_http_upstream_zone_module.c \        nginx-1.12.1/objs/ngx_modules.c \

4、从此,可以开始执行qmake并进行build操作了!

从此愉快的通过QtCreator进行nginx的代码阅读与修改……

原创粉丝点击