pwiecz / go-fltk

A simple wrapper around FLTK 1.4 library
MIT License
124 stars 24 forks source link

undefined reference to `__intrinsic_setjmpex' #125

Open mvasi90 opened 9 months ago

mvasi90 commented 9 months ago

Impossible to build from Linux to Windows binary:

/usr/lib/go/pkg/tool/linux_amd64/link: running x86_64-w64-mingw32-g++ failed: exit status 1
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: /home/developer/go/src/github.com/pwiecz/go-fltk/lib/windows/amd64/libfltk_images.a(Fl_JPEG_Image.cxx.obj):Fl_JPEG_Image.:(.text+0x1b8): undefined reference to `__intrinsic_setjmpex'
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: /home/developer/go/src/github.com/pwiecz/go-fltk/lib/windows/amd64/libfltk_images.a(Fl_PNG_Image.cxx.obj):Fl_PNG_Image.c:(.text+0x133): undefined reference to `__intrinsic_setjmpex'
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: /home/developer/go/src/github.com/pwiecz/go-fltk/lib/windows/amd64/libfltk_png.a(png.c.obj):png.c:(.text+0x1367): undefined reference to `__intrinsic_setjmpex'
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: /home/developer/go/src/github.com/pwiecz/go-fltk/lib/windows/amd64/libfltk_png.a(pngerror.c.obj):pngerror.c:(.text+0xbd5): undefined reference to `__intrinsic_setjmpex'
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: /home/developer/go/src/github.com/pwiecz/go-fltk/lib/windows/amd64/libfltk_png.a(pngerror.c.obj):pngerror.c:(.text+0x13ea): undefined reference to `__intrinsic_setjmpex'
collect2: error: ld returned 1 exit status
MoAlyousef commented 9 months ago

I think it's because the CI mingw windows toolchain uses ucrt, whereas the mingw toolchain on linux uses msvcrt.

Related to #115

zivlamp commented 7 months ago

I had the same problem when I upgraded the dependencies in go.mod to v0.0.0-20240129144424-3260f5ba37f1. I use mingw toolchain in windows.

pwiecz commented 7 months ago

@zivlamp I'll be looking into it, but most likely next week.

zivlamp commented 7 months ago

Thanks for reply. Additional note: It's no problem in Linux, and it compiles fine in windows with version 20221204.

pwiecz commented 7 months ago

I've rebuilt the windows libraries using another toolchain. You can see if it helps. When not crosscompiling it's always recommended, especially under Windows, to rebuild the fltk binaries from source by invoking go generate from go-fltk sources (from Windows command prompt).

zivlamp commented 7 months ago

I switched the version to the latest in go.mod. It's working now! Thanks for your work and suggestions!