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

[not our bug] nixpkgs: Minio do not build on macOS with Go modules #10188

Closed
hauleth opened this issue Aug 3, 2020 · 10 comments
Closed

[not our bug] nixpkgs: Minio do not build on macOS with Go modules #10188

hauleth opened this issue Aug 3, 2020 · 10 comments

Comments

@hauleth
Copy link

hauleth commented Aug 3, 2020

Current Behavior

Fails to build with:

# github.com/shirou/gopsutil/host
vendor/github.com/shirou/gopsutil/host/host_darwin_cgo.go:9:11: fatal error: 'include/smc.c' file not found
 #include "include/smc.c"
          ^~~~~~~~~~~~~~~
1 error generated.

Possible Solution

Update Minio to use newest version of gopsutil to include this patch shirou/gopsutil#889

Steps to Reproduce (for bugs)

Try to build Minio on macOS with Nix.

Your Environment

  • Operating System and version (uname -a): Darwin 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64 i386 MacBookPro15,1 Darwin
@harshavardhana
Copy link
Member

github.com/shirou/gopsutil/host

vendor/github.com/shirou/gopsutil/host/host_darwin_cgo.go:9:11: fatal error: 'include/smc.c' file not found
#include "include/smc.c"
^~~~~~~~~~~~~~~
1 error generated.

We build without CGO @hauleth you should set

GO111MODULE=on CGO_ENABLED=0 go get -tags kqueue github.com/minio/minio

also why are you trying to build from source? isn't our release binary enough? https://dl.minio.io/server/minio/release/darwin-amd64/

@hauleth
Copy link
Author

hauleth commented Aug 3, 2020

@harshavardhana I am using Nix package manager that builds it for me.

@hauleth
Copy link
Author

hauleth commented Aug 3, 2020

With CGO_ENABLED=0 it fails on building notify:

github.com/rjeczalik/notify
# github.com/rjeczalik/notify
vendor/github.com/rjeczalik/notify/watcher_fsevents.go:49:11: undefined: stream
vendor/github.com/rjeczalik/notify/watcher_fsevents.go:200:13: undefined: newStream

@harshavardhana
Copy link
Member

github.com/rjeczalik/notify

github.com/rjeczalik/notify

vendor/github.com/rjeczalik/notify/watcher_fsevents.go:49:11: undefined: stream
vendor/github.com/rjeczalik/notify/watcher_fsevents.go:200:13: undefined: newStream

You missed passing -tags kqueue @hauleth

@harshavardhana
Copy link
Member

@harshavardhana I am using Nix package manager that builds it for me.

can this not package pre-existing binaries? - building binaries outside of our builds will not be supported by MinIO @hauleth because we sign our binaries and they are trusted.

@hauleth
Copy link
Author

hauleth commented Aug 3, 2020

@harshavardhana Nix requires reproducibility and I do not know if this is guaranteed. I am also using the version from the official repo at https://github.com/nixos/nixpkgs which seems to using building from source approach instead of fetching already compiled binaries (as with most of the other packages) to be able to make it point to proper external libraries when needed.

@harshavardhana
Copy link
Member

@harshavardhana Nix requires reproducibility and I do not know if this is guaranteed. I am also using the version from the official repo at https://github.com/nixos/nixpkgs which seems to using building from source approach instead of fetching already compiled binaries (as with most of the other packages) to be able to make it point to proper external libraries when needed.

That may be for other packages, but that is a guarantee we cannot provide our users. These binaries cannot be trusted by us and not verified by us.

If necessary we can take the ownership here and provide supported builds.

@harshavardhana harshavardhana changed the title Minio do not build on macOS with Go modules [not our bug] Minio do not build on macOS with Go modules Aug 4, 2020
@harshavardhana harshavardhana changed the title [not our bug] Minio do not build on macOS with Go modules [not our bug] nixpkgs: Minio do not build on macOS with Go modules Aug 4, 2020
@harshavardhana
Copy link
Member

@harshavardhana Nix requires reproducibility and I do not know if this is guaranteed. I am also using the version from the official repo at https://github.com/nixos/nixpkgs which seems to using building from source approach instead of fetching already compiled binaries (as with most of the other packages) to be able to make it point to proper external libraries when needed.

@hauleth why would you not use brew install - Nix packages are meant for Linux and the Nix package manager might not support macOS properly. Why not stick to most common way to install things on macOS? is there a specific requirement that you wish to use Nix package manager?

@hauleth
Copy link
Author

hauleth commented Aug 4, 2020

Because HomeBrew is an abomination of package manager. Being popular doesn't mean that it is a good solution. Nix gives me features that HomeBrew cannot and will not support (for example nix-shell, easily supporting different versions of applications, environment isolation, reproducible builds or declarative management of whole system).

I can, and I have, written quick derivation to use precompiled binary, however I would still like to find a solution to this problem for the future.

@harshavardhana
Copy link
Member

Because HomeBrew is an abomination of package manager. Being popular doesn't mean that it is a good solution. Nix gives me features that HomeBrew cannot and will not support (for example nix-shell, easily supporting different versions of applications, environment isolation, reproducible builds or declarative management of whole system).

That is quite a loaded opinion @hauleth - I don't think we have an interest in supporting source compiled packages which we cannot certify for our users.

I can, and I have, written quick derivation to use precompiled binary, however I would still like to find a solution to this problem for the future.

The problem is simple use go build tags with --tags kqueue - that is how we release our binaries anyways.

AndersonTorres pushed a commit to NixOS/nixpkgs that referenced this issue Sep 25, 2020
Modified build command and flags to allow successful build on Darwin
systems. Based on flags in GitHub issue from minio project [0]

[0]: minio/minio#10188 (comment)
LnL7 pushed a commit to LnL7/nixpkgs that referenced this issue Sep 27, 2020
Modified build command and flags to allow successful build on Darwin
systems. Based on flags in GitHub issue from minio project [0]

[0]: minio/minio#10188 (comment)

(cherry picked from commit 5e1cb57)
jonringer pushed a commit to NixOS/nixpkgs that referenced this issue Sep 27, 2020
Modified build command and flags to allow successful build on Darwin
systems. Based on flags in GitHub issue from minio project [0]

[0]: minio/minio#10188 (comment)

(cherry picked from commit 5e1cb57)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants