Closed ethsonliu closed 5 years ago
Can you retest with #27 ? I think that is an issue in the mqtt library. I updated to the latest version of that library. That should fix your problem.
Hi, I rebuild the project, but something went wrong.
jalyn@Ubuntu-64:~/mqtt-stresser-upgrade-mqtt-library$ make linux
GO111MODULE=on GOOS=linux GOARCH=amd64 go build -mod=vendor -o build/mqtt-stresser-linux-amd64
flag provided but not defined: -mod
usage: build [-o output] [build flags] [packages]
Build compiles the packages named by the import paths,
along with their dependencies, but it does not install the results.
If the arguments are a list of .go files, build treats them as a list
of source files specifying a single package.
When the command line specifies a single main package,
build writes the resulting executable to output.
Otherwise build compiles the packages but discards the results,
serving only as a check that the packages can be built.
The -o flag specifies the output file name. If not specified, the
output file name depends on the arguments and derives from the name
of the package, such as p.a for package p, unless p is 'main'. If
the package is main and file names are provided, the file name
derives from the first file name mentioned, such as f1 for 'go build
f1.go f2.go'; with no files provided ('go build'), the output file
name is the base name of the containing directory.
The build flags are shared by the build, install, run, and test commands:
-a
force rebuilding of packages that are already up-to-date.
-n
print the commands but do not run them.
-p n
the number of builds that can be run in parallel.
The default is the number of CPUs available.
-race
enable data race detection.
Supported only on linux/amd64, darwin/amd64 and windows/amd64.
-v
print the names of packages as they are compiled.
-work
print the name of the temporary work directory and
do not delete it when exiting.
-x
print the commands.
-ccflags 'arg list'
arguments to pass on each 5c, 6c, or 8c compiler invocation.
-compiler name
name of compiler to use, as in runtime.Compiler (gccgo or gc).
-gccgoflags 'arg list'
arguments to pass on each gccgo compiler/linker invocation.
-gcflags 'arg list'
arguments to pass on each 5g, 6g, or 8g compiler invocation.
-installsuffix suffix
a suffix to use in the name of the package installation directory,
in order to keep output separate from default builds.
If using the -race flag, the install suffix is automatically set to race
or, if set explicitly, has _race appended to it.
-ldflags 'flag list'
arguments to pass on each 5l, 6l, or 8l linker invocation.
-tags 'tag list'
a list of build tags to consider satisfied during the build.
See the documentation for the go/build package for
more information about build tags.
The list flags accept a space-separated list of strings. To embed spaces
in an element in the list, surround it with either single or double quotes.
For more about specifying packages, see 'go help packages'.
For more about where packages and binaries are installed,
run 'go help gopath'. For more about calling between Go and C/C++,
run 'go help c'.
See also: go install, go get, go clean.
make: *** [build/mqtt-stresser-linux-amd64] 错误 2
Linux platform is Ubuntu 14.04
, and my go version and env are,
jalyn@Ubuntu-64:~/mqtt-stresser-upgrade-mqtt-library$ go version
go version go1.2.1 linux/amd64
jalyn@Ubuntu-64:~/mqtt-stresser-upgrade-mqtt-library$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"
We moved to go modules in that branch. This requires at least go 1.11. I recommend 1.12.
You could try to remove the -mod=vendor
in the Makefile. (https://github.com/inovex/mqtt-stresser/blob/c39e6d8b40ac668a51db376131bb392d4a162d7b/Makefile#L5 and https://github.com/inovex/mqtt-stresser/blob/c39e6d8b40ac668a51db376131bb392d4a162d7b/Makefile#L6)
I changed go to 1.12, and remove -mod=vendor
, but,
jalyn@Ubuntu-64:~/mqtt-stresser-upgrade-mqtt-library$ go version
go version go1.12.2 linux/amd64
jalyn@Ubuntu-64:~/mqtt-stresser-upgrade-mqtt-library$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jalyn/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jalyn/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build345339705=/tmp/go-build -gno-record-gcc-switches"
jalyn@Ubuntu-64:~/mqtt-stresser-upgrade-mqtt-library$ make linux
go mod init
go: cannot determine module path for source directory /home/jalyn/mqtt-stresser-upgrade-mqtt-library (outside GOPATH, no import comments)
make: *** [go.mod] 错误 1
If you moved to go 1.12, you don't have to remove -mod=vendor
.
Furthermore, the go mod init
is odd. Did you remove the go.mod
file? the go mod init
only happens if that file is not present.
Yes, you are right. Build successfully.
When run the exe with
./mqtt-stresser-linux-amd64-static -broker tcp://45.76.163.6:1883 -num-clients 32219 -num-messages 100 -publisher-qos 2 -subscriber-qos 2
at the platform of Ubuntu 14.04 x64.(45.76.163.6 is my centos6 1G 1CPU vps in vultr.com in Singapore, if you want, you can use it to test, and it's broker's web service port is 18083)
Here is the output,