Open limoli opened 6 years ago
Hi @Limoli! Could you clarify what hardware and OS you use to download and compile package? Just it seems you have CLANG compiler installed only, but I test it with GCC compiler on Linux OS.
Additional assumption you need to install ld tool (GNU linker from "binutils" installation distributive). I will try to test compiling without GCC in virtual environment a little later.
Sorry for late response.
same issue on mac os mojave
$ go get -u github.com/d2r2/go-dht ld: library not found for -lrt clang: error: linker command failed with exit code 1 (use -v to see invocation) In file included from ../../d2r2/go-dht/dht.go:3: ../../d2r2/go-dht/dht.go.h:304:15: warning: implicit declaration of function 'sched_setscheduler' is invalid in C99 [-Wimplicit-function-declaration] ../../d2r2/go-dht/dht.go.h:317:15: warning: implicit declaration of function 'sched_setscheduler' is invalid in C99 [-Wimplicit-function-declaration]
Could you clarify, why you are trying to compile this library directly on MacOS? This library is intended to compile and use on embedded Linux devices, like Raspberry PI, Orange PI, Banana PI and so on.
Using go cross compilation for arm-6, linux. Idea was to deploy already executable item to raspberry pi.
Hi @darkowl91! Could you try again to get latest d2r2/go-dht and cross compile it? Just recently I have added a fix for macOS. P.S. I'm not sure that cross compilation will work from macOS, but lets try...
@d2r2 THe latest fix for macOS is not working . Just informing. As i am also gettgint he same error as @darkowl91
Hi @pradyuz3rocool! Could you attach here compilation output with error from macOS?
apple@iSteers-MacBook-Pro-Pradyu ~ $ go get -u github.com/d2r2/go-dht
# github.com/d2r2/go-dht
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
# github.com/d2r2/go-dht
In file included from go-workspace/src/github.com/d2r2/go-dht/dht.go:24:
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:428:10: warning: "Darwin doesn't have sched_setscheduler, so parameter boostPerfFlag is useless on Apple devices" [-W#warnings]
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:434:9: warning: implicit declaration of function 'set_default_priority' is invalid in C99 [-Wimplicit-function-declaration]
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:440:9: warning: implicit declaration of function 'set_default_priority' is invalid in C99 [-Wimplicit-function-declaration]
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:446:9: warning: implicit declaration of function 'set_default_priority' is invalid in C99 [-Wimplicit-function-declaration]
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:454:9: warning: implicit declaration of function 'set_default_priority' is invalid in C99 [-Wimplicit-function-declaration]
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:462:9: warning: implicit declaration of function 'set_default_priority' is invalid in C99 [-Wimplicit-function-declaration]
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:470:9: warning: implicit declaration of function 'set_default_priority' is invalid in C99 [-Wimplicit-function-declaration]
go-workspace/src/github.com/d2r2/go-dht/dht.go.h:475:9: warning: implicit declaration of function 'set_default_priority' is invalid in C99 [-Wimplicit-function-declaration]
@pradyuz3rocool, thank you for reporting that issue still present! Main problem is that unfortunately I have no macOS system in my hands. I do all my development on Arch Linux system either directly on Raspberry PI linux. So, in both cases everything works great, but I have no chance to build DHT library on macOS. I will try to get in my hands macOS, but I don’t promise to do it quickly :(
Until this problem is fixed, my advice is to compile directly on Raspberry PI device, or any corresponding clones.
Thanks @d2r2 I myself work on Arch, but i was trying the same implementation on macOS, i was facing this issue. But Would love to make it generic. I will also look into the fix in the mean while.
@pradyuz3rocool, I thought we have two concerns about macOS:
1) macOS has no sched_setscheduler()
function. So that's why I put calls of set_max_priority()
and set_default_priority()
in #ifdef block like:
#if !defined(__APPLE__)
...
#endif
But as I see, I forget to do this with bunch of set_default_priority()
calls - you can fix it.
2) I don't know what to do with error ld: library not found for -lrt
and since linux use gcc compiler (macOS - clang), you should try to find approach how to modify this in dht.go
:
// #include "dht.go.h"
// #cgo LDFLAGS: -lrt
to make it working on both systems.
Try and give me reply how it's going.
Sure 👍 will look into it
@pradyuz3rocool any luck with this ?
Was able to build on mac with the following settings
#export GOARM=6 GOARCH=arm GOOS=linux CGO_ENABLED=1
#env CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ \
# CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=6 \
@darkowl91, in this case compile line for mac OS will looks like:
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=6 go build ...
Is it correct?
yes
As documentation, I executed:
go get -u github.com/d2r2/go-dht