But I didn't write cgo code in my project. The weird part is I can build success with *GOOS=linux go build*, but failed with *GOOS=darwin go build*
On Friday, March 19, 2021 at 5:11:57 AM UTC+8 Ian Lance Taylor wrote: > On Thu, Mar 18, 2021 at 9:55 AM Max Xu <[email protected]> wrote: > > > > I'm running into a weird bug: > > > > Failed with command: > > GOOS=darwin go build > > > > Bug success with: > > GOOS=linux go build > > > > The failed Message: > > > > /usr/local/opt/go/libexec/pkg/tool/darwin_amd64/link: running clang > failed: exit status 1 > > duplicate symbol '_readdrivestat' in: > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000011.o > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000036.o > > duplicate symbol '_get_temperature' in: > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000014.o > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000039.o > > duplicate symbol '_open_smc' in: > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000014.o > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000039.o > > duplicate symbol '_close_smc' in: > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000014.o > > > /var/folders/tx/5c8vkq6x2k1f5nqvbj271qyc0000gn/T/go-link-162098608/000039.o > > ld: 4 duplicate symbols for architecture x86_64 > > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > Hard to say without seeing the code, but my first guess would be > erroneous cgo code. It looks like you have multiple cases of cgo code > that are defining the same symbol in the C preamble without declaring > it as `static`. > > Ian > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f9ac679f-09f5-44c1-826f-387b2adf2e7fn%40googlegroups.com.
