-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Consul doesn't build on SmartOS #159
Comments
This looks like MDB itself doesn't compile on smartos. Please report a bug upstream to see if they're interested in fixing this. Otherwise, we're looking into alternatives to MDB as well that we may merge in. Until then though, there is no simple way for Consul to fix this. Sorry! (And note: by MDB I mean the actual MDB source, not gomdb) |
I downloaded mdb from here: https://git.gitorious.org/mdb/mdb.git git clone https://git.gitorious.org/mdb/mdb.gitCloning into 'mdb'... cd mdb/libraries/liblmdbmakegcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast -fPIC -c mdb.c make testmkdir testdb |
Well that is interesting. /cc @armon Reopening. |
I don't know if this is helpful but I managed to compile github.com/armon/gomdb without errors using the following command after some digging: go build -x -compiler gccgoWORK=/tmp/go-build593558379 It seems that by default it was using a compiler called '6c' so I tried building with -ccflags '-I /usr/include' /usr/include/sys/ccompile.h:42 /usr/include/sys/feature_tests.h:30 /usr/include/sys/types.h:33 ../../armon/gomdb/mdb.c:38 unknown #: if It seems to be upset about this: I tried building everything with gccgo but that didn't work either. It seems some dependencies won't build with gccgo and some won't build with 6c (at least not with the parameters I've tried). I see that some libraries have been created by gccgo and some by 6c in $GOPATH/pkg but the build process doesn't seem to pay attention to any of these and tries to build everything every time I run it. |
I don't know if this helps, but when I iterate through each individual dependency (if go build; else go build -compiler gccgo -x), it appears that: gccgo successfully compiles: Neither gccgo nor 6c successfully compile: 6c compiles: |
I've tried ryanuber's branch, but i was unable to determine a difference between it and hashicorp. That said, my knowledge is quite rudimentary, and I apologize that I'm a poor witness to the issue. I think the issue stems from the inability of 6c to compile the github.com/armon/gomdb dependency. In retrospect, I believe the failures for consul/* were an artifact of my incomplete test methodology. If you'll note how I went wrong: function myinstall() {
if go install $1 1>/dev/null 2>&1
then
echo "SUCCESS-6c $1"
elif go install -compiler gccgo -x $1 1> /dev/null 2>&1
then
echo "SUCCESS-gccgo $1"
else
echo "FAIL neither $1"
fi
}
function iterate() {
echo "Iterating from $(pwd)"
for i in $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./... )
do
myinstall $i
done
}
[root@consuls1 ~/go/src/github.com/ryanuber/consul]# iterate
Iterating from /root/go/src/github.com/ryanuber/consul
SUCCESS-6c encoding/base64
SUCCESS-6c errors
SUCCESS-6c fmt
FAIL neither github.com/hashicorp/consul/command/agent
FAIL neither github.com/hashicorp/consul/consul
SUCCESS-6c github.com/hashicorp/consul/testutil
SUCCESS-6c github.com/hashicorp/serf/serf
SUCCESS-6c github.com/mitchellh/cli
SUCCESS-6c io
SUCCESS-6c io/ioutil
SUCCESS-6c math/rand
SUCCESS-6c net
SUCCESS-6c os
SUCCESS-6c strings
SUCCESS-6c sync/atomic
SUCCESS-6c testing
SUCCESS-6c time
SUCCESS-6c bytes
SUCCESS-6c encoding/base64
SUCCESS-6c encoding/json
SUCCESS-6c errors
SUCCESS-6c flag
SUCCESS-6c fmt
FAIL neither github.com/hashicorp/consul/consul
SUCCESS-6c github.com/hashicorp/consul/consul/structs
SUCCESS-6c github.com/hashicorp/consul/testutil
SUCCESS-6c github.com/hashicorp/logutils
SUCCESS-6c github.com/hashicorp/serf/serf
SUCCESS-6c github.com/miekg/dns
SUCCESS-6c github.com/mitchellh/cli
SUCCESS-6c io
SUCCESS-6c io/ioutil
SUCCESS-6c log
SUCCESS-6c net
SUCCESS-6c net/http
SUCCESS-6c net/http/httptest
SUCCESS-6c os
SUCCESS-6c path/filepath
SUCCESS-6c reflect
SUCCESS-6c strconv
SUCCESS-6c strings
SUCCESS-6c sync/atomic
SUCCESS-6c testing
SUCCESS-6c time
SUCCESS-6c bytes
SUCCESS-6c crypto/tls
SUCCESS-6c errors
SUCCESS-6c fmt
SUCCESS-gccgo github.com/armon/gomdb
SUCCESS-6c github.com/hashicorp/consul/consul/structs
SUCCESS-6c github.com/hashicorp/consul/testutil
SUCCESS-6c github.com/hashicorp/raft
SUCCESS-6c github.com/hashicorp/serf/serf
SUCCESS-6c github.com/ugorji/go/codec
SUCCESS-6c io/ioutil
SUCCESS-6c net
SUCCESS-6c net/rpc
SUCCESS-6c os
SUCCESS-6c reflect
SUCCESS-6c regexp
SUCCESS-6c sort
SUCCESS-6c strings
SUCCESS-6c testing
SUCCESS-6c time Because "go install/build" will use the same compiler for each dependency, the hashicorp fails are simply because the whole set will not compile with just 6c nor with just gccgo. |
I'm closing this issue since we cannot fix this until Go supports CGO on SmartOS upstream. |
As a sidenote: For a golang toolchain on Illumos/SmartOS with cgo wesolows has been doing some great work: Those repositories have cgo support patched in and work well so far. (I'm running consul on SmartOS) |
Awesome. Thanks for the update MerlinDMC! |
With the release of 2014Q4 Consul will now build on the base* boxes. |
Has anyone had any luck building Consul on recent SmartOS base images?
I'm writing an Ansible role to deploy/orchestrate Consul, and my primary development platform is SmartOS. When trying to build, as instructed in the README, the following errors are thrown:
|
Hi @cmacrae if you are building the latest master then there's no longer a CGO dependency, but it looks like there's no Solaris support for those terminal functions (see golang/go#13085, which links to several issues). I think at the current time you'd have to do some surgery on those dependencies in order to build on this platform. For the CLI dependency you could probably remove the |
Thanks @slackpad! Managed to get it to build with your tips 👍 I'll likely be doing automated builds, and host a zipped archive for the amd64 binary for Solaris (more specifically, illumos/SmartOS) systems on my personal domain: http://cmacr.ae/consul/solaris_amd64.zip EDIT: Chucked a quick page together for builds: http://cmacr.ae/consul/ |
@cmacrae thanks for this, very helpful. I would like to get Consul into pkgsrc. Is there anyone here who can help fasttrack the process? |
That'd be great! @jperkin would be the best person to talk to regarding On Sat, 5 Dec 2015 at 17:15, Charles Phillips notifications@github.com
|
I would also be interested by a package for smartos. |
No problem @benjamin-bergia :) |
Is it possible to get an official downloadable binary available on the Consul site for SmartOS before it gets added to pkgsrc? |
@dekobon I doubt it, SmartOS is not an officially supported platform for Consul |
@cmacrae I've spoken to my contact at Joyent, we may be able to get Consul in sooner than later. |
@doublerebel Awesome news! |
@cmacrae Who's your contact at Joyent? I'm also with Joyent. |
@doublerebel - sorry the previous comment was for you. |
@dekobon Oh excellent! Robby Andrews. Mentioned that some of you were interested in Consul inclusion, so he was right :) |
@doublerebel have you hung out on #consul on IRC yet? |
@Chewyrobbo no, just #smartos and #joyent. Just joined #consul now. Thanks! |
@cmacrae Can you share the patches, any way you're comfortable with? I'm with Joyent and working on pkgsrc. |
@mamash Sure :) Just on my way into the office at the moment, I'll share them once I'm in |
@mamash So, patches are necessary to both mitchellh/cli & hashicorp/consul. Here are the patch files, pretty much just stripping stuff out: |
@cmacrae looks like your patch to cli will not ask for input via stdin anymore if |
@MerlinDMC Thanks for pointing this out - these patches were chucked together quickly one evening after work, and I haven't had time to review them properly. Given the fact that this now seems to be moving toward to an official pkgsrc port at Joyent, I trust that those involved will address any issues posed by my hasty patching ;) |
https://gist.github.com/MerlinDMC/57d6043067e0bad8e2af I'm not happy with the |
@MerlinDMC thanks for this, I'm able to get hashicorp/vault almost built as well. Looking now at patching both vault and consul to use bgentry/speakeasy for cross-platform getpasswd support. |
I was able to get a crude pkgsrc package done with the above patches, but it still requires one of the patches applied manually. In order to land in pkgsrc though, I will need to break out all the 30+ Go dependencies into their separate packages, because pkgsrc doesn't like build-time source fetching and the embedded deps files would clash over PLIST entries with other Go packages as support for such grows in pkgsrc. |
@mamash that's a great start, thanks for the help. I'm also working on vault and consul-template, which have similar and related dependencies. Is there anything we can do about the projects' structure to make the builds simpler? When compiled, the end result is just one binary that needs one config file. |
Hey all - it looks like @jen20 got a CLI change merged yesterday that fixes the syscall issue: And the Docker client must have gotten fixed upstream: https://twitter.com/jen20/status/684450871606939648 I'll take this and add solaris to the list of built flavors. |
Thanks guys! I updated the pkgsrc definition for Consul, it will show up in the standard Joyent 2015Q4 build (soon). It lives here (WIP for now): https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=tree;f=consul;hb=HEAD |
been implemented with the respective upstreams, some mentioned in the original SmartOS support ticket: hashicorp/consul#159
Excellent, thanks @mamash! |
I tried building Consul on a SmartMachine in Joyent Public Cloud. This is my first time working with go software so please excuse me if I'm missing something that should be obvious.
SmartOS build joyent_20131120T074720Z
Image base64 14.1.0
go version devel +f8b50ad4cac4 Mon Apr 21 17:00:27 2014 -0700 + solaris/amd64
go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="solaris"
GOOS="solaris"
GOPATH="/root/go"
GORACE=""
GOROOT="/opt/local/go"
GOTOOLDIR="/opt/local/go/pkg/tool/solaris_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -fmessage-length=0"
CXX="g++"
CGO_ENABLED="0"
go get github.com/hashicorp/consul
github.com/armon/gomdb
github.com/armon/gomdb/mdb.c:39 6c: No such file or directory: sys/types.h
cd /root/go/src/github/hashicorp/consul
make
--> Installing build dependencies
--> Running go fmt
command/force_leave_test.go
command/agent/agent_endpoint_test.go
command/agent/catalog_endpoint_test.go
command/agent/dns_test.go
command/agent/health_endpoint_test.go
command/agent/kvs_endpoint_test.go
command/agent/local_test.go
command/agent/rpc_client_test.go
command/agent/status_endpoint_test.go
command/agent/ui_endpoint_test.go
consul/catalog_endpoint_test.go
consul/client_test.go
consul/health_endpoint_test.go
consul/internal_endpoint_test.go
consul/kvs_endpoint_test.go
consul/leader_test.go
consul/server_test.go
testutil/wait.go
--> Installing dependencies to speed up builds...
github.com/armon/gomdb
../../armon/gomdb/mdb.c:39 6c: No such file or directory: sys/types.h
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2
The sys/types.h file exists in /usr/include
ls -l /usr/include/sys/types.h
-rw-r--r-- 1 root bin 18137 Nov 20 10:08 /usr/include/sys/types.h
I tried modifying GOGCCFLAGS to include "-I/usr/include" but "go env" wouldn't recognize the environment variable or else it reset it :?
I change CGO_ENABLED to 1 and tried make again but got an error which baffles me:
export CGO_ENABLED=1
make
--> Installing build dependencies
--> Running go fmt
--> Installing dependencies to speed up builds...
runtime/cgo
Undefined first referenced
symbol in file
_cgo_sys_thread_start $WORK/runtime/cgo/_obj/gcc_util.o
ld: fatal: symbol referencing errors. No output written to $WORK/runtime/cgo/_obj/cgo.o
collect2: error: ld returned 1 exit status
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2
The text was updated successfully, but these errors were encountered: