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

osx fixes for go 1.11 #11

Merged
merged 2 commits into from
Oct 11, 2018
Merged

osx fixes for go 1.11 #11

merged 2 commits into from
Oct 11, 2018

Conversation

kolyshkin
Copy link
Contributor

This is a 3-in-1 story. Please have a seat.

Part 1.

Go 1.11 release notes say:

Go 1.11 now requires <...> macOS 10.10 Yosemite or later

So, change the OSX_VERSION_MIN in osxcross to 10.10.

Part 2.

MACOSX SDK tarball that was used before comes without libc++
headers, which are now required by at least crypto/x509 pkg
when compiling for Darwin. These include files are part of xcode,
which can only be downloaded by someone having Apple Developer ID,
which I don't have so this path is not available for me.

An alternative is to reuse the SDK tarball from the
https://github.com/multiarch/crossbuild project. Using it
fixes the following error:

# crypto/x509
osxcross: error: cannot find libc++ headers

Part 3.

The new tarball, although, misses the libtool package (apparently
somehow injected into the tarball that was used earlier) needed to
compile miekg/pkcs11 used by cli, which leads to errors like:

# github.com/docker/cli/vendor/github.com/miekg/pkcs11
vendor/github.com/miekg/pkcs11/pkcs11.go:28:10: fatal error: 'ltdl.h' file not found
#include <ltdl.h>
          ^
1 error generated.

To fix this one, libtool for osx need to be installed. Building it from
source (with osxcross) requires some other dependencies. Using brew is not
possible since it is Linux. Solution: download a binary package from brew
repo, cherry pick the needed stuff (lib and include).

Tested to fix docker-cli compilation issues on OSX using Go 1.11.

Copy link
Contributor

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐸

@kolyshkin
Copy link
Contributor Author

@vdemeester @thaJeztah PTAL

@thaJeztah
Copy link
Member

These include files are part of xcode, which can only be downloaded by someone having Apple Developer ID, which I don't have so this path is not available for me.

@kolyshkin I do have a Mac developer subscription; would it be cleaner to update the package we have at dockerproject.org?

osx-cross.sh Outdated Show resolved Hide resolved
@kolyshkin
Copy link
Contributor Author

I do have a Mac developer subscription; would it be cleaner to update the package we have at dockerproject.org?

I think we can reuse the one from this PR, it works fine and needs nothing.

It would be awesome though if you can upload it to s3.dockerproject.org. I tried to do it myself, logged in to aws successfully (using kir / docker-core credentials) but accessing S3 gives me "access denied".

@andrewhsu
Copy link

andrewhsu commented Oct 10, 2018

i'll put it up (working on getting the cache to play nice)

@andrewhsu
Copy link

$ curl -Is https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz | head -1
HTTP/2 200

Dockerfile Outdated Show resolved Hide resolved
This is a 3-in-1 story. Please have a seat.

1. As Go 1.11 release notes say,

> Go 1.11 now requires <...> macOS 10.10 Yosemite or later

So, change the OSX_VERSION_MIN in osxcross to 10.10.

2. MACOSX SDK tarball that was used before comes without libc++
headers, which are now required by at least crypto/x509 pkg
when compiling for Darwin. These include files are part of xcode,
which can only be downloaded by someone having Apple Developer ID,
which I don't have so this path is not available for me.

An alternative is to reuse the SDK tarball from the
https://github.com/multiarch/crossbuild project. Using it
fixes the following error:

> # crypto/x509
> osxcross: error: cannot find libc++ headers

3. The new tarball, although, misses the libtool package (apparently
somehow injected into the tarball that was used earlier) needed to
compile miekg/pkcs11 used by cli, which leads to errors like:

> # github.com/docker/cli/vendor/github.com/miekg/pkcs11
> vendor/github.com/miekg/pkcs11/pkcs11.go:28:10: fatal error: 'ltdl.h' file not found
> #include <ltdl.h>
>          ^
> 1 error generated.

To fix this one, libtool for osx need to be installed. Building it from
source (with osxcross) requires some other dependencies. Using brew is not
possible since it is Linux. Solution: download a binary package from brew
repo, cherry pick the needed stuff (lib and include).

Tested to fix docker-cli compilation issues on OSX.

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin
Copy link
Contributor Author

Updated:

  • move SDK tarball to dockerproject.org
  • remove update to go 1.11.0
  • add sha256 checksum validation for SDK tarball

Copy link

@andrewhsu andrewhsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kolyshkin kolyshkin changed the title Update to Go 1.11.1, osx fixes for 1.11 osx fixes for go 1.11 Oct 11, 2018
@kolyshkin
Copy link
Contributor Author

As per @thaJeztah suggestion I rolled back go version to 1.11.0.

The only problem with that is we already have a 1.11.0 tag in this repo. I am not sure how automatic docker image builds work... hope the tag can be just forcefully re-set to a new commit and it will trigger a rebuild. If not, we'll have to use a new tag, say something like 1.11.0-2, and use it, not a big deal either.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit 7e5e4c1 into docker:master Oct 11, 2018
tbg added a commit to tbg/cockroach that referenced this pull request Jan 15, 2019
Starting in Go 1.11, OSX 10.9 is no longer supported and building
using the `builder` (which uses osxcross internally) fails.

Updating this requires supplying an updated SDK and specifying the
new minimum version (10.10), though apparently there are some
complications regarding the SDK file to use. Luckily, I found that
others had already solved the [same problem] and we can reuse their
SDK archive.

[same problem]: docker/golang-cross#11 (comment)

Release note: None
craig bot pushed a commit to cockroachdb/cockroach that referenced this pull request Jan 15, 2019
34036: builder: target OSX 10.10+ r=petermattis a=tbg

Starting in Go 1.11, OSX 10.9 is no longer supported and building
using the `builder` (which uses osxcross internally) fails.

Updating this requires supplying an updated SDK and specifying the
new minimum version (10.10), though apparently there are some
complications regarding the SDK file to use. Luckily, I found that
others had already solved the [same problem] and we can reuse their
SDK archive.

[same problem]: docker/golang-cross#11 (comment)

Release note: None

Co-authored-by: Tobias Schottdorf <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants