Fix ImGuiColorTextEdit windows mingw linker error#507
Fix ImGuiColorTextEdit windows mingw linker error#507xypwn wants to merge 4 commits intoAllenDang:mainfrom
Conversation
gucio321
left a comment
There was a problem hiding this comment.
Hello!
Thank you for your pull request
Unfortunately, cwrappers directory contains "external C++ code" that we'd rather not modify. The reason is that running make update will override those changes.
Could you please report this to the upstream?
Alternatively, maybe try to put those changes directly in ImGuiColorTextEdit (e.g. custom.go or something)
Also, if related to #418, what mingw version? As mentioned in #418 (comment) it worked for me (at that point). I can try again tomorrow on the current codebase.
|
Hi, thanks for the quick response. I didn't know this repo had a I'm using the current scoop distribution of gcc (version 13.2.0), which targets x86_64-w64-mingw32. Also, it turns out I actually don't get the linker error if I recompile the cimgui.a library on my local machine (instead of ci), so it seems to be some weird interaction between the different linker/compiler versions. This means fixing in the C++ upstream probably doesn't make much sense, since users won't have mismatching compiler/linker versions there anyway. I doubt it's possible to do anything from the Go/CGo side as you proposed, since the error stems from cimgui.a, which is built from CMake. I don't know what else to do, though, but I understand why you may not want to merge in this state. I'm open to any other ideas. |
|
well, I tried again and it still works on arch linux. My analysis:
- name: Install MinGW
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
make
git
pacboy: >-
toolchain:p
cmake:p
ninja:p
Generally I agree that requiring to have latest gcc is not the best thing we can do here - we deffinitly should support older versions - this is why #157 exists but we have no idea how to do this atm. As a workeround, I suggest using docker (or custom mingw version) FROM archlinux:latest
RUN pacman -Syu --noconfirm git go glfw mingw-w64-gcc
RUN git clone https://github.com/AllenDang/cimgui-go /cimgui-go ## clone your project here or use ADD
WORKDIR /cimgui-go/examples/glfw
ENV GOOS=windows
ENV GOARCH=amd64
ENV CGO_ENABLED=1
ENV CC=x86_64-w64-mingw32-gcc
ENV CXX=x86_64-w64-mingw32-g++
ENV HOST=x86_64-w64-mingw32
CMD go build -ldflags "-s -w -H=windowsgui -extldflags=-static" -p 4 -v -o test.exe |
|
Thank you for the elaborate answer and suggestions. It turns out my scoop package manager was broken and therefore refused to update my GCC version EDIT: Actually, it turns out it still doesn't link (I didn't properly save my go.mod when testing). I still get the __imp_isblank linker error, even using x86_64-w64-mingw32 gcc/g++/ld v15.2.0 (I explicitly triple-checked the version). I am utterly confused and have no idea why this doesn't work.
|
|
Could you try with a fresh clone of cimgui-go and with |
Attempting to use ImGuiColorTextEdit on Windows with mingw caused the linker error shown below (may be related to #418).
I managed to make it run on my system by bypassing the isblank and isascii c lib functions which caused the errors via simple custom implementations (which have the same behavior).