New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: cgo with clang and -buildmode=c-shared failures on Windows #42146
Comments
I see the error LINK : fatal error LNK1104: cannot open file 'mingwex.lib' |
What version of In |
Yes, CC=gcc because I ran it before setting CC to clang in the batch. set GO111MODULE= clang --version shows: |
@tungmangtdh3 you did not explain what you are trying to build. But, if you want to use clang to build Cgo program, you cannot. There is no support for this functionality. #17014 is about clang support building. Alex |
#54811 |
I have the same error about the
|
I'm afraid cgo does not currently support Clang on Windows. Closing as duplicated of #17014. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
set CGO_ENABLED=1
set CC=clang
set PATH=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%
go build -buildmode=c-shared -o bin/crawler.dll -ldflags "-v" -v my/pathp/export
What did you expect to see?
Build success.
What did you see instead?
HEADER = -H10 -T0xffffffffffffffff -R0xffffffff
pclntab=1272164 bytes, funcdata total 320301 bytes
symsize = 0
host link: "clang" "-m64" "-mconsole" "-Wl,--tsaware" "-Wl,--nxcompat" "-Wl,--major-os-version=6" "-Wl,--minor-os-version=1" "-Wl,--major-subsystem-version=6" "-Wl,--minor-subsystem-version=1" "-Wl,-Bsymbolic" "-shared" "-o" "crawler.dll" "-Qunused-arguments" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\go.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000000.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000001.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000002.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000003.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000004.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000005.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000006.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000007.o" "C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\000008.o" "-g" "-O2" "-g" "-O2" "-Wl,-T,C:\Users\nguyenha\AppData\Local\Temp\go-link-077327015\fix_debug_gdb_scripts.ld" "-Wl,--start-group" "-lmingwex" "-lmingw32" "-Wl,--end-group" "-lkernel32"
c:\go\pkg\tool\windows_amd64\link.exe: running clang failed: exit status 1104
LINK : warning LNK4044: unrecognized option '/-tsaware'; ignored
LINK : warning LNK4044: unrecognized option '/-nxcompat'; ignored
LINK : warning LNK4044: unrecognized option '/-major-os-version=6'; ignored
LINK : warning LNK4044: unrecognized option '/-minor-os-version=1'; ignored
LINK : warning LNK4044: unrecognized option '/-major-subsystem-version=6'; ignored
LINK : warning LNK4044: unrecognized option '/-minor-subsystem-version=1'; ignored
LINK : warning LNK4044: unrecognized option '/Bsymbolic'; ignored
LINK : warning LNK4044: unrecognized option '/T'; ignored
LINK : warning LNK4044: unrecognized option '/-start-group'; ignored
LINK : warning LNK4044: unrecognized option '/-end-group'; ignored
LINK : fatal error LNK1104: cannot open file 'mingwex.lib'
clang: error: linker command failed with exit code 1104 (use -v to see invocation)
The text was updated successfully, but these errors were encountered: