ao-space / gt

Fast WebSocket(s)/HTTP(s)/TCP relay proxy for making tunnels to localhost.
https://ao.space
Apache License 2.0
121 stars 34 forks source link

linux上gt编译失败 #22

Closed mmabluesky closed 1 year ago

mmabluesky commented 1 year ago

hi :

我在ubuntu 上编译gt ,

报如下错误:

ya@ya-linux:~/work/gt$ make gofumpt --version || go install mvdan.cc/gofumpt@latest v0.5.0 (go1.18.1) gofumpt -l -w ./conn/conn.go ./predef/version.go ./predef/release.go ./predef/const.go ./predef/debug.go ./util/rand.go ./util/portrange.go ./util/portrange_test.go ./util/blockvalue_test.go ./util/blockvalue.go ./config/position_test.go ./config/slice_test.go ./config/positionslice_test.go ./config/slice.go ./config/config.go ./config/config_test.go ./config/positionslice.go ./config/position.go ./logger/logger.go ./cmd/server/main.go ./cmd/client/main.go ./server/user_test.go ./server/tls_test.go ./server/sync/map_test.go ./server/sync/create.go ./server/sync/map_reference_test.go ./server/sync/map.go ./server/sync/map_bench_test.go ./server/server.go ./server/http.go ./server/client.go ./server/api/server.go ./server/tls.go ./server/config.go ./server/conn.go ./server/http_test.go ./client/release.go ./client/api/listener.go ./client/api/conn.go ./client/api/server.go ./client/task.go ./client/client.go ./client/webrtc/integrate_test.go ./client/webrtc/datachannel.go ./client/webrtc/icecandidate.go ./client/webrtc/speedtest/client/main.go ./client/webrtc/speedtest/echoServer/main.go ./client/webrtc/sessiondescription.go ./client/webrtc/logging.go ./client/webrtc/peerconnection.go ./client/client_test.go ./client/conn.go ./client/tcpforward.go ./client/idle.go ./client/task_test.go ./client/debug.go ./client/config.go ./client/peer.go ./pool/pool.go ./test/tls_test.go ./test/p2p_test.go ./test/tunnel_test.go ./test/integrate_test.go ./test/services_test.go golangci-lint --version || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 golangci-lint has version (devel) built with go1.20.7 from (unknown, mod sum: "") on (unknown) golangci-lint run \ --skip-dirs client/std \ --skip-dirs dep \ --skip-dirs bufio \ --skip-dirs logger/file-rotatelogs \ --skip-dirs build \ --skip-dirs release \ --exclude 'SA6002: argument should be pointer-like to avoid allocations' \ --exclude 'S1000: should use a simple channel send/receive instead ofselectwith a single case' client/api/server.go:56:12: s.Serve undefined (type *Server has no field or method Serve) (typecheck) err := s.Serve(s.Listener) ^ client/webrtc/datachannel.go:21:8: could not import C (cgo preprocessing failed) (typecheck) import "C" ^ client/webrtc/datachannel.go:77:11: undefined: pointer (typecheck) d, ok := pointer.Restore(userData).(*DataChannel) ^ client/webrtc/datachannel.go:90:11: undefined: pointer (typecheck) d, ok := pointer.Restore(userData).(*DataChannel) ^ client/webrtc/datachannel.go:106:11: undefined: pointer (typecheck) d, ok := pointer.Restore(userData).(*DataChannel) ^ logger/logger.go:144:6: l.Error undefined (type *Logger has no field or method Error) (typecheck) l.Error().Err(err).Msg("failed to close sentry") ^ logger/logger.go:150:6: l.Error undefined (type *Logger has no field or method Error) (typecheck) l.Error().Err(err).Msg("failed to sync log file") ^ logger/logger.go:154:6: l.Error undefined (type *Logger has no field or method Error) (typecheck) l.Error().Err(err).Msg("failed to close log file") ^ server/api/server.go:153:27: s.Addr undefined (type *Server has no field or method Addr) (typecheck) "-local", "http://" + s.Addr, ^ client/client.go:415:5: t.SendForceCloseSignal undefined (type *conn has no field or method SendForceCloseSignal) (typecheck) t.SendForceCloseSignal() ^ client/client.go:439:5: t.SendCloseSignal undefined (type *conn has no field or method SendCloseSignal) (typecheck) t.SendCloseSignal() ^ client/client.go:467:9: result.Logger undefined (type *conn has no field or method Logger) (typecheck) result.Logger = c.Logger.With().Uint("connID", connID).Logger() ^ client/client.go:783:14: t.Write undefined (type *conn has no field or method Write) (typecheck) _, err = t.Write(buf[:n+i]) ^ client/client.go:787:5: t.Logger undefined (type *conn has no field or method Logger) (typecheck) t.Logger.Info().Msg("sent reload info") ^ client/conn.go:63:13: c.Conn undefined (type *conn has no field or method Conn) (typecheck) _, err = c.Conn.Write(buf[:bufIndex+n]) ^ client/conn.go:139:5: c.Logger undefined (type *conn has no field or method Logger) (typecheck) c.Logger.Debug().Err(err).Msg("failed to send ping signal") ^ client/conn.go:145:8: c.Closing undefined (type *conn has no field or method Closing) (typecheck) if !c.Closing.CompareAndSwap(0, 1) { ^ client/conn.go:171:5: c.Logger undefined (type *conn has no field or method Logger) (typecheck) c.Logger.Info().Err(err).Bool("isClosing", isClosing).Uint64("finishedTasks", c.finishedTasks.Load()). ^ client/conn.go:174:20: c.Reader undefined (type *conn has no field or method Reader) (typecheck) pool.PutReader(c.Reader) ^ client/conn.go:178:15: c.Reader undefined (type *conn has no field or method Reader) (typecheck) r.Reader = c.Reader ^ client/conn.go:188:12: c.Conn undefined (type *conn has no field or method Conn) (typecheck) err = c.Conn.SetReadDeadline(time.Now().Add(timeout)) ^ client/conn.go:194:22: c.Reader undefined (type *conn has no field or method Reader) (typecheck) peekBytes, err = c.Reader.Peek(4) ^ client/conn.go:198:7: c.Logger undefined (type *conn has no field or method Logger) (typecheck) c.Logger.Info().Bool("isClosing", isClosing).Uint64("finishedTasks", c.finishedTasks.Load()). ^ client/conn.go:222:8: c.SendCloseSignal undefined (type *conn has no field or method SendCloseSignal) (typecheck) c.SendCloseSignal() ^ client/peer.go:184:16: c.Write undefined (type *conn has no field or method Write) (typecheck) _, wErr = c.Write(buf[:6]) ^ client/peer.go:213:15: c.Write undefined (type *conn has no field or method Write) (typecheck) _, wErr = c.Write(buf[:l]) ^ client/peer.go:220:13: c.Conn undefined (type *conn has no field or method Conn) (typecheck) wErr = c.Conn.SetReadDeadline(dl) ^ client/task.go:246:13: c.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) count := c.TasksCount.Add(1) ^ client/task.go:255:16: c.Write undefined (type *conn has no field or method Write) (typecheck) _, wErr = c.Write(buf[:6]) ^ client/task.go:264:8: c.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) if c.TasksCount.Add(^uint32(0)) == 0 { ^ client/task.go:266:9: c.IsClosing undefined (type *conn has no field or method IsClosing) (typecheck) if c.IsClosing() { ^ client/task.go:267:7: c.SendForceCloseSignal undefined (type *conn has no field or method SendForceCloseSignal) (typecheck) c.SendForceCloseSignal() ^ server/server.go:64:16: undefined: turn (typecheck) turnServer *turn.Server ^ server/client.go:103:13: t.SendErrorSignalReachedMaxConnections undefined (type *conn has no field or method SendErrorSignalReachedMaxConnections) (typecheck) if e := t.SendErrorSignalReachedMaxConnections(); e != nil { ^ server/client.go:104:6: t.Logger undefined (type *conn has no field or method Logger) (typecheck) t.Logger.Error().Err(e).Msg("failed to SendErrorSignalReachedMaxConnections") ^ server/client.go:114:5: t.Logger undefined (type *conn has no field or method Logger) (typecheck) t.Logger.Info(). ^ server/client.go:119:11: tunnel.Logger undefined (type *conn has no field or method Logger) (typecheck) tunnel.Logger.Info(). ^ server/client.go:124:12: tunnel.Logger undefined (type *conn has no field or method Logger) (typecheck) tunnel.Logger.Info(). ^ server/client.go:133:14: t.SendErrorSignalDifferentConfigClientConnected undefined (type *conn has no field or method SendErrorSignalDifferentConfigClientConnected) (typecheck) if e := t.SendErrorSignalDifferentConfigClientConnected(); e != nil { ^ server/client.go:166:11: tunnel.Logger undefined (type *conn has no field or method Logger) (typecheck) tunnel.Logger.Info(). ^ server/client.go:179:11: tunnel.SendCloseSignal undefined (type *conn has no field or method SendCloseSignal) (typecheck) tunnel.SendCloseSignal() ^ server/client.go:269:9: conn.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) conn.TasksCount.Add(1) ^ server/client.go:275:14: t.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) count := t.TasksCount.Load() ^ server/client.go:278:9: conn.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) conn.TasksCount.Add(1) ^ server/client.go:287:8: conn.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) conn.TasksCount.Add(1) ^ server/client.go:296:6: t.SendForceCloseSignal undefined (type *conn has no field or method SendForceCloseSignal) (typecheck) t.SendForceCloseSignal() ^ server/client.go:297:6: t.Close undefined (type *conn has no field or method Close) (typecheck) t.Close() ^ server/client.go:308:5: t.Shutdown undefined (type *conn has no field or method Shutdown) (typecheck) t.Shutdown() ^ server/client.go:434:10: conn.Logger undefined (type *conn has no field or method Logger) (typecheck) conn.Logger.Error().Err(err).Msg("openSpecifiedTCPPort") ^ server/conn.go:67:5: nc.Logger undefined (type *conn has no field or method Logger) (typecheck) nc.Logger = s.Logger.With(). ^ make: *** [Makefile:74:golangci-lint] 错误 1 ya@ya-linux:~/work/gt$ ^C ya@ya-linux:~/work/gt$ ya@ya-linux:~/work/gt$ ya@ya-linux:~/work/gt$ ya@ya-linux:~/work/gt$ ya@ya-linux:~/work/gt$ ya@ya-linux:~/work/gt$ make release sh -c "command -v gn" make: *** [Makefile:144:check_webrtc_dependencies] 错误 127 ya@ya-linux:~/work/gt$ make -j8 gofumpt --version || go install mvdan.cc/gofumpt@latest golangci-lint --version || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 v0.5.0 (go1.18.1) gofumpt -l -w ./conn/conn.go ./predef/version.go ./predef/release.go ./predef/const.go ./predef/debug.go ./util/rand.go ./util/portrange.go ./util/portrange_test.go ./util/blockvalue_test.go ./util/blockvalue.go ./config/position_test.go ./config/slice_test.go ./config/positionslice_test.go ./config/slice.go ./config/config.go ./config/config_test.go ./config/positionslice.go ./config/position.go ./logger/logger.go ./cmd/server/main.go ./cmd/client/main.go ./server/user_test.go ./server/tls_test.go ./server/sync/map_test.go ./server/sync/create.go ./server/sync/map_reference_test.go ./server/sync/map.go ./server/sync/map_bench_test.go ./server/server.go ./server/http.go ./server/client.go ./server/api/server.go ./server/tls.go ./server/config.go ./server/conn.go ./server/http_test.go ./client/release.go ./client/api/listener.go ./client/api/conn.go ./client/api/server.go ./client/task.go ./client/client.go ./client/webrtc/integrate_test.go ./client/webrtc/datachannel.go ./client/webrtc/icecandidate.go ./client/webrtc/speedtest/client/main.go ./client/webrtc/speedtest/echoServer/main.go ./client/webrtc/sessiondescription.go ./client/webrtc/logging.go ./client/webrtc/peerconnection.go ./client/client_test.go ./client/conn.go ./client/tcpforward.go ./client/idle.go ./client/task_test.go ./client/debug.go ./client/config.go ./client/peer.go ./pool/pool.go ./test/tls_test.go ./test/p2p_test.go ./test/tunnel_test.go ./test/integrate_test.go ./test/services_test.go sh -c "command -v gn" git submodule update --init --recursive make: *** [Makefile:144:check_webrtc_dependencies] 错误 127 make: *** 正在等待未完成的任务.... golangci-lint has version (devel) built with go1.20.7 from (unknown, mod sum: "") on (unknown) golangci-lint run \ --skip-dirs client/std \ --skip-dirs dep \ --skip-dirs bufio \ --skip-dirs logger/file-rotatelogs \ --skip-dirs build \ --skip-dirs release \ --exclude 'SA6002: argument should be pointer-like to avoid allocations' \ --exclude 'S1000: should use a simple channel send/receive instead ofselectwith a single case' client/api/server.go:56:12: s.Serve undefined (type *Server has no field or method Serve) (typecheck) err := s.Serve(s.Listener) ^ client/webrtc/datachannel.go:21:8: could not import C (cgo preprocessing failed) (typecheck) import "C" ^ client/webrtc/datachannel.go:77:11: undefined: pointer (typecheck) d, ok := pointer.Restore(userData).(*DataChannel) ^ client/webrtc/datachannel.go:90:11: undefined: pointer (typecheck) d, ok := pointer.Restore(userData).(*DataChannel) ^ client/webrtc/datachannel.go:106:11: undefined: pointer (typecheck) d, ok := pointer.Restore(userData).(*DataChannel) ^ logger/logger.go:144:6: l.Error undefined (type *Logger has no field or method Error) (typecheck) l.Error().Err(err).Msg("failed to close sentry") ^ logger/logger.go:150:6: l.Error undefined (type *Logger has no field or method Error) (typecheck) l.Error().Err(err).Msg("failed to sync log file") ^ logger/logger.go:154:6: l.Error undefined (type *Logger has no field or method Error) (typecheck) l.Error().Err(err).Msg("failed to close log file") ^ server/api/server.go:153:27: s.Addr undefined (type *Server has no field or method Addr) (typecheck) "-local", "http://" + s.Addr, ^ client/client.go:415:5: t.SendForceCloseSignal undefined (type *conn has no field or method SendForceCloseSignal) (typecheck) t.SendForceCloseSignal() ^ client/client.go:439:5: t.SendCloseSignal undefined (type *conn has no field or method SendCloseSignal) (typecheck) t.SendCloseSignal() ^ client/client.go:467:9: result.Logger undefined (type *conn has no field or method Logger) (typecheck) result.Logger = c.Logger.With().Uint("connID", connID).Logger() ^ client/client.go:783:14: t.Write undefined (type *conn has no field or method Write) (typecheck) _, err = t.Write(buf[:n+i]) ^ client/client.go:787:5: t.Logger undefined (type *conn has no field or method Logger) (typecheck) t.Logger.Info().Msg("sent reload info") ^ client/conn.go:63:13: c.Conn undefined (type *conn has no field or method Conn) (typecheck) _, err = c.Conn.Write(buf[:bufIndex+n]) ^ client/conn.go:139:5: c.Logger undefined (type *conn has no field or method Logger) (typecheck) c.Logger.Debug().Err(err).Msg("failed to send ping signal") ^ client/conn.go:145:8: c.Closing undefined (type *conn has no field or method Closing) (typecheck) if !c.Closing.CompareAndSwap(0, 1) { ^ client/conn.go:171:5: c.Logger undefined (type *conn has no field or method Logger) (typecheck) c.Logger.Info().Err(err).Bool("isClosing", isClosing).Uint64("finishedTasks", c.finishedTasks.Load()). ^ client/conn.go:174:20: c.Reader undefined (type *conn has no field or method Reader) (typecheck) pool.PutReader(c.Reader) ^ client/conn.go:178:15: c.Reader undefined (type *conn has no field or method Reader) (typecheck) r.Reader = c.Reader ^ client/conn.go:188:12: c.Conn undefined (type *conn has no field or method Conn) (typecheck) err = c.Conn.SetReadDeadline(time.Now().Add(timeout)) ^ client/conn.go:194:22: c.Reader undefined (type *conn has no field or method Reader) (typecheck) peekBytes, err = c.Reader.Peek(4) ^ client/conn.go:198:7: c.Logger undefined (type *conn has no field or method Logger) (typecheck) c.Logger.Info().Bool("isClosing", isClosing).Uint64("finishedTasks", c.finishedTasks.Load()). ^ client/conn.go:222:8: c.SendCloseSignal undefined (type *conn has no field or method SendCloseSignal) (typecheck) c.SendCloseSignal() ^ client/peer.go:184:16: c.Write undefined (type *conn has no field or method Write) (typecheck) _, wErr = c.Write(buf[:6]) ^ client/peer.go:213:15: c.Write undefined (type *conn has no field or method Write) (typecheck) _, wErr = c.Write(buf[:l]) ^ client/peer.go:220:13: c.Conn undefined (type *conn has no field or method Conn) (typecheck) wErr = c.Conn.SetReadDeadline(dl) ^ client/task.go:246:13: c.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) count := c.TasksCount.Add(1) ^ client/task.go:255:16: c.Write undefined (type *conn has no field or method Write) (typecheck) _, wErr = c.Write(buf[:6]) ^ client/task.go:264:8: c.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) if c.TasksCount.Add(^uint32(0)) == 0 { ^ client/task.go:266:9: c.IsClosing undefined (type *conn has no field or method IsClosing) (typecheck) if c.IsClosing() { ^ client/task.go:267:7: c.SendForceCloseSignal undefined (type *conn has no field or method SendForceCloseSignal) (typecheck) c.SendForceCloseSignal() ^ server/server.go:64:16: undefined: turn (typecheck) turnServer *turn.Server ^ server/client.go:103:13: t.SendErrorSignalReachedMaxConnections undefined (type *conn has no field or method SendErrorSignalReachedMaxConnections) (typecheck) if e := t.SendErrorSignalReachedMaxConnections(); e != nil { ^ server/client.go:104:6: t.Logger undefined (type *conn has no field or method Logger) (typecheck) t.Logger.Error().Err(e).Msg("failed to SendErrorSignalReachedMaxConnections") ^ server/client.go:114:5: t.Logger undefined (type *conn has no field or method Logger) (typecheck) t.Logger.Info(). ^ server/client.go:119:11: tunnel.Logger undefined (type *conn has no field or method Logger) (typecheck) tunnel.Logger.Info(). ^ server/client.go:124:12: tunnel.Logger undefined (type *conn has no field or method Logger) (typecheck) tunnel.Logger.Info(). ^ server/client.go:133:14: t.SendErrorSignalDifferentConfigClientConnected undefined (type *conn has no field or method SendErrorSignalDifferentConfigClientConnected) (typecheck) if e := t.SendErrorSignalDifferentConfigClientConnected(); e != nil { ^ server/client.go:166:11: tunnel.Logger undefined (type *conn has no field or method Logger) (typecheck) tunnel.Logger.Info(). ^ server/client.go:179:11: tunnel.SendCloseSignal undefined (type *conn has no field or method SendCloseSignal) (typecheck) tunnel.SendCloseSignal() ^ server/client.go:269:9: conn.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) conn.TasksCount.Add(1) ^ server/client.go:275:14: t.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) count := t.TasksCount.Load() ^ server/client.go:278:9: conn.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) conn.TasksCount.Add(1) ^ server/client.go:287:8: conn.TasksCount undefined (type *conn has no field or method TasksCount) (typecheck) conn.TasksCount.Add(1) ^ server/client.go:296:6: t.SendForceCloseSignal undefined (type *conn has no field or method SendForceCloseSignal) (typecheck) t.SendForceCloseSignal() ^ server/client.go:297:6: t.Close undefined (type *conn has no field or method Close) (typecheck) t.Close() ^ server/client.go:308:5: t.Shutdown undefined (type *conn has no field or method Shutdown) (typecheck) t.Shutdown() ^ server/client.go:434:10: conn.Logger undefined (type *conn has no field or method Logger) (typecheck) conn.Logger.Error().Err(err).Msg("openSpecifiedTCPPort") ^ server/conn.go:67:5: nc.Logger undefined (type *conn has no field or method Logger) (typecheck) nc.Logger = s.Logger.With(). ^ make: *** [Makefile:74:golangci-lint] 错误 1

mmabluesky commented 1 year ago

我这边linux编译ok了 ,这里记录几点

  1. 如果是ubuntu的话,系统版本需小于或等于20.04 ,高于20.04的话在webrtc配置环境过程中, ./install-build-deps.sh会失败

  2. gt的Makefile需要改动下,忽略一些警告 `@@ -78,8 +78,13 @@ golangci-lint: --skip-dirs logger/file-rotatelogs \ --skip-dirs build \ --skip-dirs release \

    • --skip-files test/integrate_test.go \ --exclude 'SA6002: argument should be pointer-like to avoid allocations' \
    • --exclude 'S1000: should use a simple channel send/receive instead of select with a single case'
    • --exclude 'S1000: should use a simple channel send/receive instead of select with a single case' \
    • --exclude 'S1000: should use for range instead of for { select {} }' \
    • --exclude 'unused' \
    • --exclude 'copylocks' \
    • --exclude 'ineffassign'`
  3. 编译过程中需要安装的工具有:gofumpt golangci-lint Depot Tools ninja