kratos: Doesn't build on FreeBSD
Kratos (also affects Keto) does not build (gmake install) on FreeBSD:
GO111MODULE=on go install -tags sqlite .
# github.com/ory/dockertest/v3/docker/pkg/system
../../go/pkg/mod/github.com/ory/dockertest/v3@v3.6.5/docker/pkg/system/mknod.go:12:19: cannot use dev (type int) as type uint64 in argument to unix.Mknod
gmake: *** [Makefile:63: install] Error 2
Reproducing the bug
- Boot a FreeBSD.
pkg install go sqlite3 bash gmakeln -s /usr/local/bin/bash /bin/bash(this is hardcoded in theMakefile)- Clone Kratos
gmake install
Environment
- Git main: 11bdc4a815bd1e264d0ccbf42ca56f76e6ab1bbc
- go1.16.7
- FreeBSD 13.0-RELEASE
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (9 by maintainers)
Commits related to this issue
- Fix freebsd (#324) See https://github.com/ory/kratos/issues/1645 — committed to ory/dockertest by aeneasr 3 years ago
- fix: resolve freebsd build issue Closes #1645 — committed to ory/kratos by aeneasr 3 years ago
- fix: resolve freebsd build issue (#2004) Closes #1645 — committed to ory/kratos by aeneasr 3 years ago
- fix: resolve freebsd build issue (#2004) Closes #1645 — committed to senteca/kratos-fork by aeneasr 3 years ago
I overreacted (and am sorry for that) because I found the tone very rude and the points made are incorrect, clearly indicating that the poster has no idea how the software works. I have reverted the actions and am looking forward to useful and constructive ideas to resolve build issues on FreeBSD. Please be nice in open source projects, this project in particular is only maintained by me and I have little patience for trolls.
Regardless of the fact that this is some Docker module:
and it should be skipped for non-Linux in most cases the underlying C/OS call isn’t portable because the struct you are trying to read has either different types or members.
Definition of
dev_ton FreeBSD: https://github.com/freebsd/freebsd-src/blob/373ffc62c158e52cde86a5b934ab4a51307f9f2e/sys/sys/_types.h#L113:uint64_tDefiniton ofdev_ton Linux: https://elixir.bootlin.com/linux/latest/source/include/linux/types.h#L13:uint32_t. Well, this isn’t going to work.Here: https://github.com/ory/dockertest/blob/44efd604a6887f5f132e2f076307f3a1ddf471ff/docker/pkg/system/mknod.go#L11-L13
You like need to take the largest available type here. I don’t know how platform-specific code is done in Go, obviously not ifdefs. BUT since this is
dockertestit does not make any sense to port it since Docker a whole uses Linux-only features. It should be skipped in the build by OS detection.Note: I have never written Go, but ported many OSS to FreeBSD and HP-UX, found many non-portable pitfalls down the road.
Apology accepted, I hope you accept mine too 😃 My remarks were out of line and indeed unprofessional.
The bug is most likely resolvable via:
As stated before, due to the way we bootstrap tests for easy consumption, it is not possible nor desirable to strip Dockertest from the project.
And as with all open source project, collaboration is key! If this is a problem you encounter, you’re in the best position to fix it! Maintainers including myself are happy to help wherever possible
There are two ways to look at it: You are doing a good job, but we can make it better OR you are doing a shifty job, why can’t you do it right? I prefer to interpret @joh-ku’s comment explicitly as the former.
Personally for me as a developer I feel great when I know that my code runs on many platforms identically and makes millions happy. PS: I am biased because I do Maven releases and the above is true.
Reacting properly to harsh criticism is a virtue. Hard to achieve, granted.