Can you please post the output of go env. What cgo libraries does your project use?
On Monday, 2 January 2017 06:43:37 UTC+11, saurabh...@gmail.com wrote: > > The commands I am using are standard go build and go test. Anyway, here is > the complete output. > > SDeoras@D8R6G12 MINGW64 ~/x/sWin (master) > $ go build ./ > > > SDeoras@D8R6G12 MINGW64 ~/x/sWin (master) > $ which gcc > /c/program files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/ > gcc > > > SDeoras@D8R6G12 MINGW64 ~/x/sWin (master) > $ go test -v > # testmain > C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 > C:/program files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin > /../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/lib > /../lib/libntdll.a(dkbgs01971.o):(.idata$5+0x0): multiple definition of > `__imp_sqrt' > C:/program > files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(dekes01190.o):(.idata$5+0x0): > > first defined here > C:/program > files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libntdll.a(dkbgs01966.o):(.idata$5+0x0): > > multiple definition of `__imp_pow' > C:/program > files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(dekes01161.o):(.idata$5+0x0): > > first defined here > C:/program > files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: > > C:/program > files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(dkbgs01971.o): > > illegal symbol index 116 in relocs > collect2.exe: error: ld returned 1 exit status > > > FAIL _/C_/Users/SDeoras/x/sWin [build failed] > > > SDeoras@D8R6G12 MINGW64 ~/x/sWin (master) > $ > > > > On Wednesday, April 20, 2016 at 7:06:28 PM UTC-7, Dorival Pedroso wrote: >> >> Hi, >> >> I'm just wondering what is the cause of the following error (multiple >> definition of __something)? >> C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 >> C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libntdll.a(dyyls01966.o):(.idata$5+0x0): >> >> multiple definition of `__imp_pow' >> >> This only happens on Windows10 but on Ubuntu/Linux. >> >> The Go code makes a call to LAPACK via a C interface as follows: >> package main >> >> /* >> #cgo CFLAGS: -O3 >> #cgo linux LDFLAGS: -lm -llapack -lgfortran -lblas >> #cgo windows LDFLAGS: -lm -llapack -lgfortran -lblas -LC:/GoslDeps/lib >> >> #include <stdlib.h> >> >> void dgesvd_(const char* jobu, const char* jobvt, const int* M, const >> int* N, double* A, const int* lda, double* S, double* U, const int* ldu, >> double* VT, const int* ldvt, double* work,const int* lwork, const int* >> info); >> >> int lapack_svd(double *U, double *S, double *Vt, long m_long, double *A) { >> int m = (int)(m_long); >> int info = 0; >> char job = 'A'; >> int lwork = 10*m; >> double* work = (double*)malloc(lwork*sizeof(double)); >> dgesvd_(&job, // JOBU >> &job, // JOBVT >> &m, // M >> &m, // N >> A, // A >> &m, // LDA >> S, // S >> U, // U >> &m, // LDU >> Vt, // VT >> &m, // LDVT >> work, // WORK >> &lwork, // LWORK >> &info); // INFO >> free(work); >> return info; >> } >> */ >> import "C" >> >> import ( >> "fmt" >> "math" >> "unsafe" >> ) >> >> func main() { >> A := []float64{1, 2, 3, 2, -4, -9, 3, 6, -3} // col-major format >> m := int(math.Sqrt(float64(len(A)))) >> I := func(i, j int) int { return j*m + i } >> printmat(m, A, "A") >> U := make([]float64, len(A)) >> S := make([]float64, len(A)) >> Vt := make([]float64, len(A)) >> info := C.lapack_svd( >> (*C.double)(unsafe.Pointer(&U[0])), >> (*C.double)(unsafe.Pointer(&S[0])), >> (*C.double)(unsafe.Pointer(&Vt[0])), >> (C.long)(m), >> (*C.double)(unsafe.Pointer(&A[0])), >> ) >> fmt.Printf("SVD: info = %d\n", info) >> USVt := make([]float64, len(A)) >> for i := 0; i < m; i++ { >> for j := 0; j < m; j++ { >> for k := 0; k < m; k++ { >> USVt[I(i, j)] += U[I(i, k)] * S[k] * Vt[I(k, j)] >> } >> } >> } >> printmat(m, USVt, "U*S*Vt") >> } >> >> func printmat(m int, M []float64, msg string) { >> fmt.Printf("%s =\n", msg) >> for i := 0; i < m; i++ { >> for j := 0; j < m; j++ { >> fmt.Printf("%13.8f", M[j*m+i]) >> } >> fmt.Println() >> } >> } >> >> Any help is much appreciated. >> >> Cheers. >> Dorival >> > -- 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. For more options, visit https://groups.google.com/d/optout.