Go-ethereum: Mac OS Build Failed - v1.8.17

Created on 18 Oct 2018  路  8Comments  路  Source: ethereum/go-ethereum

System information

Go Version: go1.11
OS & Version: macOS Mojave v10.14

Expected behaviour

"make all" build successfully.

Actual behaviour

Failed. Errors:

# github.com/ethereum/go-ethereum/vendor/github.com/rjeczalik/notify
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:10:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include
^~~~~~~
1 error generated.
github.com/ethereum/go-ethereum/vendor/gopkg.in/olebedev/go-duktape.v3
# github.com/ethereum/go-ethereum/vendor/github.com/elastic/gosigar
vendor/github.com/elastic/gosigar/sigar_darwin.go:6:10: fatal error: 'stdlib.h' file not found
#include
^
~~~
1 error generated.
# github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
In file included from vendor/github.com/karalabe/hid/hid_enabled.go:38:
./hidapi/mac/hid.c:25:10: fatal error: 'IOKit/hid/IOHIDManager.h' file not found
#include
^~~~~~
1 error generated.
# github.com/ethereum/go-ethereum/vendor/gopkg.in/olebedev/go-duktape.v3
In file included from vendor/gopkg.in/olebedev/go-duktape.v3/api.go:7:
In file included from ./duktape.h:174:
./duk_config.h:388:10: fatal error: 'TargetConditionals.h' file not found
#include
^~~~~~
1 error generated.
# github.com/ethereum/go-ethereum/crypto/secp256k1
In file included from crypto/secp256k1/secp256.go:17:
In file included from ././libsecp256k1/src/secp256k1.c:9:
crypto/secp256k1/libsecp256k1/src/util.h:14:10: fatal error: 'stdlib.h' file not found
#include
^~~~~~
1 error generated.
util.go:45: exit status 2
exit status 1
make: * [all] Error 1

Steps to reproduce the behaviour

In macOS, download geth v1.8.17 source code and run "make all".

Most helpful comment

Fixed. Seems like the some SDKs removed during system upgrade.
Workarounds:

  • Install latest Command Line Tools from Apple's download page
  • Install /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

My Xcode version: 10.1 (10B61)

Please refer:

All 8 comments

I think you're missing the C/C++ development headers for your installation. I don't use macos, so I don't know which package you need for that, but AFAIK it's either xcode, or perhaps a slimmed down version of it that only includes the minimum.

Hi

I think you must build/make first some library like secp256k1
ex. -> /crypto/secp256k1/libsecp256k1

I had the same issue and decided to build docker machine to handle the build:

FROM golang:alpine

# Install git (required by godeps)
RUN apk update && apk add --no-cache git curl openssh-client gcc g++ musl-dev

# Install godeps
WORKDIR /go/src

# Install dep
RUN go get -u github.com/golang/dep/cmd/dep

# Make sure we have the host key
RUN mkdir ~/.ssh
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts

# Update git to force github connection of SSH
RUN git config --global [email protected]:.insteadOf https://github.com/

# This is where your applications source code should be linked to via a volume.
RUN mkdir -p /go/src/app

Then I build my source code like this via makefile:

PACKAGE_NAME=github.com/<mypackagepath>
VERSION=latest

docker run --rm -v ${PWD}:/go/src/${PACKAGE_NAME} -w /go/src/${PACKAGE_NAME} -e CGO_ENABLED=1 -e GOOS=linux -e GOARCH=amd64 \
        <nameofyourbuilderimage> /bin/sh -c "dep ensure && go build -o app"

No C libraries required locally.

Anyway, generally if you have XCode, you're all set to build Geth locally. There might be a smaller subset that's enough, but I can't name it myself. AFAIK homebrew also installs XCode and that seems to work fine for everyone.

Seems like system upgrade makes such failures.
v1.8.16 build also fails, which was successful before system upgrade.

Fixed. Seems like the some SDKs removed during system upgrade.
Workarounds:

  • Install latest Command Line Tools from Apple's download page
  • Install /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

My Xcode version: 10.1 (10B61)

Please refer:

Fixed. Seems like the some SDKs removed during system upgrade.
Workarounds:

  • Install latest Command Line Tools from Apple's download page
  • Install /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

My Xcode version: 10.1 (10B61)

Please refer:

Just upgraded to Mojave today, this fixed it for me too. Thanks!

Fixed. Seems like the some SDKs removed during system upgrade.
Workarounds:

  • Install latest Command Line Tools from Apple's download page
  • Install /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

My Xcode version: 10.1 (10B61)

Please refer:

in 10.15 macOS_SDK_headers_for_macOS_xx.xx.pkg is gone, no such file there.

Was this page helpful?
0 / 5 - 0 ratings