rake-compiler / rake-compiler-dock

Easy to use and reliable cross compiler environment for building Windows, Linux, Mac and JRuby binary gems.
MIT License
78 stars 30 forks source link

Error building windows gems on OS X #6

Closed jdantonio closed 8 years ago

jdantonio commented 9 years ago

Every time I try to build concurrent-ruby I have the same issue. Below are the full details.

I only use docker for building concurrent-ruby releases so I haven't done anything with my config since the last release. When I ran the build task I got this error:

Started.

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_TLS_VERIFY=1
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/Jerry/.boot2docker/certs/boot2docker-vm

Using above environment variables for starting rake-compiler-dock.

I set the requested environment variables and ran it again. Then I got this error:

rake-compiler-dock bash -c "      bundle --without=\"development testing\" &&\n      rake cross native gem RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2\n      rm -rf .bundle\n"

boot2docker is available, but not ready to use. Trying to start.
Virtual machine boot2docker-vm already exists
.oWriting /Users/Jerry/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/Jerry/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/Jerry/.boot2docker/certs/boot2docker-vm/key.pem
Waiting for VM and Docker daemon to start...

Started.
Your environment variables are already set correctly.

rake aborted!
RakeCompilerDock::DockerIsNotAvailable: Docker is not available
/Users/Jerry/.rvm/gems/ruby-2.2.3@concurrent-ruby/gems/rake-compiler-dock-0.4.3/lib/rake_compiler_dock/starter.rb:125:in `check_docker'
/Users/Jerry/.rvm/gems/ruby-2.2.3@concurrent-ruby/gems/rake-compiler-dock-0.4.3/lib/rake_compiler_dock/starter.rb:25:in `exec'
/Users/Jerry/.rvm/gems/ruby-2.2.3@concurrent-ruby/gems/rake-compiler-dock-0.4.3/lib/rake_compiler_dock/starter.rb:14:in `sh'
/Users/Jerry/.rvm/gems/ruby-2.2.3@concurrent-ruby/gems/rake-compiler-dock-0.4.3/lib/rake_compiler_dock.rb:29:in `sh'
/Users/Jerry/Projects/ruby-concurrency/concurrent-ruby/Rakefile:146:in `block (2 levels) in <top (required)>'
Tasks: TOP => build => build:windows
(See full trace by running task with --trace)
boot2docker is installed and started, but 'docker version' failed.

    Please check why 'docker version' fails.
    You might need to re-init with 'boot2docker delete'
    or have a look at the FAQs: http://git.io/vtDBH

I dug into the code and added puts @docker_version_text into DockerCheck and got this output:

Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): darwin/amd64
An error occurred trying to connect: Get https://192.168.59.103:2376/v1.19/version: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103

I tried both of the following environment exports but still no luck:

export DOCKER_HOST=tcp://127.0.0.1:2376
export DOCKER_HOST=tcp://10.0.2.15:2376

I then opened a new terminal and ran the following commands to cleanup docker:

boot2docker stop
boot2docker delete
boot2docker init
boot2docker start

I then tried the build task again (in the new terminal):

Waiting for VM and Docker daemon to start...
..........................oooooooooooooooooo
Started.
Writing /Users/Jerry/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/Jerry/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/Jerry/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.104:2376
    export DOCKER_CERT_PATH=/Users/Jerry/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

I set the requested environment variables and waited as boot2docker downloaded everything again. Once the download was complete the build tasks ran successfully.

Here is the info on my Mac:

image

larskanis commented 9 years ago

Thanks for the detailed bug report! This is almost certainly caused by a bug in boot2docker-1.7.0. It is fixed in the iso-image, that comes with 1.7.1: https://github.com/boot2docker/boot2docker/issues/938

Try boot2docker upgrade or similar.

As a side note: The manual setup of environment variables is usually not necessary, but automatically done by rake-compiler-dock for each call.

jdantonio commented 9 years ago

I upgraded all involved components (docker, boot2docker, and VirtualBox) and had the same issue. I again ran the stop/delete/init/start sequence and everything worked afterwards.

$ docker version
Client:
 Version:      1.8.2
 API version:  1.20
 Go version:   go1.5.1
 Git commit:   0a8c2e3
 Built:        Fri Sep 11 01:46:35 UTC 2015
 OS/Arch:      darwin/amd64
$ boot2docker version
Boot2Docker-cli version: v1.8.0
Git commit: 9a26066
larskanis commented 8 years ago

@jdantonio rake-compiler-dock has docker-machine support in the meantime, so maybe things changed a bit. Do you still facing issues, or can I close this?

jdantonio commented 8 years ago

We can close it for now. I will be releasing c-r 1.0.1 within the next couple of weeks. I'll upgrade to the latest versions of everything and see how it goes. If there are problems I'll let you know.