GNOME Bugzilla – Bug 753745
glib-genmarshal still needed for cross-compilation
Last modified: 2015-09-01 14:40:52 UTC
When I am cross compiling glib, the configure step fails, because I don't have glib-genmarshal installed on my build machine. This should not happen because according to commit [1] and bug report #652168 [2], glib-genmarshal is no longer needed for building glib. When I am doing a normal build (i.e. not cross-compiling), glib-genmarshal is in fact not needed, but when I am cross compiling, configure step fails if there is no glib-genmarshal. Here is the configure command that fails on my build machine: ./configure --build=i686-linux-gnu --host=arm-linux-gnueabihf glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=no ac_cv_func_posix_getgrgid_r=no I guess that same problem appears on more normal setups. When I cross compile on my private machine with --host=i686-linux-gnu and --build=x86_64-linux-gnu, the configure step successfully finds glib-genmarshal, because I have it installed. But that is besides the point - the glib-genmarshal should not be needed at all for (cross-)compilation. [1] https://git.gnome.org/browse/glib/commit/?id=b74e2a7 [2] https://bugzilla.gnome.org/show_bug.cgi?id=652168
Here is the relevant part of the configure output: ... checking for broken poll... no (cross compiling) checking whether compiler understands -Wno-pointer-sign... yes checking for EILSEQ... yes checking for glib-genmarshal... no configure: error: Could not find a glib-genmarshal in your PATH ...
Created attachment 309573 [details] [review] Drop binary checks when cross-compiling We don't need to run binaries we just built in order to successfully build GLib and friends any more. Since commit b74e2a7, we don't need to run glib-genmarshal when building GIO; since commit f9eb9eed, all our tests (including the ones that do need to run binaries we just built) are only built when running "make check", instead of unconditionally at every build. This means that we don't need to check for existing, native binaries when cross-compiling, and fail the configuration step if they are not found — which also means that you don't need to natively build GLib for your toolchain, in order to cross-compile GLib. We can also use the cross-compilation conditional, and skip those tests that require a binary we just built in order to build.
Created attachment 309574 [details] [review] gio: Link against gmodule when building glib-compile-resources Otherwise cross-compilation will fail with linker errors.
Created attachment 309580 [details] [review] gio: Link against gmodule when building tools Otherwise cross-compilation will fail with linker errors.
Review of attachment 309573 [details] [review]: Sold. And great commit message.
Review of attachment 309580 [details] [review]: Hum...confused what this has to do with cross-compilation. Are you sure it isn't that the target platform has -Wl,--as-needed in the default LDFLAGS? gmodule.la is Requires.private in the PC file. I'd be a little surprised if glib-compile-resources really needed it for example. It's not really a big deal to add it though, so if this makes your build work I'm not going to object.
If I apply both patches (attachment 309573 [details] [review] and attachment 309580 [details] [review]), then I can successfully cross compile on i686-linux-gnu for both x86_64-linux-gnu and arm-linux-gnueabihf. If I use only the glib-genmarshal patch (attachment 309573 [details] [review]), then cross-compilation on i686-linux-gnu succeds for x86_64-linux-gnu target (see http://pastebin.com/SxshPc5T), but fails for arm-linux-gnueabihf target (see http://pastebin.com/vdUSXNPw). In the latter case it complains that it can't find libgmodule-2.0.so.0.
If you're posting build logs, please use `make V=1` so people can see the exact compiler flags used.
Created attachment 309966 [details] Build log of cross-compilation on i686 for ARM target This is the verbose build log of cross-compilation on i686 for ARM when only the genmarshal patch is applied. The build fails.
Created attachment 309967 [details] Build log of cross-compilation on i686 for x86_64 target This is the verbose build log of cross-compilation on i686 for x86_64 when only the genmarshal patch is applied. The build is a success.
Attachment 309573 [details] pushed as 5ce7091 - Drop binary checks when cross-compiling Attachment 309580 [details] pushed as b04c565 - gio: Link against gmodule when building tools