Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golang compiler warnings for functions #15

Closed
jnovack opened this issue Oct 5, 2018 · 6 comments · May be fixed by #16
Closed

Golang compiler warnings for functions #15

jnovack opened this issue Oct 5, 2018 · 6 comments · May be fixed by #16

Comments

@jnovack
Copy link

jnovack commented Oct 5, 2018

dht.go.h:304: warning: implicit declaration of function 'sched_setscheduler' is
              invalid in C99 [-Wimplicit-function-declaration]
dht.go.h:317: warning: implicit declaration of function 'sched_setscheduler' is
              invalid in C99 [-Wimplicit-function-declaration]
@d2r2
Copy link
Owner

d2r2 commented Oct 6, 2018

It looks strange. Function sched_setscheduler doesn't declared locally and taken from outside public API (#include <sched.h> http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html). We have here many other functions taken from outside, like write, memset, etc., and they do not have such warning.

I will not accept this change until no explanation will be found on this strange warning.

@jnovack
Copy link
Author

jnovack commented Oct 6, 2018

I ran the following to produce the error.

$ go vet ./...

@d2r2
Copy link
Owner

d2r2 commented Oct 19, 2018

My go vet -v . produce no warning:

root@orangepizero:~/gocode/src/github.com/d2r2/go-dht# go vet -v .
github.com/d2r2/go-dht
# github.com/d2r2/go-dht
Checking file ./logger.go
Checking file $WORK/b001/_cgo_gotypes.go
Checking file $WORK/b001/dht.cgo1.go
Checking file $WORK/b001/_cgo_import.go
root@orangepizero:~/gocode/src/github.com/d2r2/go-dht# 

Could you run your go vet with -v option?
And give me extra output of uname -a - I just curious what platform you use.

@d2r2
Copy link
Owner

d2r2 commented Oct 19, 2018

BTW, one person send me errors he got when he is trying to compile directly on macOS Mojave platform:

$ 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]

As you can see there are some additional warnings with sched_setscheduler function.
That is why I am asking you to send me uname -a extra output.

@jnovack
Copy link
Author

jnovack commented Oct 19, 2018

I'm on Mojave as well. It makes sense that sched_setscheduler is not warning on linux.

@d2r2
Copy link
Owner

d2r2 commented Nov 5, 2018

Hi @jnovack! I have merged new feature, that should resolve issue with compilation on macOS. Could you find a time to get latest version of go-dht and try to compile it on macOS Mojave? Thanks!

@d2r2 d2r2 closed this as completed Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants