msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.27k stars 1.21k forks source link

gtk2 clang build nastiness #8493

Closed revelator closed 3 years ago

revelator commented 3 years ago
C:/Msys2/clang32/include/glib-2.0/gobject/gtype.h:643:145: note: expanded from macro 'G_TYPE_INSTANCE_GET_PRIVATE'
#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type)   ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type))) GLIB_DEPRECATED_MACRO_IN_2_58_FOR(G_ADD_PRIVATE)
                                                                                                                                                ^
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: C:\Msys2\clang32\bin\i686-w64-mingw32-gcc.exe -DHAVE_CONFIG_H -I. -I../../gtk+-2.24.33/gtk -I.. -DGTK_VERSION="2.24.33" -DGTK_BINARY_VERSION="2.10.0" -DGTK_COMPILATION -DGTK_DISABLE_DEPRECATED -DGTK_FILE_SYSTEM_ENABLE_UNSUPPORTED -DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED -DGTK_LIBDIR="C:/Msys2/clang32/lib" -DGTK_DATADIR="C:/Msys2/clang32/share" -DGTK_DATA_PREFIX="C:/Msys2/clang32" -DGTK_SYSCONFDIR="C:/Msys2/clang32/etc" -DGTK_HOST="i686-w64-mingw32" #0 0x75e56ea3 (C:\Windows\System32\ucrtbase.dll+0x26ea3)
#1 0x75e592a0 (C:\Windows\System32\ucrtbase.dll+0x292a0)
#2 0x75e59152 (C:\Windows\System32\ucrtbase.dll+0x29152)
#3 0x5d909640 _ZN4llvm14raw_fd_ostream10write_implEPKcj (C:\Msys2\clang32\bin\libLLVM.dll+0x109640)
#4 0x5d8c0f9f _ZN4llvm21PrettyStackTraceEntryD2Ev (C:\Msys2\clang32\bin\libLLVM.dll+0xc0f9f)
#5 0x5d92426b _ZN4llvm3sys17RunSignalHandlersEv (C:\Msys2\clang32\bin\libLLVM.dll+0x12426b)
../libtool: linje 1779: 30833 Segmentation fault

any idea what might cause this ?

mati865 commented 3 years ago

also make -j1 or things go boom.

Sounds like 32-bit linker, there is no fix for it.

looks like llvm-rc does not like manifests since it looks an awfull lot like an xml parser error.

LLVM RC is still WIP, I think there were many changes to it in LLVM 12 release. You might have to wait until we land it.

revelator commented 3 years ago

Ah ok, well if it is a new feature i can understand if it might still have some bugs. is it possible in the meantime to use the binutils windres or is it incompatible with the llvm compiler ?.

revelator commented 3 years ago

strangely enough the python based manifest code from gtk3 works, but i doubt it would be easy porting it for gtk2 :S

mati865 commented 3 years ago

is it possible in the meantime to use the binutils windres or is it incompatible with the llvm compiler ?.

I'm not sure but this might be the only Binutils part compatible with LLVM toolchain.

revelator commented 3 years ago

works :) so we could as a temporary hack point RC or WINDRES towards the mingw* windres, i just successfully compiled gtk2.

revelator commented 3 years ago

sidenote the build error with make greater than -j1 is not linked to the 32 bit problem we had with other sources as it also fails with the 64 bit compile.

revelator commented 3 years ago

gtk2

tadaa :)

mati865 commented 3 years ago

works :) so we could as a temporary hack point RC or WINDRES towards the mingw* windres, i just successfully compiled gtk2.

I'd try with LLVM 12 first, if it doesn't work we would have to build and bundle Bintuils windres...

sidenote the build error with make greater than -j1 is not linked to the 32 bit problem we had with other sources as it also fails with the 64 bit compile.

Was it IO related?

revelator commented 3 years ago

seems to have been caused by the resource compiler manifest, parse error i noticed.

mati865 commented 3 years ago

That parse error looks like insufficient memory or addressable space.

revelator commented 3 years ago

indeed it does hmm :/

revelator commented 3 years ago

well after building gtk2 succesfully the dependants seem to build ok, if we end up having to bundle windres we might also have to link it to the static libraries so as to avoid having it depend on msvc runtime dll's. Binutils does not seem to like being built with clang unfortunatly.

jeremyd2019 commented 3 years ago

Yeah lots of things are failing parsing RC files, including windows-default-manifest. Binutils did build successfully under clang with autobuild, but was removed again because it conflicts with a lot of files from clang.

revelator commented 3 years ago

well if llvm version 12 cannot fix it we only need windres from binutils, not sure if windres can be built standalone ?. graphviz is still a nogo sadly as i cannot build poppler :S even after updating the package to the latest version. The odd thing is that the 32 bit package builds but the 64 bit version crashes while building (most of the time it is the other way around so heh). A few packages also complain about pthreads but i got around that by adding it to LIBS.

ZachBacon commented 3 years ago

Took a stab at gtk2 myself, still producing some interesting nastiness https://gist.github.com/ZachBacon/656cfb45fa81948436b43732b94bf59c

revelator commented 3 years ago

Aye tons and tons of warnings :) especially with the macros. To build it currently you need windres from binutils and make -j1 because of a resource script that llvm-rc does not like overly much. copy out the the old arch-w64-mingw32-windres.exe and windres.exe then copy over the windres.exe from mingw and make a copy named arch-w64-mingw32-windres.exe then put them in clang/bin. Next modify the PKGBUILD find make and add -j1 after make then it will build but there will still be a ton of warnings it does work however.

ZachBacon commented 3 years ago

Pretty sure that isn't a solution.

revelator commented 3 years ago

its a temporary workaround atm for those who wish to build it themself :) it was newer intended as a solution. In time we should be able to come up with something better.

lazka commented 3 years ago

here is what I get right now:

libtool: link: if test DEF = "`/usr/bin/sed -n -e 's/^[  ]*//' -e '/^\(;.*\)*$/d' -e 's/^\(EXPORTS\|LIBRARY\)\([         ].*\)*$/DEF/p' -e q ../../gtk+-2.24.33/gdk/gdk.def`" ; then cp ../../gtk+-2.24.33/gdk/gdk.def .libs/libgdk-win32-2.0-0.dll.def; else echo EXPORTS > .libs/libgdk-win32-2.0-0.dll.def; cat ../../gtk+-2.24.33/gdk/gdk.def >> .libs/libgdk-win32-2.0-0.dll.def; fi
libtool: link:  clang -shared .libs/libgdk-win32-2.0-0.dll.def  .libs/gdk.o .libs/gdkapplaunchcontext.o .libs/gdkcairo.o .libs/gdkcolor.o .libs/gdkcursor.o .libs/gdkdisplay.o .libs/gdkdisplaymanager.o .libs/gdkdnd.o .libs/gdkdraw.o .libs/gdkevents.o .libs/gdkfont.o .libs/gdkgc.o .libs/gdkglobals.o .libs/gdkimage.o .libs/gdkkeys.o .libs/gdkkeyuni.o .libs/gdkoffscreenwindow.o .libs/gdkpango.o .libs/gdkpixbuf-drawable.o .libs/gdkpixbuf-render.o .libs/gdkpixmap.o .libs/gdkpolyreg-generic.o .libs/gdkrectangle.o .libs/gdkregion-generic.o .libs/gdkrgb.o .libs/gdkscreen.o .libs/gdkselection.o .libs/gdkvisual.o .libs/gdkwindow.o .libs/gdkwindowimpl.o .libs/gdkenumtypes.o .libs/gdkmarshalers.o .libs/gdkkeynames.o  -Wl,--whole-archive win32/.libs/libgdk-win32.a -Wl,--no-whole-archive  -limm32 -lshell32 -lole32 -LC:/msys64/clang64/lib -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lgdi32 -lmsimg32 -lcairo -lintl  -march=x86-64 -mtune=generic -O2 -mms-bitfields -Wl,win32/rc/gdk-win32-res.o -Wl,--dynamicbase -Wl,-luuid   -o .libs/libgdk-win32-2.0-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgdk-win32-2.0.dll.a
lld-link: error: <root>: undefined symbol: gdk_test_simulate_button
lld-link: error: <root>: undefined symbol: gdk_test_simulate_key
lld-link: error: <root>: undefined symbol: gdk_test_render_sync
lld-link: error: <root>: undefined symbol: gdk_keyval_convert_case
lld-link: error: <root>: undefined symbol: gdk_keyval_from_name
lld-link: error: <root>: undefined symbol: gdk_keyval_name
lld-link: error: undefined symbol: IA__gdk_display_open
>>> referenced by .libs/gdk.o:(gdk_display_open_default_libgtk_only)
>>> referenced by .libs/gdk.o:(gdk_display_open_default_libgtk_only)

lld-link: error: undefined symbol: IA__gdk_screen_make_display_name
>>> referenced by .libs/gdkapplaunchcontext.o:(gdk_app_launch_context_get_display)

