-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fork rakyll/magicmime to add openbsd support and perhaps support cross compilation. #76
Comments
Can't reproduce here on NixOS... |
That is nice, but labeling it as can't reproduce would not be a true reflection on the state of the issue at hand. The encountered bug is well documented numerous times on github, and is most notably referenced in issues in the golang repository. https://github.com/golang/go/ssues/24068 Where it is stated the issue reported originated from a Nixos system. So, you might familiarize yourself with it, in the event it impacts future work. |
FYI I do try to cross compile this package via Nix or via pure GNU-Make and I fail... See #72 |
After looking at the code, the suggested solution to the referenced issue, and the source code for magicmime, it is most likely an issue with magicmime. Magicmime does not begin its main go script with |
If instead of loading magicmime as a dependency, you just included it in your source code for the script as a part of your package. Would that make any difference? I.E. Hard code the library in. |
Thanks for the investigation :) It might help me a lot with #72, because I do encounter the error:
as well when I play with |
You are correct about the project looking abandoned, which leads me more towards believing magicmime being the cause to the issue I am experiencing. |
Can you supply the output of Running the following was successful for me with golang 1.17.2
|
On my machine:
Now this is added to the README. |
Thanks for the report and the investigation! |
I discovered this as well when doing my preliminary research, but since Here are the CGO relevant variables: GCCGO="gccgo"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2" And, my entire GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/USER/go/bin/bin"
GOCACHE="/home/USER/.cache/go-build"
GOENV="/home/USER/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="openbsd"
GOINSECURE=""
GOMODCACHE="/home/USER/go/bin/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="openbsd"
GOPATH="/home/USER/go/bin"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/openbsd_amd64"
GOVCS=""
GOVERSION="go1.17.3"
GCCGO="gccgo"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1" #<--- Here
GOMOD="/dev/null"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1703268905=/tmp/go-build -gno-record-gcc-switches" Furthermore, executing |
Magicmime depends on libmagic. Do you have that installed on what looks to be an openbsd system? |
Yes, it is installed. I believe the issue is caused by magicmime not possessing a main function, which would allow, or at least make it easier, for pistol to call the library. |
Pistol compiles successfully on other platforms with magicmime, so the lack of a |
Your response does not follow historically documented precedence with the generation of the returned error. In the referenced issue at this beginning of this thread, you will find that this error historically appeared on Nixos first, and one of the suggested resolutions was to ensure the main file in a library used https://github.com/golang/go/ssues/24068 Since the error has been generating on other operating systems, and there is nothing that would distinguish running magicmime on OpenBSD from running it on linux. I fail to see how this could be the case. Have you tried to install pistol on OpenBSD? |
github.com/rakyll/magicmime has build constraints that only allow it to build on darwin, freebsd and linux: https://github.com/rakyll/magicmime/blob/master/magicmime.go#L15 If you're not building on one of those platforms, you'll get the "build constraints exclude all Go files" error since there are no Go files that can be compiled or built for that platform. Someone could try adding |
@4a6f656c Dude, you are so awesome. It took some finagling, but that appears to have done the trick. Thanks for answering the call for help. Greatly appreciate it. No lie, I had tried this earlier, but made serious mistakes in procedural application. I had to wipe rakyll/magicmime and an earlier version my anoduck/magicmime off my system to prevent referencing it, then I had to modify all references to it in my clone of pistol. Finally, I had to cut a release of magicmime in github, generate the checksums for the go.sum file, and install magicmime and pistol with To say the least, this has been a learning experience for me, and will benefit my career later on in the future. I am very thankful to @doronbehar and @4a6f656c for the patience, knowledge, understanding, and kindness. Thanks a lot guys! |
Thanks a lot for participating @4a6f656c, that's greatly appreciated. I'll keep this issue open because we should probably fork magicmime in order to at least add to it the |
I merged several pre-existing forks of magicmime which possessed recent updates and appeared to have a sustained history of maintenance into my fork, and added the OpenBSD build constraints as well. I also modified the pistol source code to pull from this fork, but I have not set up my pistol repository for creation of pull requests. Cheers. |
Thanks for all your help and work. I will remove my repository for magicmime, clone your fork, and pull all the changes to pistol. Thanks again, and all the best. |
In case anyone is still getting issues with the linking, the problem might be due to custom linker flags in your cgo variables. Try using |
Note also that now, thanks to Nix' wonderful cross compilation support, pistol's releases include assets of cross compiled packages for 3 common architectures. These may be of use to some of you. |
When I attempted to install pistol, which I am totally stoked about, I received an error concerning build constraints. Never seen this one before, and I suspect it is an unintended error.
To me at least, it seems odd that all Go files are excluded. Any suggestions would be nice... this is a weird one.
The text was updated successfully, but these errors were encountered: