I am trying to cross-compile this code that relies on several libraries with dependencies on C/C++ static libraries. Compaling the project locally on linux works without issues but I wanted to cross-compile the same project from Linux to Windows amd64.
To do that, i installed MXE and used it as the C/C++ cross-compiler. Compilation seems to work without issues but, when linking, I get errors about symbols being redefined:
$ CGO_ENABLED=1 CC=x86_64-w64-mingw32.static-gcc CXX=x86_64-w64-mingw32.static-g++ GOOS=windows GOARCH=amd64 go build -x test.go
[... all packages are compiled without issues but, then ...]
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/command-line-arguments/_obj/exe/
cd /home/bga/development/go-dev/src
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/command-line-arguments.a -trimpath $WORK -p main -complete -buildid dec769d8ff9c511dd002d6ccad0f5224169c5685 -D _/home/bga/development/go-dev/src -I $WORK -I /home/bga/development/go-dev/pkg/windows_amd64 -pack ./test.go
cd .
/usr/local/go/pkg/tool/linux_amd64/link -o $WORK/command-line-arguments/_obj/exe/a.out.exe -L $WORK -L /home/bga/development/go-dev/pkg/windows_amd64 -extld=x86_64-w64-mingw32.static-g++ -buildmode=exe -buildid=dec769d8ff9c511dd002d6ccad0f5224169c5685 $WORK/command-line-arguments.a
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running x86_64-w64-mingw32.static-g++ failed: exit status 1
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetGR':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:81: multiple definition of `_Unwind_GetGR'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:81: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_SetGR':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:91: multiple definition of `_Unwind_SetGR'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:91: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetCFA':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:102: multiple definition of `_Unwind_GetCFA'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:102: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetIP':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:110: multiple definition of `_Unwind_GetIP'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:110: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetIPInfo':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:123: multiple definition of `_Unwind_GetIPInfo'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:123: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_SetIP':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:131: multiple definition of `_Unwind_SetIP'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:131: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetLanguageSpecificData':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:137: multiple definition of `_Unwind_GetLanguageSpecificData'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:137: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetRegionStart':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:143: multiple definition of `_Unwind_GetRegionStart'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:143: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_FindEnclosingFunction':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:148: multiple definition of `_Unwind_FindEnclosingFunction'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:148: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetDataRelBase':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:161: multiple definition of `_Unwind_GetDataRelBase'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:161: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_GetTextRelBase':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:166: multiple definition of `_Unwind_GetTextRelBase'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:166: first defined here
/tmp/go-link-901845510/000002.o: In function `_GCC_specific_handler':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:196: multiple definition of `_GCC_specific_handler'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:196: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_RaiseException':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:330: multiple definition of `_Unwind_RaiseException'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:330: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_Resume':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:347: multiple definition of `_Unwind_Resume'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:347: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_Resume_or_Rethrow':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:396: multiple definition of `_Unwind_Resume_or_Rethrow'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:396: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_ForcedUnwind':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:409: multiple definition of `_Unwind_ForcedUnwind'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:409: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_DeleteException':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:427: multiple definition of `_Unwind_DeleteException'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:427: first defined here
/tmp/go-link-901845510/000002.o: In function `_Unwind_Backtrace':
/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:483: multiple definition of `_Unwind_Backtrace'
/tmp/go-link-901845510/000000.o:/home/bga/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-4.9.3/libgcc/unwind-seh.c:483: first defined here
collect2: error: ld returned 1 exit status
Any ideas about what may be causing this or, alternatively, any tips on how to debug this further?
$ go version
go version go1.5.1 linux/amd64
Thanks in advance.