mattermost / mattermost-plugin-starter-template

Build scripts and templates for writing Mattermost plugins.
https://developers.mattermost.com/extend/plugins/
Apache License 2.0
128 stars 120 forks source link

building for macOS-x86_64 but attempting to link with file built for unknown-arm64 #159

Closed shinsunyoung closed 1 year ago

shinsunyoung commented 2 years ago

Hello. Follow the README explanation and entered make. I expected a tar.gz file to be created.

However, the following error occurred and the file was not created.

ok      github.com/mattermost/mattermost-plugin-starter-template/build/sync/plan/git    (cached)
mkdir -p server/dist;
cd server && env GOOS=linux GOARCH=amd64 /usr/local/opt/go/libexec/bin/go build  -o dist/plugin-linux-amd64;
cd server && env GOOS=darwin GOARCH=amd64 /usr/local/opt/go/libexec/bin/go build  -o dist/plugin-darwin-amd64;
cd server && env GOOS=darwin GOARCH=arm64 /usr/local/opt/go/libexec/bin/go build  -o dist/plugin-darwin-arm64;
# github.com/mattermost/mattermost-plugin-starter-template/server
/usr/local/opt/go/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: ignoring file /var/folders/j4/khl3lxfs50l1szvwjqwpf6jr0000gn/T/go-link-750367649/go.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [server] Error 2
shinsunyoung commented 2 years ago

In my case, I deleted this code in Makefile and solved it.

    cd server && env GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -o dist/plugin-darwin-arm64;
hanzei commented 2 years ago

What mac book are you using?

shinsunyoung commented 2 years ago

Im using Big Sur 11.5.2

hanzei commented 2 years ago

Sorry for being ambiguous. What is the hardware you are using? Does it contain the new apple processor?

shinsunyoung commented 2 years ago

Im using MacBook Pro(15-inch, 2019) and my processor is Intel Core i7

hanzei commented 2 years ago

Is that an arm64 processor by any chance?

shinsunyoung commented 2 years ago

no, it's not.

hanzei commented 2 years ago

That is surprising given that the line you added builds for arm64: cd server && env GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -o dist/plugin-darwin-arm64;

hanzei commented 1 year ago

It should be fixed with https://github.com/mattermost/mattermost-plugin-starter-template/pull/155. Please reopen if you still run having built issues.