cross compiling and ld auto-import errors
Hi, I'm cross compiling a linux application to work on Windows using i586-mingw32msvc-gcc. The application is using Gtk and Gdk calls. I'm getting linking errors about glib that I don't know how to resolve. Here's the compile time output. i586-mingw32msvc-gcc demo.o dthread.o callbacks.o interface.o hsv2rgb.o polar.o rebin.o scope.o seismograph.o sgram.o spin.o vbargraph.o waterfall.o /usr/local/win32gtk2.4/Runtime/lib/iconv.dll /usr/local/win32gtk2.4/Runtime/lib/intl.dll /usr/local/win32gtk2.4/Runtime/lib/libatk-1.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libgdk-win32-2.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libgdk_pixbuf-2.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libglib-2.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libgmodule-2.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libgobject-2.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libgthread-2.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libgtk-win32-2.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libpango-1.0-0.dll /usr/local/win32gtk2.4/Runtime/lib/libpangowin32-1.0-0.dll -lm -o demo polar.o:polar.c:(.text+0x2a5): variable '_g_thread_functions_for_glib_use' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. polar.o:polar.c:(.text+0x2e1): variable '_g_thread_functions_for_glib_use' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. polar.o:polar.c:(.text+0x913): variable '_g_thread_functions_for_glib_use' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. polar.o:polar.c:(.text+0x95d): variable '_g_thread_functions_for_glib_use' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. polar.o:polar.c:(.text+0x19a0): variable '_g_thread_functions_for_glib_use' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. polar.o:polar.c:(.text+0x19dc): variable '_g_thread_functions_for_glib_use' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. Info: resolving _g_threads_got_initialized by linking to __imp__g_threads_got_initialized (auto-import) Info: resolving _g_thread_functions_for_glib_use by linking to __imp__g_thread_functions_for_glib_use (auto-import) collect2: ld returned 1 exit status make: *** [demo] Error 1 >From what I've read, I need to force (external) constants to be variables, but I'm not sure how I can do that when the errors are coming from the glib library, underneath Gtk/Gdk. (or declare them explicitly with __declspec(dllimport)). I'm relatively new to cross-compiling, so I'm a little baffled as to where to go with this. Any advice you can offer would be greatly appreciated. Thanks, Bethany ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: cross compiling and ld auto-import errors
Never mind, I solved it. There were a few g_mutex_lock/unlock calls in the code and that seemed to be the problem. I replaced them with gdk_threads_enter() and gdk_threads_leave() (after ensuring that g_threads_init() and gdk_threads_init() were both called) and the linker was much happier. -Bethany On Fri, 2007-06-01 at 10:43 -0400, Bethany Seeger wrote: > Hi, > > I'm cross compiling a linux application to work on Windows using > i586-mingw32msvc-gcc. > > The application is using Gtk and Gdk calls. > > I'm getting linking errors about glib that I don't know how to resolve. > Here's the compile time output. > > i586-mingw32msvc-gcc demo.o dthread.o callbacks.o interface.o > hsv2rgb.o polar.o rebin.o scope.o seismograph.o sgram.o spin.o > vbargraph.o > waterfall.o /usr/local/win32gtk2.4/Runtime/lib/iconv.dll > /usr/local/win32gtk2.4/Runtime/lib/intl.dll > /usr/local/win32gtk2.4/Runtime/lib/libatk-1.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libgdk-win32-2.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libgdk_pixbuf-2.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libglib-2.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libgmodule-2.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libgobject-2.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libgthread-2.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libgtk-win32-2.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libpango-1.0-0.dll > /usr/local/win32gtk2.4/Runtime/lib/libpangowin32-1.0-0.dll -lm -o demo > polar.o:polar.c:(.text+0x2a5): variable > '_g_thread_functions_for_glib_use' can't be auto-imported. Please read > the documentation for ld's --enable-auto-import for details. > polar.o:polar.c:(.text+0x2e1): variable > '_g_thread_functions_for_glib_use' can't be auto-imported. Please read > the documentation for ld's --enable-auto-import for details. > polar.o:polar.c:(.text+0x913): variable > '_g_thread_functions_for_glib_use' can't be auto-imported. Please read > the documentation for ld's --enable-auto-import for details. > polar.o:polar.c:(.text+0x95d): variable > '_g_thread_functions_for_glib_use' can't be auto-imported. Please read > the documentation for ld's --enable-auto-import for details. > polar.o:polar.c:(.text+0x19a0): variable > '_g_thread_functions_for_glib_use' can't be auto-imported. Please read > the documentation for ld's --enable-auto-import for details. > polar.o:polar.c:(.text+0x19dc): variable > '_g_thread_functions_for_glib_use' can't be auto-imported. Please read > the documentation for ld's --enable-auto-import for details. > Info: resolving _g_threads_got_initialized by linking to > __imp__g_threads_got_initialized (auto-import) > Info: resolving _g_thread_functions_for_glib_use by linking to > __imp__g_thread_functions_for_glib_use (auto-import) > collect2: ld returned 1 exit status > make: *** [demo] Error 1 > > >From what I've read, I need to force (external) constants to be > variables, but I'm not sure how I can do that when the errors are coming > from the glib library, underneath Gtk/Gdk. (or declare them explicitly > with __declspec(dllimport)). > > I'm relatively new to cross-compiling, so I'm a little baffled as to > where to go with this. > > Any advice you can offer would be greatly appreciated. > > Thanks, > Bethany > > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: cross compiling and ld auto-import errors
Gabriele Greco writes: > CROSSLIBS = -L$(CROSSDIR)/lib/gtk-2.0 -mwindows -mno-cygwin \ The -mno-cygwin switch does nothing when compiling with a pure Win32 (mingw) compiler, as no Cygwin is involved at all. > -lgtk-win32-2.0.dll -lgdk-win32-2.0.dll I would leave out the .dll here to avoid risking confusion. (Somebody might think you are referring to the dll files themselves here.) The Win32-targeted linker looks for also libfoo.dll.a, not just libfoo.a when it encounters -lfoo. At least natively, presumably also when cross-compiling. --tml ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [SPAM] cross compiling and ld auto-import errors
Bethany Seeger wrote: > >From what I've read, I need to force (external) constants to be > variables, but I'm not sure how I can do that when the errors are coming > from the glib library, underneath Gtk/Gdk. (or declare them explicitly > with __declspec(dllimport)). > > I'm relatively new to cross-compiling, so I'm a little baffled as to > where to go with this. > If this can be of any use when I crosscompile I don't link directly with the DLLs but with the import files provided in the gtk-*-dev archives: In my makefile I have this (I've a win32 target that uses CROSSDIR, CROSSCXX, CROSSLIBS instead of the standard ones): CROSSLIBS = -L$(CROSSDIR)/lib/gtk-2.0 -mwindows -mno-cygwin \ -mms-bitfields -lgtk-win32-2.0.dll -lgdk-win32-2.0.dll -\ -latk-1.0.dll -lgdk_pixbuf-2.0.dll -lpango-1.0.dll -lpangowin32-1.0.dll \ -lgmodule-2.0.dll -lgobject-2.0.dll -lglib-2.0.dll -lgthread-2.0.dll \ -lstdc++ -luser32 -lws2_32 -lexpat -ljpeg ls /usr/i586-mingw32msvc/lib/gtk-2.0/ lib libgdk_pixbuf-2.0.dll.a libgmodule-2.0.dll.a libgtk-win32-2.0.dll.a libpangoft2-1.0.dll.a libatk-1.0.dll.alibglib-2.0.dll.alibgobject-2.0.dll.a libpango-1.0.dll.a libpangowin32-1.0.dll.a libgdk-win32-2.0.dll.a libglib.dll.alibgthread-2.0.dll.a libpangocairo-1.0.dll.a -- Bye, Gabry ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [SPAM] Re: cross compiling and ld auto-import errors
Tor Lillqvist wrote: > I would leave out the .dll here to avoid risking confusion. (Somebody > might think you are referring to the dll files themselves here.) The > Win32-targeted linker looks for also libfoo.dll.a, not just libfoo.a > when it encounters -lfoo. At least natively, presumably also when > cross-compiling. > Yes, just tried it and it works also without the DLL :) (at least with the mingw version packaged in the debian 4+). --- Bye, Gabry ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list