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

Support for linux on ARM #74

Closed
wolfeidau opened this issue Apr 23, 2014 · 22 comments
Closed

Support for linux on ARM #74

wolfeidau opened this issue Apr 23, 2014 · 22 comments

Comments

@wolfeidau
Copy link

Just interested to hear if anyone has tried this on an ARM device?

Was there any reasons why it wasn't cross compiled for ARM?

Thanks

@mitchellh
Copy link
Contributor

We can't cross-compile Consul because it relies on cgo. This means that we need an actual ARM device to build Consul on. I actually have some plans to use maybe a hosted Raspberry Pi service to build this, but not in the short term.

For the time being, I recommend building Consul yourself if ARM is your target platform.

@wolfeidau
Copy link
Author

Yeah I attempted cross compilation and noted that @davecheney had done some work in this area but I don't think cgo is fully supported yet?

Just a note, I have spun up a few Raspberry pi's running consul and they are working fine, as you say the main thing to note is the build current does need to be done on a pi, then pushed to the other devices.

Process was:

  1. Install build-essential
  2. Grab one of @davecheney's unofficial golang tar balls and install that
  3. Run the make

Overall it performs great and memory use is pretty stable.

Thanks

@armon
Copy link
Member

armon commented Apr 24, 2014

@wolfeidau Glad to hear it is working! Let me know if you find any issues on ARM.

@spro
Copy link

spro commented Jul 3, 2014

@wolfeidau Do you have an ARM-compiled version somewhere that I could download? I couldn't get it to build on my Raspberry Pi (process gets killed during go build github.com/miekg/dns)

@wolfeidau
Copy link
Author

Yeah memory use of the linker is a known issue I believe, hence it failing to build on your device.

I will upload a build you can test later as I have access to ARM systems with 2 gig of ram which we use as build agents.

Which version of golang are you using atm, out of interest? I think i built it with 1.2 a while ago.

@spro
Copy link

spro commented Jul 3, 2014

Awesome I appreciate it. I only tried with go1.3

@wolfeidau
Copy link
Author

I published a release to https://bintray.com/wolfeidau/consul/consul/0.3.0/view/files using slightly modified build scripts in the project.

Works on the systems I have, haven't tested on a pi yet though.

@spro
Copy link

spro commented Jul 3, 2014

Alas, a segfault. Here's what gdb had to say:

Program received signal SIGSEGV, Segmentation fault.
0x00056efc in github.com/hashicorp/consul/command/agent.(*HTTPServer).AgentMembers (s=0xbefffc84, resp=..., 
    req=0xbefffdad, ~r2=..., ~r3=...)
    at /home/markw/Code/go/src/github.com/hashicorp/consul/command/agent/agent_endpoint.go:36
36  /home/markw/Code/go/src/github.com/hashicorp/consul/command/agent/agent_endpoint.go: No such file or directory.
(gdb) 

@wolfeidau
Copy link
Author

Just uploaded a binary built with the GOARM=5 set to see if that overcomes the issue, 0.3.0_consul_linux_arm5.zip is the file containing that version.

@spro
Copy link

spro commented Jul 3, 2014

Getting a different segfault now:

Program received signal SIGSEGV, Segmentation fault.
_cgo_973fd8b85250_Cfunc_mdb_env_set_maxdbs (Cannot access memory at address 0x0
v=0x0)
    at /home/markw/Code/go/src/github.com/armon/gomdb/env.go:158
158 in /home/markw/Code/go/src/github.com/armon/gomdb/env.go

@wolfeidau
Copy link
Author

OK I dug up my Raspberry pi and managed to build a working binary using golang 1.2. Need to chase up @davecheney on how to best solve the cross compile issue.

This version is packaged as 0.3.0_consul_linux_armpi.zip.

@spro
Copy link

spro commented Jul 3, 2014

Works like a charm, thank you! And I'll throw in my vote for having @davecheney figure out how to streamline this :)

@wolfeidau
Copy link
Author

👍

@davecheney
Copy link

Hi,

