I made a issue at github, and the details are as followed: ### What version of Go are you using (`go version`)?
<pre> $ go version go version go1.16 gollvm LLVM 13.0.0git linux/amd64 </pre> ### Does this issue reproduce with the latest release? yes ### What operating system and processor architecture are you using (`go env`)? <details><summary><code>go env</code> Output</summary><br><pre> $ go env GO111MODULE="" GOARCH="amd64" GOBIN="/home/jx/workspace/gowork/bin" GOCACHE="/home/jx/.cache/go-build" GOENV="/home/jx/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/jx/workspace/gowork/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/jx/workspace/gowork" GOPRIVATE="" GOPROXY="https://goproxy.cn,direct" GOROOT="/home/jx/.local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/jx/.local/gollvm/tools" GOVCS="" GOVERSION="go1.16 gollvm LLVM 13.0.0git" GCCGO="/home/jx/.local/gollvm/bin/llvm-goc" AR="ar" CC="/home/jx/workspace/llvm_area/llvm-project/build/bin/clang" CXX="/home/jx/workspace/llvm_area/llvm-project/build/bin/clang++" CGO_ENABLED="1" GOMOD="/home/jx/workspace/batch_compile/awesome-go/picfit/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4288114194=/tmp/go-build -gno-record-gcc-switches -funwind-tables" </pre></details> ### What did you do? <!-- If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best. --> I attempted to compile mounts of go projects with gollvm, but some of them meet reference error to `reflect` or `pthread` Some cases are followed: 1. https://github.com/pantrif/s2-geojson This case meet `error: undefined reference to 'reflect.unsafe_New` while compiling ``` git clone https://github.com/pantrif/s2-geojson.git cd s2-geojson/cmd/s2-geojson go build . ``` `Go` mentioned above is just gollvm 2. https://github.com/thoas/picfit This case meet 'undefined reference to 'pthread_once' and many other functions start with `pthread_` ``` git clone https://github.com/thoas/picfit.git cd picfit/cmd/picfit go build . ``` ### What did you expect to see? Projects are compiled successfully as the original go compiler ### What did you see instead? For s2-geojson, I meet: ``` # github.com/pantrif/s2-geojson/cmd/s2-geojson /home/jx/.cache/go-build/6b/6bd003c99eb0a9e7c6ea6d372307b292ec615c75c28f9b1f696896ae2fb4272b-d(_go_.o):gomodule:function github_0com_1ugorji_1go_1codec.intf2impls.intf2impl: error: undefined reference to 'reflect.unsafe_New' /home/jx/.cache/go-build/6b/6bd003c99eb0a9e7c6ea6d372307b292ec615c75c28f9b1f696896ae2fb4272b-d(_go_.o):gomodule:function github_0com_1ugorji_1go_1codec.Decoder.interfaceExtConvertAndDecode: error: undefined reference to 'reflect.unsafe_New' decode.go:509: error: undefined reference to 'reflect.unsafe_New' decode.go:14935: error: undefined reference to 'reflect.unsafe_New' ``` For picfit, I meet: <details><summary><code>build details</code> Output</summary><br><pre> # github.com/thoas/picfit/cmd/picfit src/libavcodec/aacdec_template.c:1143: error: undefined reference to 'pthread_once' src/libavcodec/h264dec.c:400: error: undefined reference to 'pthread_once' src/libavcodec/pthread_frame.c:675: error: undefined reference to 'pthread_join' src/libavcodec/pthread_slice.c:116: error: undefined reference to 'pthread_join' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::Mutex::Mutex(): error: undefined reference to 'pthread_mutexattr_init' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::Mutex::Mutex(): error: undefined reference to 'pthread_mutexattr_settype' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::Mutex::Mutex(): error: undefined reference to 'pthread_mutexattr_destroy' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::Mutex::trylock(): error: undefined reference to 'pthread_mutex_trylock' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TlsAbstraction::TlsAbstraction(): error: undefined reference to 'pthread_key_create' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TlsAbstraction::~TlsAbstraction(): error: undefined reference to 'pthread_key_delete' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TlsAbstraction::GetData() const: error: undefined reference to 'pthread_getspecific' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TlsAbstraction::SetData(void*): error: undefined reference to 'pthread_setspecific' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TlsStorage::TlsStorage(): error: undefined reference to 'pthread_key_create' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TLSDataContainer::TLSDataContainer(): error: undefined reference to 'pthread_key_create' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TLSDataContainer::release(): error: undefined reference to 'pthread_key_create' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TLSDataContainer::getData() const: error: undefined reference to 'pthread_getspecific' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TLSDataContainer::getData() const: error: undefined reference to 'pthread_getspecific' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(system.cpp.o):system.cpp:function cv::TLSDataContainer::getData() const: error: undefined reference to 'pthread_setspecific' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(parallel_pthreads.cpp.o):parallel_pthreads.cpp:function cv::ForThread::~ForThread(): error: undefined reference to 'pthread_join' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(parallel_pthreads.cpp.o):parallel_pthreads.cpp:function cv::ForThread::stop(): error: undefined reference to 'pthread_join' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(parallel_pthreads.cpp.o):parallel_pthreads.cpp:function cv::ThreadManager::ThreadManager(): error: undefined reference to 'pthread_mutexattr_init' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(parallel_pthreads.cpp.o):parallel_pthreads.cpp:function cv::ThreadManager::ThreadManager(): error: undefined reference to 'pthread_mutexattr_settype' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(parallel_pthreads.cpp.o):parallel_pthreads.cpp:function cv::ThreadManager::ThreadManager(): error: undefined reference to 'pthread_mutexattr_destroy' /home/jx/workspace/batch_compile/awesome-go/picfit/vendor/github.com/discordapp/lilliput/deps/linux/lib/libopencv_core.a(parallel_pthreads.cpp.o):parallel_pthreads.cpp:function cv::ThreadManager::run(cv::Range const&, cv::ParallelLoopBody const&, double): error: undefined reference to 'pthread_mutex_trylock' /usr/lib/gcc/x86_64-linux-gnu/8/libgcc.a(generic-morestack-thread.o):function stack_split_initialize_thread: error: undefined reference to 'pthread_setspecific' /usr/lib/gcc/x86_64-linux-gnu/8/libgcc.a(generic-morestack-thread.o):function __wrap_pthread_create: error: undefined reference to 'pthread_once' </pre></details> Is this a inherent defect for gollvm? Or what can I do to avoid the problem? Thank you -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/661fb453-1181-4469-a63e-6e942562c378n%40googlegroups.com.