lld-link: error: undefined symbol: IA__gdk_display_get_name
>>> referenced by .libs/gdkapplaunchcontext.o:(gdk_app_launch_context_get_display)

lld-link: error: undefined symbol: IA__gdk_colormap_get_type
>>> referenced by .libs/gdkcolor.o:(gdk_colormap_get_visual)
>>> referenced by .libs/gdkgc.o:(gdk_gc_set_colormap)
>>> referenced by .libs/gdkimage.o:(gdk_image_set_colormap)
>>> referenced 4 more times

lld-link: error: undefined symbol: IA__gdk_colormap_change
>>> referenced by .libs/gdkcolor.o:(gdk_colors_store)

lld-link: error: undefined symbol: IA__gdk_colormap_alloc_colors
>>> referenced by .libs/gdkcolor.o:(gdk_color_white)
>>> referenced by .libs/gdkcolor.o:(gdk_colormap_alloc_color)
>>> referenced by .libs/gdkcolor.o:(gdk_color_black)
>>> referenced 1 more times

lld-link: error: undefined symbol: IA__gdk_screen_get_system_colormap
>>> referenced by .libs/gdkcolor.o:(gdk_colormap_get_system)
>>> referenced by .libs/gdkoffscreenwindow.o:(_gdk_offscreen_window_new)
>>> referenced by .libs/gdkrgb.o:(gdk_rgb_create_info)
>>> referenced 3 more times

lld-link: error: undefined symbol: IA__gdk_cursor_new_for_display
>>> referenced by .libs/gdkcursor.o:(gdk_cursor_new)

lld-link: error: undefined symbol: IA__gdk_display_pointer_ungrab
>>> referenced by .libs/gdkdisplay.o:(gdk_pointer_ungrab)
>>> referenced by .libs/gdkwindow.o:(gdk_window_hide)

lld-link: error: undefined symbol: IA__gdk_display_keyboard_ungrab
>>> referenced by .libs/gdkdisplay.o:(gdk_keyboard_ungrab)
>>> referenced by .libs/gdkwindow.o:(gdk_window_hide)

lld-link: error: undefined symbol: IA__gdk_display_beep
>>> referenced by .libs/gdkdisplay.o:(gdk_beep)
>>> referenced by .libs/gdkwindow.o:(gdk_window_beep)

lld-link: error: undefined symbol: IA__gdk_event_send_client_message_for_display
>>> referenced by .libs/gdkdisplay.o:(gdk_event_send_client_message)

lld-link: error: undefined symbol: IA__gdk_screen_broadcast_client_message
>>> referenced by .libs/gdkdisplay.o:(gdk_event_send_clientmessage_toall)

lld-link: error: undefined symbol: IA__gdk_screen_get_display
>>> referenced by .libs/gdkdisplay.o:(singlehead_default_window_at_pointer)
>>> referenced by .libs/gdkdraw.o:(gdk_drawable_get_display)
>>> referenced by .libs/gdkimage.o:(_gdk_image_get_scratch)
>>> referenced 4 more times

lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [Makefile:1307: libgdk-win32-2.0.la] Error 1
make[4]: Leaving directory '/home/user/M/mingw-w64-gtk2/src/build-x86_64-w64-mingw32/gdk'
make[3]: *** [Makefile:1456: all-recursive] Error 1
make[3]: Leaving directory '/home/user/M/mingw-w64-gtk2/src/build-x86_64-w64-mingw32/gdk'
make[2]: *** [Makefile:1230: all] Error 2
make[2]: Leaving directory '/home/user/M/mingw-w64-gtk2/src/build-x86_64-w64-mingw32/gdk'
make[1]: *** [Makefile:740: all-recursive] Error 1
make[1]: Leaving directory '/home/user/M/mingw-w64-gtk2/src/build-x86_64-w64-mingw32'
make: *** [Makefile:632: all] Error 2
==> ERROR: A failure occurred in build().
revelator commented 3 years ago

try building it with --disable-visibility in the configure flags. not sure why this version needs this but i noticied it tries to use ELF visibility flags by default even on windows.

jeremyd2019 commented 3 years ago

That got further, to the llvm-rc manifest parsing issue. So I need to get on backporting the fix from #9106

revelator commented 3 years ago

hopefully that takes care of the rest, fingers crossed.

jeremyd2019 commented 3 years ago

Nope, this wasn't the llvm-rc issue I thought it was. #9130