zubairhamed / canopus

CoAP Client/Server implementing RFC 7252 for the Go Language
Apache License 2.0
155 stars 41 forks source link

Can't run examples #97

Open bsmelo opened 6 years ago

bsmelo commented 6 years ago

Hello,

First of all, I'm very new to go, so maybe that is my actual problem... But I can't get the examples to run. The closer I got was by following the steps below:

 $ export GOPATH=/home/bruno/Dropbox/coap-apps/go
 $ cd /home/bruno/Dropbox/coap-apps/go/src/
 $ git clone https://github.com/zubairhamed/canopus zubairhamed/canopus
 $ ls
dustin  ibm-security-innovation  zubairhamed
 $ cd zubairhamed/canopus
 $ git submodule update --init --recursive
 $ cd openssl
 $ ./config && make
 $ /usr/lib/go-1.10/bin/go run examples/simple/server.go
# github.com/zubairhamed/canopus
In file included from _cgo_export.c:3:0:
./dtls.go: In function ‘init_session_bio_method’:
./dtls.go:63:43: warning: passing argument 2 of ‘BIO_meth_set_write’ from incompatible pointer type
  BIO_meth_set_write(go_session_bio_method,write_wrapper);
(...)
cgo-gcc-prolog: In function ‘_cgo_81a35f110302_Cfunc_DTLSv1_2_server_method’:
cgo-gcc-prolog:195:2: warning: ‘DTLSv1_2_server_method’ is deprecated (declared at ./openssl/include/openssl/ssl.h:1642) [-Wdeprecated-declarations]
cgo-gcc-prolog: At top level:
cc1: warning: unrecognized command line option "-Wno-incompatible-pointer-types"
/tmp/go-build995684464/b001/exe/server: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
exit status 127

So I've tried the following, but still with no success:

 $ export LD_LIBRARY_PATH=./openssl/                                                 
 $ /usr/lib/go-1.10/bin/go get github.com/zubairhamed/canopus
# github.com/zubairhamed/canopus
In file included from _cgo_export.c:3:0:
./dtls.go: In function ‘init_session_bio_method’:
./dtls.go:63:43: warning: passing argument 2 of ‘BIO_meth_set_write’ from incompatible pointer type
  BIO_meth_set_write(go_session_bio_method,write_wrapper);
(...)
cgo-gcc-prolog: In function ‘_cgo_81a35f110302_Cfunc_DTLSv1_2_server_method’:
cgo-gcc-prolog:195:2: warning: ‘DTLSv1_2_server_method’ is deprecated (declared at ./openssl/include/openssl/ssl.h:1642) [-Wdeprecated-declarations]
cgo-gcc-prolog: At top level:
cc1: warning: unrecognized command line option "-Wno-incompatible-pointer-types"

What should I do? By the way, I don't even want to run the DTLS-enabled examples, just the plain CoAP ones will do...

Thanks! Bruno Melo.

bsmelo commented 6 years ago

BTW, my go installation details:

 $ /usr/lib/go-1.10/bin/go version                           
go version go1.10 linux/amd64
 $ /usr/lib/go-1.10/bin/go env    
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bruno/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bruno/Dropbox/coap-apps/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build300198286=/tmp/go-build -gno-record-gcc-switches"
bsmelo commented 6 years ago

Well, as I said, the problem was indeed my inexperience with go...:

 $ /usr/lib/go-1.10/bin/go install
 $ /usr/lib/go-1.10/bin/go run examples/simple/server.go     
2018/03/21 15:13:33 Started CoAP Server  [::]:5683

Maybe we should add these detailed steps to the README file? LD_LIBRARY_PATH came to me due to my experience with Linux, but it's not obvious, as well as the go install step. Should I make a PR for that file?

And thanks anyway! This looks like an amazingly complete implementation of CoAP and related RFCs. :)