i OS UT coverage

本文介绍如何在 Xcode 4 中设置 LLVM 编译器选项来生成代码覆盖率文件。通过设置 'Instrument Program Flow' 和 'Generate Test Coverage Files' 为 YES,可以为测试目标生成 *.gcno 和 *.gcda 文件。



http://meandmark.com/blog/2012/08/xcode-4-generating-code-coverage-files-with-llvm/ 



Under the target build setting (be sure to select all)

Set:

  • Apple LLVM complier
    • Instrument Program Flow: YES
    • Generate Test Coverage Files: YES
share | improve this answer
 
My question specifically stated that I already did this. –  Karl  Oct 18 '12 at 17:21
 
This is a perfectly correct answer. I have just confirmed that on Xcode 4.5.1. You just need to set these settings for a testing target. You can create a target for testing: File -> New -> Target Then select iOS | Other | Cocoa Touch Unit Testing Bundle Additionally you might need to set Generate Profiling Code: YES to get gcda files generated. That was the only problem that I have recently encountered. There should be no link errors. –  Mateusz  Oct 19 '12 at 7:17
2  
I have the same problem. gcno files are there but no gcda files. I did set them for all build configurations and set Generate Profiling Code to YES but still, no gcda files. –  Flax  Oct 25 '12 at 12:35
 
I have both *.gcno and *.gcda files in the output with these options set to YES. –  Vova  Feb 20 at 10:45

# ============================================================================= # User configuration section. # # These options control compilation on all systems apart from Windows and Mac # OS X. Use CMake to compile on Windows and Mac. # # Largely, these are options that are designed to make mosquitto run more # easily in restrictive environments by removing features. # # Modify the variable below to enable/disable features. # # Can also be overriden at the command line, e.g.: # # make WITH_TLS=no # ============================================================================= # Uncomment to compile the broker with tcpd/libwrap support. #WITH_WRAP:=yes # Comment out to disable SSL/TLS support in the broker and client. # Disabling this will also mean that passwords must be stored in plain text. It # is strongly recommended that you only disable WITH_TLS if you are not using # password authentication at all. WITH_TLS:=no # Comment out to disable TLS/PSK support in the broker and client. Requires # WITH_TLS=yes. # This must be disabled if using openssl < 1.0. WITH_TLS_PSK:=no # Comment out to disable client threading support. WITH_THREADING:=yes # Comment out to remove bridge support from the broker. This allow the broker # to connect to other brokers and subscribe/publish to topics. You probably # want to leave this included unless you want to save a very small amount of # memory size and CPU time. WITH_BRIDGE:=yes # Comment out to remove persistent database support from the broker. This # allows the broker to store retained messages and durable subscriptions to a # file periodically and on shutdown. This is usually desirable (and is # suggested by the MQTT spec), but it can be disabled if required. WITH_PERSISTENCE:=yes # Comment out to remove memory tracking support from the broker. If disabled, # mosquitto won't track heap memory usage nor export '$SYS/broker/heap/current # size', but will use slightly less memory and CPU time. WITH_MEMORY_TRACKING:=yes # Compile with database upgrading support? If disabled, mosquitto won't # automatically upgrade old database versions. # Not currently supported. #WITH_DB_UPGRADE:=yes # Comment out to remove publishing of the $SYS topic hierarchy containing # information about the broker state. WITH_SYS_TREE:=yes # Build with systemd support. If enabled, mosquitto will notify systemd after # initialization. See README in service/systemd/ for more information. # Setting to yes means the libsystemd-dev or similar package will need to be # installed. WITH_SYSTEMD:=no # Build with SRV lookup support. WITH_SRV:=no # Build with websockets support on the broker. WITH_WEBSOCKETS:=no # Use elliptic keys in broker WITH_EC:=yes # Build man page documentation by default. WITH_DOCS:=yes # Build with client support for SOCK5 proxy. WITH_SOCKS:=yes # Strip executables and shared libraries on install. WITH_STRIP:=no # Build static libraries WITH_STATIC_LIBRARIES:=yes # Use this variable to add extra library dependencies when building the clients # with the static libmosquitto library. This may be required on some systems # where e.g. -lz or -latomic are needed for openssl. CLIENT_STATIC_LDADD:= # Build shared libraries WITH_SHARED_LIBRARIES:=no # Build with async dns lookup support for bridges (temporary). Requires glibc. #WITH_ADNS:=yes # Build with epoll support. WITH_EPOLL:=yes # Build with bundled uthash.h WITH_BUNDLED_DEPS:=yes # Build with coverage options WITH_COVERAGE:=no # Build with unix domain socket support WITH_UNIX_SOCKETS:=yes # Build mosquitto_sub with cJSON support WITH_CJSON:=no # Build mosquitto with support for the $CONTROL topics. WITH_CONTROL:=yes # 设置交叉编译器 CC = aarch64-none-linux-gnu-gcc AR = aarch64-none-linux-gnu-gcc RANLIB = aarch64-none-linux-gnu-gcc-ranlib # Build the broker with the jemalloc allocator WITH_JEMALLOC:=no # Build with xtreport capability. This is for debugging purposes and is # probably of no particular interest to end users. WITH_XTREPORT=no # Use the old O(n) keepalive check routine, instead of the new O(1) keepalive # check routine. See src/keepalive.c for notes on this. WITH_OLD_KEEPALIVE=no # Build using clang and with address sanitiser enabled WITH_ASAN=no # ============================================================================= # End of user configuration # ============================================================================= # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi VERSION=2.0.22 # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 # Man page generation requires xsltproc and docbook-xsl XSLTPROC=xsltproc --nonet # For html generation DB_HTML_XSL=man/html.xsl #MANCOUNTRIES=en_GB UNAME:=$(shell uname -s) ARCH:=$(shell uname -p) ifeq ($(UNAME),SunOS) ifeq ($(CC),cc) CFLAGS?=-O else CFLAGS?=-Wall -ggdb -O2 endif else CFLAGS?=-Wall -ggdb -O2 -Wconversion -Wextra endif ifeq ($(WITH_ASAN),yes) CC:=clang CFLAGS+=-fsanitize=address LDFLAGS+=-fsanitize=address endif STATIC_LIB_DEPS:= APP_CPPFLAGS=$(CPPFLAGS) -I. -I../../ -I../../include -I../../src -I../../lib APP_CFLAGS=$(CFLAGS) -DVERSION=\""${VERSION}\"" APP_LDFLAGS:=$(LDFLAGS) LIB_CPPFLAGS=$(CPPFLAGS) -I. -I.. -I../include -I../../include LIB_CFLAGS:=$(CFLAGS) LIB_CXXFLAGS:=$(CXXFLAGS) LIB_LDFLAGS:=$(LDFLAGS) LIB_LIBADD:=$(LIBADD) BROKER_CPPFLAGS:=$(LIB_CPPFLAGS) -I../lib BROKER_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER BROKER_LDFLAGS:=${LDFLAGS} BROKER_LDADD:= CLIENT_CPPFLAGS:=$(CPPFLAGS) -I.. -I../include CLIENT_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" CLIENT_LDFLAGS:=$(LDFLAGS) -L../lib CLIENT_LDADD:= PASSWD_LDADD:= PLUGIN_CPPFLAGS:=$(CPPFLAGS) -I../.. -I../../include PLUGIN_CFLAGS:=$(CFLAGS) -fPIC PLUGIN_LDFLAGS:=$(LDFLAGS) ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),) BROKER_LDADD:=$(BROKER_LDADD) -lm BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms SEDINPLACE:=-i "" else BROKER_LDADD:=$(BROKER_LDADD) -ldl -lm SEDINPLACE:=-i endif ifeq ($(UNAME),Linux) BROKER_LDADD:=$(BROKER_LDADD) -lrt BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms LIB_LIBADD:=$(LIB_LIBADD) -lrt endif ifeq ($(WITH_SHARED_LIBRARIES),yes) CLIENT_LDADD:=${CLIENT_LDADD} ../lib/libmosquitto.so.${SOVERSION} endif ifeq ($(UNAME),SunOS) SEDINPLACE:= ifeq ($(ARCH),sparc) ifeq ($(CC),cc) LIB_CFLAGS:=$(LIB_CFLAGS) -xc99 -KPIC else LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC endif endif ifeq ($(ARCH),i386) LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC endif ifeq ($(CXX),CC) LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -KPIC else LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC endif else LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC endif ifneq ($(UNAME),SunOS) LIB_LDFLAGS:=$(LIB_LDFLAGS) -Wl,--version-script=linker.version -Wl,-soname,libmosquitto.so.$(SOVERSION) endif ifeq ($(UNAME),QNX) BROKER_LDADD:=$(BROKER_LDADD) -lsocket LIB_LIBADD:=$(LIB_LIBADD) -lsocket endif ifeq ($(WITH_WRAP),yes) BROKER_LDADD:=$(BROKER_LDADD) -lwrap BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WRAP endif ifeq ($(WITH_TLS),yes) APP_CPPFLAGS:=$(APP_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L BROKER_LDADD:=$(BROKER_LDADD) -lssl -lcrypto CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L LIB_LIBADD:=$(LIB_LIBADD) -lssl -lcrypto PASSWD_LDADD:=$(PASSWD_LDADD) -lcrypto STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lssl -lcrypto ifeq ($(WITH_TLS_PSK),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS_PSK LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS_PSK CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS_PSK endif endif ifeq ($(WITH_THREADING),yes) LIB_LDFLAGS:=$(LIB_LDFLAGS) -pthread LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_THREADING CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_THREADING STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -pthread endif ifeq ($(WITH_SOCKS),yes) LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SOCKS CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SOCKS endif ifeq ($(WITH_BRIDGE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_BRIDGE endif ifeq ($(WITH_PERSISTENCE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_PERSISTENCE endif ifeq ($(WITH_MEMORY_TRACKING),yes) ifneq ($(UNAME),SunOS) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_MEMORY_TRACKING endif endif ifeq ($(WITH_SYS_TREE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYS_TREE endif ifeq ($(WITH_SYSTEMD),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYSTEMD BROKER_LDADD:=$(BROKER_LDADD) -lsystemd endif ifeq ($(WITH_SRV),yes) LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SRV LIB_LIBADD:=$(LIB_LIBADD) -lcares CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SRV STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lcares endif ifeq ($(UNAME),SunOS) BROKER_LDADD:=$(BROKER_LDADD) -lsocket -lnsl LIB_LIBADD:=$(LIB_LIBADD) -lsocket -lnsl endif ifeq ($(WITH_EC),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EC endif ifeq ($(WITH_ADNS),yes) BROKER_LDADD:=$(BROKER_LDADD) -lanl BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_ADNS endif ifeq ($(WITH_CONTROL),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_CONTROL endif MAKE_ALL:=mosquitto ifeq ($(WITH_DOCS),yes) MAKE_ALL:=$(MAKE_ALL) docs endif ifeq ($(WITH_JEMALLOC),yes) BROKER_LDADD:=$(BROKER_LDADD) -ljemalloc endif ifeq ($(WITH_UNIX_SOCKETS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_UNIX_SOCKETS LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_UNIX_SOCKETS CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_UNIX_SOCKETS endif ifeq ($(WITH_WEBSOCKETS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WEBSOCKETS BROKER_LDADD:=$(BROKER_LDADD) -lwebsockets endif INSTALL?=install prefix?=/usr/local incdir?=${prefix}/include libdir?=${prefix}/lib${LIB_SUFFIX} localedir?=${prefix}/share/locale mandir?=${prefix}/share/man STRIP?=strip ifeq ($(WITH_STRIP),yes) STRIP_OPTS?=-s --strip-program=${CROSS_COMPILE}${STRIP} endif ifeq ($(WITH_EPOLL),yes) ifeq ($(UNAME),Linux) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EPOLL endif endif ifeq ($(WITH_BUNDLED_DEPS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -I../deps LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -I../deps PLUGIN_CPPFLAGS:=$(PLUGIN_CPPFLAGS) -I../../deps endif ifeq ($(WITH_COVERAGE),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -coverage BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -coverage PLUGIN_CFLAGS:=$(PLUGIN_CFLAGS) -coverage PLUGIN_LDFLAGS:=$(PLUGIN_LDFLAGS) -coverage LIB_CFLAGS:=$(LIB_CFLAGS) -coverage LIB_LDFLAGS:=$(LIB_LDFLAGS) -coverage CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -coverage CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) -coverage endif ifeq ($(WITH_CJSON),yes) CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_CJSON CLIENT_LDADD:=$(CLIENT_LDADD) -lcjson CLIENT_STATIC_LDADD:=$(CLIENT_STATIC_LDADD) -lcjson CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) endif ifeq ($(WITH_XTREPORT),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_XTREPORT endif ifeq ($(WITH_OLD_KEEPALIVE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_OLD_KEEPALIVE endif BROKER_LDADD:=${BROKER_LDADD} ${LDADD} CLIENT_LDADD:=${CLIENT_LDADD} ${LDADD} PASSWD_LDADD:=${PASSWD_LDADD} ${LDADD}# ============================================================================= # User configuration section. # # These options control compilation on all systems apart from Windows and Mac # OS X. Use CMake to compile on Windows and Mac. # # Largely, these are options that are designed to make mosquitto run more # easily in restrictive environments by removing features. # # Modify the variable below to enable/disable features. # # Can also be overriden at the command line, e.g.: # # make WITH_TLS=no # ============================================================================= # Uncomment to compile the broker with tcpd/libwrap support. #WITH_WRAP:=yes # Comment out to disable SSL/TLS support in the broker and client. # Disabling this will also mean that passwords must be stored in plain text. It # is strongly recommended that you only disable WITH_TLS if you are not using # password authentication at all. WITH_TLS:=no # Comment out to disable TLS/PSK support in the broker and client. Requires # WITH_TLS=yes. # This must be disabled if using openssl < 1.0. WITH_TLS_PSK:=no # Comment out to disable client threading support. WITH_THREADING:=yes # Comment out to remove bridge support from the broker. This allow the broker # to connect to other brokers and subscribe/publish to topics. You probably # want to leave this included unless you want to save a very small amount of # memory size and CPU time. WITH_BRIDGE:=yes # Comment out to remove persistent database support from the broker. This # allows the broker to store retained messages and durable subscriptions to a # file periodically and on shutdown. This is usually desirable (and is # suggested by the MQTT spec), but it can be disabled if required. WITH_PERSISTENCE:=yes # Comment out to remove memory tracking support from the broker. If disabled, # mosquitto won't track heap memory usage nor export '$SYS/broker/heap/current # size', but will use slightly less memory and CPU time. WITH_MEMORY_TRACKING:=yes # Compile with database upgrading support? If disabled, mosquitto won't # automatically upgrade old database versions. # Not currently supported. #WITH_DB_UPGRADE:=yes # Comment out to remove publishing of the $SYS topic hierarchy containing # information about the broker state. WITH_SYS_TREE:=yes # Build with systemd support. If enabled, mosquitto will notify systemd after # initialization. See README in service/systemd/ for more information. # Setting to yes means the libsystemd-dev or similar package will need to be # installed. WITH_SYSTEMD:=no # Build with SRV lookup support. WITH_SRV:=no # Build with websockets support on the broker. WITH_WEBSOCKETS:=no # Use elliptic keys in broker WITH_EC:=yes # Build man page documentation by default. WITH_DOCS:=yes # Build with client support for SOCK5 proxy. WITH_SOCKS:=yes # Strip executables and shared libraries on install. WITH_STRIP:=no # Build static libraries WITH_STATIC_LIBRARIES:=yes # Use this variable to add extra library dependencies when building the clients # with the static libmosquitto library. This may be required on some systems # where e.g. -lz or -latomic are needed for openssl. CLIENT_STATIC_LDADD:= # Build shared libraries WITH_SHARED_LIBRARIES:=no # Build with async dns lookup support for bridges (temporary). Requires glibc. #WITH_ADNS:=yes # Build with epoll support. WITH_EPOLL:=yes # Build with bundled uthash.h WITH_BUNDLED_DEPS:=yes # Build with coverage options WITH_COVERAGE:=no # Build with unix domain socket support WITH_UNIX_SOCKETS:=yes # Build mosquitto_sub with cJSON support WITH_CJSON:=no # Build mosquitto with support for the $CONTROL topics. WITH_CONTROL:=yes # 设置交叉编译器 CC = aarch64-none-linux-gnu-gcc AR = aarch64-none-linux-gnu-gcc RANLIB = aarch64-none-linux-gnu-gcc-ranlib # Build the broker with the jemalloc allocator WITH_JEMALLOC:=no # Build with xtreport capability. This is for debugging purposes and is # probably of no particular interest to end users. WITH_XTREPORT=no # Use the old O(n) keepalive check routine, instead of the new O(1) keepalive # check routine. See src/keepalive.c for notes on this. WITH_OLD_KEEPALIVE=no # Build using clang and with address sanitiser enabled WITH_ASAN=no # ============================================================================= # End of user configuration # ============================================================================= # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi VERSION=2.0.22 # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 # Man page generation requires xsltproc and docbook-xsl XSLTPROC=xsltproc --nonet # For html generation DB_HTML_XSL=man/html.xsl #MANCOUNTRIES=en_GB UNAME:=$(shell uname -s) ARCH:=$(shell uname -p) ifeq ($(UNAME),SunOS) ifeq ($(CC),cc) CFLAGS?=-O else CFLAGS?=-Wall -ggdb -O2 endif else CFLAGS?=-Wall -ggdb -O2 -Wconversion -Wextra endif ifeq ($(WITH_ASAN),yes) CC:=clang CFLAGS+=-fsanitize=address LDFLAGS+=-fsanitize=address endif STATIC_LIB_DEPS:= APP_CPPFLAGS=$(CPPFLAGS) -I. -I../../ -I../../include -I../../src -I../../lib APP_CFLAGS=$(CFLAGS) -DVERSION=\""${VERSION}\"" APP_LDFLAGS:=$(LDFLAGS) LIB_CPPFLAGS=$(CPPFLAGS) -I. -I.. -I../include -I../../include LIB_CFLAGS:=$(CFLAGS) LIB_CXXFLAGS:=$(CXXFLAGS) LIB_LDFLAGS:=$(LDFLAGS) LIB_LIBADD:=$(LIBADD) BROKER_CPPFLAGS:=$(LIB_CPPFLAGS) -I../lib BROKER_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER BROKER_LDFLAGS:=${LDFLAGS} BROKER_LDADD:= CLIENT_CPPFLAGS:=$(CPPFLAGS) -I.. -I../include CLIENT_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" CLIENT_LDFLAGS:=$(LDFLAGS) -L../lib CLIENT_LDADD:= PASSWD_LDADD:= PLUGIN_CPPFLAGS:=$(CPPFLAGS) -I../.. -I../../include PLUGIN_CFLAGS:=$(CFLAGS) -fPIC PLUGIN_LDFLAGS:=$(LDFLAGS) ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),) BROKER_LDADD:=$(BROKER_LDADD) -lm BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms SEDINPLACE:=-i "" else BROKER_LDADD:=$(BROKER_LDADD) -ldl -lm SEDINPLACE:=-i endif ifeq ($(UNAME),Linux) BROKER_LDADD:=$(BROKER_LDADD) -lrt BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms LIB_LIBADD:=$(LIB_LIBADD) -lrt endif ifeq ($(WITH_SHARED_LIBRARIES),yes) CLIENT_LDADD:=${CLIENT_LDADD} ../lib/libmosquitto.so.${SOVERSION} endif ifeq ($(UNAME),SunOS) SEDINPLACE:= ifeq ($(ARCH),sparc) ifeq ($(CC),cc) LIB_CFLAGS:=$(LIB_CFLAGS) -xc99 -KPIC else LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC endif endif ifeq ($(ARCH),i386) LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC endif ifeq ($(CXX),CC) LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -KPIC else LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC endif else LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC endif ifneq ($(UNAME),SunOS) LIB_LDFLAGS:=$(LIB_LDFLAGS) -Wl,--version-script=linker.version -Wl,-soname,libmosquitto.so.$(SOVERSION) endif ifeq ($(UNAME),QNX) BROKER_LDADD:=$(BROKER_LDADD) -lsocket LIB_LIBADD:=$(LIB_LIBADD) -lsocket endif ifeq ($(WITH_WRAP),yes) BROKER_LDADD:=$(BROKER_LDADD) -lwrap BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WRAP endif ifeq ($(WITH_TLS),yes) APP_CPPFLAGS:=$(APP_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L BROKER_LDADD:=$(BROKER_LDADD) -lssl -lcrypto CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L LIB_LIBADD:=$(LIB_LIBADD) -lssl -lcrypto PASSWD_LDADD:=$(PASSWD_LDADD) -lcrypto STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lssl -lcrypto ifeq ($(WITH_TLS_PSK),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS_PSK LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS_PSK CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS_PSK endif endif ifeq ($(WITH_THREADING),yes) LIB_LDFLAGS:=$(LIB_LDFLAGS) -pthread LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_THREADING CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_THREADING STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -pthread endif ifeq ($(WITH_SOCKS),yes) LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SOCKS CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SOCKS endif ifeq ($(WITH_BRIDGE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_BRIDGE endif ifeq ($(WITH_PERSISTENCE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_PERSISTENCE endif ifeq ($(WITH_MEMORY_TRACKING),yes) ifneq ($(UNAME),SunOS) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_MEMORY_TRACKING endif endif ifeq ($(WITH_SYS_TREE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYS_TREE endif ifeq ($(WITH_SYSTEMD),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYSTEMD BROKER_LDADD:=$(BROKER_LDADD) -lsystemd endif ifeq ($(WITH_SRV),yes) LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SRV LIB_LIBADD:=$(LIB_LIBADD) -lcares CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SRV STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lcares endif ifeq ($(UNAME),SunOS) BROKER_LDADD:=$(BROKER_LDADD) -lsocket -lnsl LIB_LIBADD:=$(LIB_LIBADD) -lsocket -lnsl endif ifeq ($(WITH_EC),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EC endif ifeq ($(WITH_ADNS),yes) BROKER_LDADD:=$(BROKER_LDADD) -lanl BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_ADNS endif ifeq ($(WITH_CONTROL),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_CONTROL endif MAKE_ALL:=mosquitto ifeq ($(WITH_DOCS),yes) MAKE_ALL:=$(MAKE_ALL) docs endif ifeq ($(WITH_JEMALLOC),yes) BROKER_LDADD:=$(BROKER_LDADD) -ljemalloc endif ifeq ($(WITH_UNIX_SOCKETS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_UNIX_SOCKETS LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_UNIX_SOCKETS CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_UNIX_SOCKETS endif ifeq ($(WITH_WEBSOCKETS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WEBSOCKETS BROKER_LDADD:=$(BROKER_LDADD) -lwebsockets endif INSTALL?=install prefix?=/usr/local incdir?=${prefix}/include libdir?=${prefix}/lib${LIB_SUFFIX} localedir?=${prefix}/share/locale mandir?=${prefix}/share/man STRIP?=strip ifeq ($(WITH_STRIP),yes) STRIP_OPTS?=-s --strip-program=${CROSS_COMPILE}${STRIP} endif ifeq ($(WITH_EPOLL),yes) ifeq ($(UNAME),Linux) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EPOLL endif endif ifeq ($(WITH_BUNDLED_DEPS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -I../deps LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -I../deps PLUGIN_CPPFLAGS:=$(PLUGIN_CPPFLAGS) -I../../deps endif ifeq ($(WITH_COVERAGE),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -coverage BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -coverage PLUGIN_CFLAGS:=$(PLUGIN_CFLAGS) -coverage PLUGIN_LDFLAGS:=$(PLUGIN_LDFLAGS) -coverage LIB_CFLAGS:=$(LIB_CFLAGS) -coverage LIB_LDFLAGS:=$(LIB_LDFLAGS) -coverage CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -coverage CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) -coverage endif ifeq ($(WITH_CJSON),yes) CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_CJSON CLIENT_LDADD:=$(CLIENT_LDADD) -lcjson CLIENT_STATIC_LDADD:=$(CLIENT_STATIC_LDADD) -lcjson CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) endif ifeq ($(WITH_XTREPORT),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_XTREPORT endif ifeq ($(WITH_OLD_KEEPALIVE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_OLD_KEEPALIVE endif BROKER_LDADD:=${BROKER_LDADD} ${LDADD} CLIENT_LDADD:=${CLIENT_LDADD} ${LDADD} PASSWD_LDADD:=${PASSWD_LDADD} ${LDADD}# ============================================================================= # User configuration section. # # These options control compilation on all systems apart from Windows and Mac # OS X. Use CMake to compile on Windows and Mac. # # Largely, these are options that are designed to make mosquitto run more # easily in restrictive environments by removing features. # # Modify the variable below to enable/disable features. # # Can also be overriden at the command line, e.g.: # # make WITH_TLS=no # ============================================================================= # Uncomment to compile the broker with tcpd/libwrap support. #WITH_WRAP:=yes # Comment out to disable SSL/TLS support in the broker and client. # Disabling this will also mean that passwords must be stored in plain text. It # is strongly recommended that you only disable WITH_TLS if you are not using # password authentication at all. WITH_TLS:=no # Comment out to disable TLS/PSK support in the broker and client. Requires # WITH_TLS=yes. # This must be disabled if using openssl < 1.0. WITH_TLS_PSK:=no # Comment out to disable client threading support. WITH_THREADING:=yes # Comment out to remove bridge support from the broker. This allow the broker # to connect to other brokers and subscribe/publish to topics. You probably # want to leave this included unless you want to save a very small amount of # memory size and CPU time. WITH_BRIDGE:=yes # Comment out to remove persistent database support from the broker. This # allows the broker to store retained messages and durable subscriptions to a # file periodically and on shutdown. This is usually desirable (and is # suggested by the MQTT spec), but it can be disabled if required. WITH_PERSISTENCE:=yes # Comment out to remove memory tracking support from the broker. If disabled, # mosquitto won't track heap memory usage nor export '$SYS/broker/heap/current # size', but will use slightly less memory and CPU time. WITH_MEMORY_TRACKING:=yes # Compile with database upgrading support? If disabled, mosquitto won't # automatically upgrade old database versions. # Not currently supported. #WITH_DB_UPGRADE:=yes # Comment out to remove publishing of the $SYS topic hierarchy containing # information about the broker state. WITH_SYS_TREE:=yes # Build with systemd support. If enabled, mosquitto will notify systemd after # initialization. See README in service/systemd/ for more information. # Setting to yes means the libsystemd-dev or similar package will need to be # installed. WITH_SYSTEMD:=no # Build with SRV lookup support. WITH_SRV:=no # Build with websockets support on the broker. WITH_WEBSOCKETS:=no # Use elliptic keys in broker WITH_EC:=yes # Build man page documentation by default. WITH_DOCS:=yes # Build with client support for SOCK5 proxy. WITH_SOCKS:=yes # Strip executables and shared libraries on install. WITH_STRIP:=no # Build static libraries WITH_STATIC_LIBRARIES:=yes # Use this variable to add extra library dependencies when building the clients # with the static libmosquitto library. This may be required on some systems # where e.g. -lz or -latomic are needed for openssl. CLIENT_STATIC_LDADD:= # Build shared libraries WITH_SHARED_LIBRARIES:=no # Build with async dns lookup support for bridges (temporary). Requires glibc. #WITH_ADNS:=yes # Build with epoll support. WITH_EPOLL:=yes # Build with bundled uthash.h WITH_BUNDLED_DEPS:=yes # Build with coverage options WITH_COVERAGE:=no # Build with unix domain socket support WITH_UNIX_SOCKETS:=yes # Build mosquitto_sub with cJSON support WITH_CJSON:=no # Build mosquitto with support for the $CONTROL topics. WITH_CONTROL:=yes # 设置交叉编译器 CC = aarch64-none-linux-gnu-gcc AR = aarch64-none-linux-gnu-gcc RANLIB = aarch64-none-linux-gnu-gcc-ranlib # Build the broker with the jemalloc allocator WITH_JEMALLOC:=no # Build with xtreport capability. This is for debugging purposes and is # probably of no particular interest to end users. WITH_XTREPORT=no # Use the old O(n) keepalive check routine, instead of the new O(1) keepalive # check routine. See src/keepalive.c for notes on this. WITH_OLD_KEEPALIVE=no # Build using clang and with address sanitiser enabled WITH_ASAN=no # ============================================================================= # End of user configuration # ============================================================================= # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi VERSION=2.0.22 # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 # Man page generation requires xsltproc and docbook-xsl XSLTPROC=xsltproc --nonet # For html generation DB_HTML_XSL=man/html.xsl #MANCOUNTRIES=en_GB UNAME:=$(shell uname -s) ARCH:=$(shell uname -p) ifeq ($(UNAME),SunOS) ifeq ($(CC),cc) CFLAGS?=-O else CFLAGS?=-Wall -ggdb -O2 endif else CFLAGS?=-Wall -ggdb -O2 -Wconversion -Wextra endif ifeq ($(WITH_ASAN),yes) CC:=clang CFLAGS+=-fsanitize=address LDFLAGS+=-fsanitize=address endif STATIC_LIB_DEPS:= APP_CPPFLAGS=$(CPPFLAGS) -I. -I../../ -I../../include -I../../src -I../../lib APP_CFLAGS=$(CFLAGS) -DVERSION=\""${VERSION}\"" APP_LDFLAGS:=$(LDFLAGS) LIB_CPPFLAGS=$(CPPFLAGS) -I. -I.. -I../include -I../../include LIB_CFLAGS:=$(CFLAGS) LIB_CXXFLAGS:=$(CXXFLAGS) LIB_LDFLAGS:=$(LDFLAGS) LIB_LIBADD:=$(LIBADD) BROKER_CPPFLAGS:=$(LIB_CPPFLAGS) -I../lib BROKER_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER BROKER_LDFLAGS:=${LDFLAGS} BROKER_LDADD:= CLIENT_CPPFLAGS:=$(CPPFLAGS) -I.. -I../include CLIENT_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" CLIENT_LDFLAGS:=$(LDFLAGS) -L../lib CLIENT_LDADD:= PASSWD_LDADD:= PLUGIN_CPPFLAGS:=$(CPPFLAGS) -I../.. -I../../include PLUGIN_CFLAGS:=$(CFLAGS) -fPIC PLUGIN_LDFLAGS:=$(LDFLAGS) ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),) BROKER_LDADD:=$(BROKER_LDADD) -lm BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms SEDINPLACE:=-i "" else BROKER_LDADD:=$(BROKER_LDADD) -ldl -lm SEDINPLACE:=-i endif ifeq ($(UNAME),Linux) BROKER_LDADD:=$(BROKER_LDADD) -lrt BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -Wl,--dynamic-list=linker.syms LIB_LIBADD:=$(LIB_LIBADD) -lrt endif ifeq ($(WITH_SHARED_LIBRARIES),yes) CLIENT_LDADD:=${CLIENT_LDADD} ../lib/libmosquitto.so.${SOVERSION} endif ifeq ($(UNAME),SunOS) SEDINPLACE:= ifeq ($(ARCH),sparc) ifeq ($(CC),cc) LIB_CFLAGS:=$(LIB_CFLAGS) -xc99 -KPIC else LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC endif endif ifeq ($(ARCH),i386) LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC endif ifeq ($(CXX),CC) LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -KPIC else LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC endif else LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC LIB_CXXFLAGS:=$(LIB_CXXFLAGS) -fPIC endif ifneq ($(UNAME),SunOS) LIB_LDFLAGS:=$(LIB_LDFLAGS) -Wl,--version-script=linker.version -Wl,-soname,libmosquitto.so.$(SOVERSION) endif ifeq ($(UNAME),QNX) BROKER_LDADD:=$(BROKER_LDADD) -lsocket LIB_LIBADD:=$(LIB_LIBADD) -lsocket endif ifeq ($(WITH_WRAP),yes) BROKER_LDADD:=$(BROKER_LDADD) -lwrap BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WRAP endif ifeq ($(WITH_TLS),yes) APP_CPPFLAGS:=$(APP_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L BROKER_LDADD:=$(BROKER_LDADD) -lssl -lcrypto CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS -DOPENSSL_API_COMPAT=0x10100000L LIB_LIBADD:=$(LIB_LIBADD) -lssl -lcrypto PASSWD_LDADD:=$(PASSWD_LDADD) -lcrypto STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lssl -lcrypto ifeq ($(WITH_TLS_PSK),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_TLS_PSK LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_TLS_PSK CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_TLS_PSK endif endif ifeq ($(WITH_THREADING),yes) LIB_LDFLAGS:=$(LIB_LDFLAGS) -pthread LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_THREADING CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_THREADING STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -pthread endif ifeq ($(WITH_SOCKS),yes) LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SOCKS CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SOCKS endif ifeq ($(WITH_BRIDGE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_BRIDGE endif ifeq ($(WITH_PERSISTENCE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_PERSISTENCE endif ifeq ($(WITH_MEMORY_TRACKING),yes) ifneq ($(UNAME),SunOS) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_MEMORY_TRACKING endif endif ifeq ($(WITH_SYS_TREE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYS_TREE endif ifeq ($(WITH_SYSTEMD),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_SYSTEMD BROKER_LDADD:=$(BROKER_LDADD) -lsystemd endif ifeq ($(WITH_SRV),yes) LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_SRV LIB_LIBADD:=$(LIB_LIBADD) -lcares CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_SRV STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lcares endif ifeq ($(UNAME),SunOS) BROKER_LDADD:=$(BROKER_LDADD) -lsocket -lnsl LIB_LIBADD:=$(LIB_LIBADD) -lsocket -lnsl endif ifeq ($(WITH_EC),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EC endif ifeq ($(WITH_ADNS),yes) BROKER_LDADD:=$(BROKER_LDADD) -lanl BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_ADNS endif ifeq ($(WITH_CONTROL),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_CONTROL endif MAKE_ALL:=mosquitto ifeq ($(WITH_DOCS),yes) MAKE_ALL:=$(MAKE_ALL) docs endif ifeq ($(WITH_JEMALLOC),yes) BROKER_LDADD:=$(BROKER_LDADD) -ljemalloc endif ifeq ($(WITH_UNIX_SOCKETS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_UNIX_SOCKETS LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -DWITH_UNIX_SOCKETS CLIENT_CPPFLAGS:=$(CLIENT_CPPFLAGS) -DWITH_UNIX_SOCKETS endif ifeq ($(WITH_WEBSOCKETS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WEBSOCKETS BROKER_LDADD:=$(BROKER_LDADD) -lwebsockets endif INSTALL?=install prefix?=/usr/local incdir?=${prefix}/include libdir?=${prefix}/lib${LIB_SUFFIX} localedir?=${prefix}/share/locale mandir?=${prefix}/share/man STRIP?=strip ifeq ($(WITH_STRIP),yes) STRIP_OPTS?=-s --strip-program=${CROSS_COMPILE}${STRIP} endif ifeq ($(WITH_EPOLL),yes) ifeq ($(UNAME),Linux) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_EPOLL endif endif ifeq ($(WITH_BUNDLED_DEPS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -I../deps LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -I../deps PLUGIN_CPPFLAGS:=$(PLUGIN_CPPFLAGS) -I../../deps endif ifeq ($(WITH_COVERAGE),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -coverage BROKER_LDFLAGS:=$(BROKER_LDFLAGS) -coverage PLUGIN_CFLAGS:=$(PLUGIN_CFLAGS) -coverage PLUGIN_LDFLAGS:=$(PLUGIN_LDFLAGS) -coverage LIB_CFLAGS:=$(LIB_CFLAGS) -coverage LIB_LDFLAGS:=$(LIB_LDFLAGS) -coverage CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -coverage CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) -coverage endif ifeq ($(WITH_CJSON),yes) CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_CJSON CLIENT_LDADD:=$(CLIENT_LDADD) -lcjson CLIENT_STATIC_LDADD:=$(CLIENT_STATIC_LDADD) -lcjson CLIENT_LDFLAGS:=$(CLIENT_LDFLAGS) endif ifeq ($(WITH_XTREPORT),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_XTREPORT endif ifeq ($(WITH_OLD_KEEPALIVE),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_OLD_KEEPALIVE endif BROKER_LDADD:=${BROKER_LDADD} ${LDADD} CLIENT_LDADD:=${CLIENT_LDADD} ${LDADD} PASSWD_LDADD:=${PASSWD_LDADD} ${LDADD}
09-24
这个是完整源码 python实现 Django 【python毕业设计】基于Python的天气预报(天气预测分析)(Django+sklearn机器学习+selenium爬虫)可视化系统.zip 源码+论文+sql脚本 完整版 数据库是mysql 本研究旨在开发一个基于Python的天气预报可视化系统,该系统结合了Django框架、sklearn机器学习库和Selenium爬虫技术,实现对天气数据的收集、分析和可视化。首先,我们使用Selenium爬虫技术从多个天气数据网站实时抓取气象数据,包括温度、湿度、气压、风速等多项指标。这些数据经过清洗和预处理后本研究旨在开发一个基于Python的天气预报可视化系统,该系统结合了Django框架、sklearn机器学习库和Selenium爬虫技术,实现对天气数据的收集、分析和可视化。首先,我们使用Selenium爬虫技术从多个天气数据网站实时抓取气象数据,包括温度、湿度、气压、风速等多项指标。这些数据经过清洗和预处理后,将其存储在后端数据库中,以供后续分析。 其次,采用s,将其存储在后端数据库中,以供后续分析。 其次,采用sklearn机器学习库构建预测模型,通过时间序列分析和回归方法,对未来天气情况进行预测。我们利用以往的数据训练模型,以提高预测的准确性。通过交叉验证和超参数优化等技术手段,我们优化了模型性能,确保其在实际应用中的有效性和可靠性。 最后,基于Django框架开发前端展示系统,实现天气预报的可视化。用户可以通过友好的界面查询实时天气信息和未来几天内的天气预测。系统还提供多种图表类型,包括折线图和柱状图,帮助用户直观理解天气变化趋势。 本研究的成果为天气预报领域提供了一种新的技术解决方案,不仅增强了数据获取和处理的效率,还提升了用户体验。未来,该系统能够扩展至其他气象相关的应用场景,为大众提供更加准确和及时的气象服务。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值