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'
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() }}
$ go versiongo version go1.6.1 windows/amd64
Yep. I've installed go1.6.1.windows-amd64.msi
From https://git-scm.com/download/ download and install Git-2.8.1-64-bit.exe. Default options are fine.
From http://tdm-gcc.tdragon.net/download download and install tdm64-gcc-5.1.0-2.exe. Select gfortran and keep other default options.
From https://cmake.org/download/ download and install cmake-3.5.2-win32-x86
From https://golang.org/dl/ download go1.6.1.windows-amd64.msi. Default options are fine.
Set a new environment variable named GOPATH with the location where to store all go source code, including yours (e.g. C:\Users\MyName\\MyGo). Restart.
Get lapack-3.5.0.tgz from http://www.netlib.org/lapack/lapack-3.6.0.tgz and save it into C:\GoslDeps
Start Git Bash and type
cd /c/GoslDeps
tar xzvf lapack-3.6.0.tgz
mkdir build-lapack
Start CMake (cmake-gui) and select:
Where is the source code = C:/GoslDeps/lapack-3.6.0
Where to build the binaries = C:/GoslDeps/build-lapack
Hit [Configure]
Select MinGW Makefiles under Specify the generator for this project (leave Use default native compilers on). Hit [Finish]
Change CMAKE_INSTALL_PREFIX = C:/GoslDeps
Hit [Configure] again
Hit [Generate] (and close window)
Continue on Git Bash:
alias m='mingw32-make.exe'
cd build-lapack
m
go run main.go
I:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libntdll.a(dcxis01971.o):(.idata$5+0x0): multiple definition of `__imp_sqrt'I:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(deips01189.o):(.idata$5+0x0): first defined here
I'm experiencing the same thing after updating from Go 1.5.x to 1.6.x. CGO programs that used to build fine are now reporting about multiple definitions between libntdll and libmsvcrt.
I:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libntdll.a(dcxis01971.o):(.idata$5+0x0): multiple definition of `__imp_sqrt'I:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(deips01189.o):(.idata$5+0x0): first defined here
I'm experiencing the same thing after updating from Go 1.5.x to 1.6.x. CGO programs that used to build fine are now reporting about multiple definitions between libntdll and libmsvcrt.
I:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libntdll.a(dcxis01971.o):(.idata$5+0x0): multiple definition of `__imp_sqrt'I:/msys/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(deips01189.o):(.idata$5+0x0): first defined here
C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
c:/program files/mingw-w64/x86_64-4.8.1-posix-seh-rt_v3-rev2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/lib/../lib/libntdll.a(dmads01971.o):(.idata$5+0x0): multiple definition of `__imp_sqrt'
c:/program files/mingw-w64/x86_64-4.8.1-posix-seh-rt_v3-rev2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(dygcs01179.o):(.idata$5+0x0): first defined here
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/fW4KZQ05G_8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dorival Pedroso PhD +61 0420411142 www.cpmech.com Brisbane Australia
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
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)
$
$ go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\SDeor7119713\gocode
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\SDEOR7~1\AppData\Local\Temp\go-build176493662=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
// #cgo CFLAGS: -I${SRCDIR}/includes
// #cgo LDFLAGS: -Wl,-rpath,'$ORIGIN/lib/' -L${SRCDIR}/windows/amd64 -ls88 -lLogDump -lboost_system -lboost_date_time -lboost_thread -lboost_filesystem -lstdc++ -lm -lpthread
// #include <stdlib.h>
// #include <stdio.h>
// #include "s88.h"
import "C"