I'm not sure if it helps but I built go1.3 tarballs for all Arm arches a
few days ago.

I'm still not sure what the underlying issue(s) are that this bug report is
tracking, but if someone has the patience to explain them to me, I'll try
to help.
On 4 Jul 2014 11:06, "Mark Wolfe" notifications@github.com wrote:

[image: 👍]


Reply to this email directly or view it on GitHub
#74 (comment).

@jaromil
Copy link

jaromil commented Sep 1, 2015

Hi there. Regarding cross-compiling using qemu-static, please note there are bugs with it and pthreads running on multi-core machines. We have fixed those developing pinthread in Devuan https://git.devuan.org/packages-base/pinthread/blob/master/README.md

I'm just wondering if this may be useful also to streamline ARM builds of consul anywhere around here

@wolfeidau
Copy link
Author

You can do the builds of this on a cloud service now like https://www.scaleway.com/.

Fast cheap ARM based VPS on demand.

That is what I am using for builds using the distributions built by @davecheney.

@davecheney
Copy link

With Go 1.5, cross compilation requires no preparation of the local tool
chain, you can build for every architecture from any 1.5 install.

Hope this helps

Dave

On Wed, 2 Sep 2015 09:07 Mark Wolfe notifications@github.com wrote:

You can do the builds of this on a cloud service now like
https://www.scaleway.com/.

Fast cheap ARM based VPS on demand.

That is what I am using for builds using the distributions built by
@davecheney https://github.com/davecheney.


Reply to this email directly or view it on GitHub
#74 (comment).

@alexellis
Copy link

Is there any chance of an updated version for ARM? Or working build instructions? I'm trying to build in docker with armhf/ubuntu, build-essential and Dave Chenny's Go 1.5.x.

@highlyunavailable
Copy link
Contributor

@alexellis The whole underlying storage mechanism changed in Consul 0.6.0 (there's no more cgo, it's all memdb and written in Go now AFAIK) - you might want to open a new issue with the exact errors you are getting for further assistance.

@StefanScherer
Copy link

@alexellis Have you seen the download page https://www.consul.io/downloads.html with consul 0.6.3 for ARM as well.
For the old version 0.5.2 the Hypriot team once did a drone build on a Scaleway machine https://github.com/hypriot/rpi-consul/blob/drone-0.4.0/.drone.yml, but this seems outdated for 0.6.x

@alexellis
Copy link

@highlyunavailable @StefanScherer Hi again Stefan, after finding this thread and spending ages trying to build on ARM docker.. the binary comes as welcome news. We really need some official ARM images for things like Consul.

Ref: #125 (says no consul binary available on arm)

I'm trying to set up a multi-host docker 1.9.1 ARM cluster with swarm, so the documentation calls for Consul. Anyway this is what I've put together:

FROM armhf/ubuntu
RUN apt-get update && apt-get -qy install \
 wget unzip
WORKDIR /root/
RUN wget \
 https://releases.hashicorp.com/consul/0.6.3/consul_0.6.3_linux_arm.zip
RUN mkdir /data
RUN mkdir /ui
RUN unzip consul*.zip -d /usr/local/bin/

RUN consul version

EXPOSE 8300 8301 8301/udp 8302 8302/udp 8400 8500 53/udp

VOLUME ["/data"]
ADD ./config /config/

ENV DNS_RESOLVES consul
ENV DNS_PORT 8600

ENTRYPOINT ["/usr/local/bin/consul", "agent", "-config-dir=/config"]

agent.config

{
    "client_addr": "0.0.0.0",
    "bootstrap": true,
    "server": true,
    "data_dir": "/data",
    "leave_on_terminate": true,
    "dns_config": {
        "allow_stale": true,
        "max_stale": "1s"
    }
}

@slackpad
Copy link
Contributor

Sorry for any confusion. Just in case someone comes across this later, building Consul for ARM 0.6.0 and later should be a matter of following the build instructions in the readme. We cross-compile using gox so you can build this binary on a non-ARM host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants