Open Mihara opened 1 month ago
After much digging, there was some progress.
Turns out, Linux cross-compilation does not tolerate using upper case in LDFLAGS, since while Windows filesystems might not be case-sensitive, Linux filesystems which the MinGW libraries are installed to are. Editing cgo.go
to replace -lWs2_32
with -lws2_32
(and all the other cases) fixes this particular problem. It still doesn't compile, however, complaining about undefined reference to `clock_gettime'
...
...which is solved by adding -lpthread -static
to LDFLAGS, although I'm not certain this is the correct way out of this particular difficulty. (where would a native Windows compile get clock_gettime anyway?)
Description
Let me start by saying that I'm not sure this is actually a bug, but if anything, it's something insufficiently documented...
Assume a naive example project I plan to build for Windows while running under Linux. Simply running the setup.sh script as described in README produces no useful results:
I'm trying to patch the library in by making a local copy as described here:
At this point,
go build
produces a native binary that runs. Which is nice, but cross-compilation is mission critical (and the reason I picked Go for this project in the first place), so...Not big surprise here, because that's only supposed to work on projects not making use of
cgo
. Ok, let's try it with explicitly invokingcgo
...Now this is quite cryptic, and googling does not appear to produce any clues on what could possibly be wrong. Initially I assumed I just had a misconfigured
mingw32
or something, but then I tryxgo
(https://github.com/techknowlogick/xgo) which is supposed, in theory, to take care of everything for me, and carries everything inside a docker image:Notice the identical error message. Which suggests the problem is somewhere in go-webui...
Expected Behavior
I do expect cross-compilation to work or a statement that it isn't supported to be present in the documentation.
Reproduction Steps
No response
Error Logs
No response
Possible Solution
No response
Version
2.4.3
Environment Details (OS name, version, etc.)