I try to install sql-migrate in macos 11.1, Apple M1 chip. My go version is Go.1.16Beta1
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000000.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000001.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000002.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000003.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000004.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000005.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000006.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000007.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000008.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000009.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000010.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-669664703/000011.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
Undefined symbols for architecture arm64:
"__cgo_02b52858a06a_Cfunc__Cmalloc", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__Cmalloc in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_bind_blob", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_bind_blob in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_bind_text", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_bind_text in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_create_function", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_create_function in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_limit", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_limit in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_open_v2", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_open_v2 in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_prepare_v2_internal", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_prepare_v2_internal in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_result_blob", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_result_blob in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_result_text", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_result_text in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_step_internal", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_step_internal in go.o
"__cgo_02b52858a06a_Cfunc__sqlite3_step_row_internal", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc__sqlite3_step_row_internal in go.o
"__cgo_02b52858a06a_Cfunc_free", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_free in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_aggregate_context", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_aggregate_context in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_backup_finish", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_backup_finish in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_backup_init", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_backup_init in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_backup_pagecount", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_backup_pagecount in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_backup_remaining", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_backup_remaining in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_backup_step", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_backup_step in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_bind_double", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_bind_double in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_bind_int", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_bind_int in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_bind_int64", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_bind_int64 in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_bind_null", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_bind_null in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_bind_parameter_count", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_bind_parameter_count in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_bind_parameter_index", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_bind_parameter_index in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_busy_timeout", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_busy_timeout in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_clear_bindings", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_clear_bindings in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_close_v2", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_close_v2 in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_blob", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_blob in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_bytes", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_bytes in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_count", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_count in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_decltype", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_decltype in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_double", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_double in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_int64", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_int64 in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_name", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_name in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_text", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_text in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_column_type", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_column_type in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_commit_hook", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_commit_hook in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_create_collation", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_create_collation in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_db_filename", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_db_filename in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_enable_load_extension", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_enable_load_extension in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_errcode", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_errcode in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_errmsg", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_errmsg in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_errstr", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_errstr in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_exec", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_exec in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_extended_errcode", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_extended_errcode in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_finalize", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_finalize in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_get_autocommit", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_get_autocommit in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_interrupt", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_interrupt in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_load_extension", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_load_extension in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_reset", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_reset in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_result_double", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_result_double in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_result_error", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_result_error in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_result_int64", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_result_int64 in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_result_null", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_result_null in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_rollback_hook", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_rollback_hook in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_set_authorizer", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_set_authorizer in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_threadsafe", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_threadsafe in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_update_hook", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_update_hook in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_user_data", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_user_data in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_value_blob", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_value_blob in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_value_bytes", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_value_bytes in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_value_double", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_value_double in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_value_int64", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_value_int64 in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_value_text", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_value_text in go.o
"__cgo_02b52858a06a_Cfunc_sqlite3_value_type", referenced from:
_github.com/mattn/go-sqlite3._cgo_02b52858a06a_Cfunc_sqlite3_value_type in go.o
"_authorizerTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_authorizerTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_authorizerTrampoline)
"_callbackTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_callbackTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_callbackTrampoline)
"_commitHookTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_commitHookTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_commitHookTrampoline)
"_compareTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_compareTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_compareTrampoline)
"_doneTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_doneTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_doneTrampoline)
"_rollbackHookTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_rollbackHookTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_rollbackHookTrampoline)
"_stepTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_stepTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_stepTrampoline)
"_updateHookTrampoline", referenced from:
_github.com/mattn/go-sqlite3._Cfpvar_fp_updateHookTrampoline in go.o
(maybe you meant: __cgoexp_02b52858a06a_updateHookTrampoline)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have also tried env GOOS=darwin CGO_ENABLED=1 GOARCH=arm64 go get -v github.com/rubenv/sql-migrate/sql-migrate , but it is not functional.
The blame seems to lie with go-sqlite3.
Can someone help me?
Have you tried compiling any other cgo code? Does that work fine?
Have you tried compiling any other cgo code? Does that work fine?
I am not that proficient in both c and go language, I don't know how to do it. But I download the go-sqlite3 and run go build -o abc, it produced a file named abc. Does it mean that go-sqlite3 succeed in compiling in darwin/arm64? So where the blame lies. I have opened an issue in sql-migrate, but they closed my issue.
What should I do then?
You can test with a simple program like:
package main
import "C"
import "fmt"
func main() {
fmt.Println(C.int(42))
}
What is the size of the abc archive you created? If it's very small, then you probably aren't compiling the cgo version, but just the non-cgo shims:
$ CGO_ENABLED=0 go build -o abc
$ ls -lh abc
-rw-r--r-- 1 martin martin 151K Jan 7 13:30 abc
$ CGO_ENABLED=1 go build -o abc
$ ls -lh abc
-rw-r--r-- 1 martin martin 3.0M Jan 7 13:30 abc
The error message:
attempting to link with file built for unknown-x86_64
Makes it sound like there's something wrong with the C compiler on your system – it tries to link against amd64(?) I don't really have experience on macOS systems, and certainly not on the new ARM systems.
abc created, and its size is 9.2Mgo build -v abc.go, it turned out:# command-line-arguments
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000002.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/go.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000003.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000004.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000006.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000008.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000005.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000007.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000009.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-link-672812621/000010.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)
Now the error is the other way:
building for macOS-x86_64 but attempting to link with file built for unknown-arm64
If I search for that error, I end up on e.g. the Go issue, and people are getting these kind of errors if they use Go 1.15 on the new ARM machines. Are you sure you're using Go 1.16? What does go version say? And go env as well, while we're at it.
go version outputs go version go1.16beta1 darwin/arm64
and go env outputs
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/harden/Library/Caches/go-build"
GOENV="/Users/harden/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/harden/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/harden/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.16beta1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/l7/srvfdj8j2rjd1khdn1qd3ydr0000gn/T/go-build2325360168=/tmp/go-build -gno-record-gcc-switches -fno-common"
How about plain C/C++ compilation?
For C (compile with clang):
#include <stdio.h>
int main() {
printf("Hello, C!\n");
return 0;
}
And C++ (compile with clang++):
#include <iostream>
int main() {
std::cout << "Hello, C++!" << std::endl;
return 0;
}
Does that work fine?
Yes, it works fine! the previous c code produced a.out of 48K size, and c++ code produced a.out of 55K size
Hmm. And so the toy cgo example arp242 posted above fails?
What if you force-rebuild everything with -a (and pass -x to see what it's actually doing...)? i.e. go build -a -x abc.go
(oh, and clang --version...)
clang --version prints
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: arm64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
go build -a -x abc.go prints lot of things, and finally succeed and produced a 2.1M size file
Right. Well, next step would be to try go get -u -v -a -x github.com/mattn/go-sqlite3 again, then.
yes, it works, but it doesn't produce go-sqlite3 executable file. And I also tried env CGO_ENABLED=1 go get -v -a -x github.com/rubenv/sql-migrate/sql-migrate and it also works and produced sql-migrate executable file.
Although I still have no sense of what happened. But I am really appreciated.
Ah, good to hear!
go-sqlite3 is a library, not a standalone program, so it won't produce a go-sqlite3 executable.
Not sure what happened: my guess is something broken in your build cache (so fixed by doing -a). Otherwise maybe something to do with how the go-sqlite3 dependency was pulled when trying to install sql-migrate directly? Anyway, glad it works now (I might be tempted to switch to the M1 at some point... ehehe ;) ).
(P.S. You should probably close the issue if your problem is resolved.)
Really appreciate your help, I will close it.
Most helpful comment
Really appreciate your help, I will close it.