GCC在构建时未定义的引用

I am trying to build an exe for windows amd64 using golang. Everything is running smoothly except on "go run" or "go build". The build process is breaking on gcc compile of the package from github.com/andlabs/ui. The trace goes as follows:

$ go build
# gitlab.com/asnossascenas/dbRegistration/ui
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiNewTable':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:66: undefined reference to `uiNewTable'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiNewTableModel':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:83: undefined reference to `uiNewTableModel'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableAppendTextColumn':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:103: undefined reference to `uiTableAppendTextColumn'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableGetSelection':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:120: undefined reference to `uiTableGetSelection'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableIterAdvance':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:138: undefined reference to `uiTableIterAdvance'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableIterCurrent':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:168: undefined reference to `uiTableIterCurrent'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `realuiTableOnSelectionChanged':
C:/GoPath/src/gitlab.com/asnossascenas/dbRegistration/ui/table.go:12: 
undefined reference to `uiTableOnSelectionChanged'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiFreeTableModel':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:49: undefined reference to `uiFreeTableModel'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableIterComplete':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:152: undefined reference to `uiTableIterComplete'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableModelRowChanged':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:184: undefined reference to `uiTableModelRowChanged'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableModelRowDeleted':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:198: undefined reference to `uiTableModelRowDeleted'
C:\Users\Pat\AppData\Local\Temp\go- 
build167765418\gitlab.com\asnossascenas\dbRegistration\ui\_obj\table.cgo2.o: 
In function `_cgo_1e2a701ee86d_Cfunc_uiTableModelRowInserted':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:212: undefined reference to `uiTableModelRowInserted'
C:\Users\Pat\AppData\Local\Temp\gobuild167765418\gitlab.com
\asnossascenas\dbRegistration\ui\_obj\tablemodelhandler.cgo2.o: In function 
`_cgo_1e2a701ee86d_Cfunc_uiTableModelStrdup':
/tmp/go-build\gitlab.com\asnossascenas\dbRegistration\ui\_obj/cgo-gcc- 
prolog:68: undefined reference to `uiTableModelStrdup'o `uiTableModelStrdup'                                                                                 
function `msgbox':
C:/GoPath/src/gitlab.com/asnossascenas/
dbRegistration/ui/libui_windows_amd64.a(stddialogs.cpp.obj): In function 
`msgbox':E:/github.com/andlabs/libui/windows/stddialogs.cpp:113: undefined 
reference to `__imp_TaskDialog'
collect2.exe: error: ld returned 1 exit status

I initially tried to crosscompile from linux to windows having roughly the same problem so I guess it's a matter of either the flags I should use to build it or maybe I am missing something dependency related...

I tried using CGO_ENABLED=1 and pretty much every other combination of flags possible on linux to crosscompile, sometimes triggering the error

gcc: error: unrecognized command line option ‘-mthreads’

eventually I decided I should move to Windows and compile natively, which doesn't seem to be working.

I am willing to provide any more information you might need to help me figure this out.

According to the the installation instructions for the ui package you will need to install MingW and set some some environment variables to get it to build:

set CGO_ENABLED=1
set CC=C:\PROGRA~1\mingw-w64\x86_64-7.2.0-win32-seh-rt_v5-rev1\mingw64\bin\gcc.exe
set CXX=C:\PROGRA~1\mingw-w64\x86_64-7.2.0-win32-seh-rt_v5-rev1\mingw64\bin\g++.exe
go build -ldflags -H=windowsgui