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

build error when make build-linux #384

Closed
biffyx opened this issue Jan 22, 2021 · 11 comments
Closed

build error when make build-linux #384

biffyx opened this issue Jan 22, 2021 · 11 comments
Labels
bug Something isn't working
Milestone

Comments

@biffyx
Copy link

biffyx commented Jan 22, 2021

i got error when make build-linux
os version: mackOS Big Sur 11.1
error message bellow

# github.com/CosmWasm/wasmvm/api
/users/test/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mock_failure.go:15:27: undefined: GoAPI
/users/test/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mocks.go:77:2: undefined: GasMeter
/users/test/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mocks.go:78:20: undefined: Gas
make[1]: *** [build] Error 2
make: *** [build-linux] Error 2
@ethanfrey
Copy link
Member

What version of wasmd? v0.14.0?

Also, are you using the M1 silicon (arm64)?

@biffyx
Copy link
Author

biffyx commented Jan 22, 2021

What version of wasmd? v0.14.0?
the current version of master branch
Also, are you using the M1 silicon (arm64)?
not M1 just mackbookpro 2016

@ethanfrey
Copy link
Member

@alpe I know you have a mac. Can you reproduce?

@biffyx
Copy link
Author

biffyx commented Jan 22, 2021

@alpe I know you have a mac. Can you reproduce?

yes i can

@biffyx
Copy link
Author

biffyx commented Jan 22, 2021

my environment

OS: mackOS Big Sur 11.1
Go:go version go1.15.7 darwin/amd64

I only did the following

  1. clone code of master
    git clone https://github.com/CosmWasm/wasmd.git

  2. Normal make

make

i got some golangci-lint run error, it seems the code can't access lint check

golangci-lint run
app/app_test.go:86:6: `setGenesis` is unused (deadcode)
func setGenesis(gapp *WasmApp) error {
     ^
app/export.go:75:6: Error return value of `app.distrKeeper.WithdrawValidatorCommission` is not checked (errcheck)
		_, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator())
		   ^
app/export.go:91:6: Error return value of `app.distrKeeper.WithdrawDelegationRewards` is not checked (errcheck)
		_, _ = app.distrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr)
		   ^
app/app_test.go:78:23: Using the variable on range scope `tc` in function literal (scopelint)
			ProposalsEnabled = tc.proposalsEnabled
			                   ^
app/app_test.go:79:30: Using the variable on range scope `tc` in function literal (scopelint)
			EnableSpecificProposals = tc.specificEnabled
			                          ^
app/app_test.go:81:20: Using the variable on range scope `tc` in function literal (scopelint)
			assert.Equal(t, tc.expected, proposals)
			                ^
  1. make install

as step 2 can't work, i see the Makefile and find make install, so i do it, it's work well.

  1. cross compile for linux
    i just execute make build-linx, get the error bellow.
github.com/CosmWasm/wasmvm/api
/users/test/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mock_failure.go:15:27: undefined: GoAPI
/users/test/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mocks.go:77:2: undefined: GasMeter
/users/test/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mocks.go:78:20: undefined: Gas
make[1]: *** [build] Error 2
make: *** [build-linux] Error 2

@cyborgshead
Copy link

@biffyx try to use docker to build under macos, check this https://github.com/terra-project/core/blob/develop/Makefile#L82

@alpe
Copy link
Contributor

alpe commented Jan 25, 2021

@alpe I know you have a mac. Can you reproduce?

yes, I have the same error messages with make build-linux. I can look into it later this week.

@alpe alpe added the bug Something isn't working label Jan 25, 2021
@alpe alpe added this to the v0.15.0 milestone Jan 25, 2021
@alpe alpe assigned alpe and unassigned alpe Jan 25, 2021
@alpe alpe modified the milestones: v0.15.0, v0.16.0 Jan 29, 2021
@alpe
Copy link
Contributor

alpe commented Jan 29, 2021

I tried today to make it work with CGO_ENABLED=1 and cross compiler installed but failed. I think a better solution is to go with docker indeed.
Let's keep this issue open until a containerized solution is added or the build-linux target removed.

@Raumo0
Copy link

Raumo0 commented Mar 17, 2021

Same problem when I use CosmWasm dependency in my project and build with docker.

# github.com/CosmWasm/wasmvm/api
/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mock_failure.go:15:27: undefined: GoAPI
/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mocks.go:114:2: undefined: GasMeter
/go/pkg/mod/github.com/!cosm!wasm/[email protected]/api/mocks.go:115:20: undefined: Gas
The command '/bin/sh -c CGO_ENABLED=0 go build -o watcher ./cmd/watcher/main.go' returned a non-zero code: 2

Docker build with CGO_ENABLED=1 doesn't work either. When I build on linux, it works for me, but docker does not work and does not work on windows (gcc is a problem and tdm-gcc does not solve it).

@ethanfrey
Copy link
Member

@Raumo0 there is no support for Windows. This is a long-term issue and blocked by an upstream dependency: CosmWasm/wasmvm#28

Are you building this repo or a fork? What commit are you building?

Please provide the OS, CPU arch (i686 or arm64), repo/commit you are building and the exact commands you run.

I only have a Linux machine, but other devs use OSX and can verify there. No backend devs is using Windows or WSL so hard to debug there - you can compile CosmWasm contracts on Windows, but not run a node there.

@webmaster128
Copy link
Member

webmaster128 commented Apr 15, 2021

From searching the web it appears that combination cgo and cross-compilation seems to be immature at least.

Why do we even bother to provide cross-compilation as part of this repo's Makefile? Can't we ask users to run make build in a Linux docker container or Linux machine of their choice? I mean if cross compilation was possible, fine. But a dockerized solution is not cross-compilation but just a script collection that bascically says: cross compiletion not possible, please compile on Linux if you need a Linux build.

In the meantime the build-linux target was removed. There is only the .PHONY entry left.

ethanfrey added a commit that referenced this issue Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants