Bug 10191

Summary: Fail to build galculator with toolchain SDK on Fedora 24 i686
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Yi Zhao <yi.zhao>
Component: devtools / tool chainAssignee: Jussi Kukkonen <jku>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: jose.perez.carranza, meta.mr.watcher, meta.watcher, richard.purdie, yi.zhao
Version: 2.2   
Target Milestone: 2.2 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: New (Never tested)
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
configure.log
none
compile.log none

Description Yi Zhao 2016-08-26 07:27:00 UTC
Created attachment 3391 [details]
configure.log

Git: master/f038f069977170e323c9c6884c69e0b9e1cf1c6f

Toolchain SDK location: http://autobuilder.yoctoproject.org/pub/nightly/20160819-1/toolchain/i686/

This issue only happens on Fedora 24 i686, but works fine on the Fedora 24 x86_64 and Debian 8 i686.

Steps:
1. Download toolchain sdk from the above link and install it.

2. Download galculator from: http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2

3. With the cross compile environment, run:
$ ./configure ${CONFIGURE_FLAGS}
$ make


Error message:
####################
libtool: link: x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux -pthread -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/gtk-3.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/at-spi2-atk/2.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/at-spi-2.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/dbus-1.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/lib/dbus-1.0/include -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/gtk-3.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/gio-unix-2.0/ -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/cairo -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/pango-1.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/harfbuzz -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/pango-1.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/atk-1.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/cairo -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/pixman-1 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/freetype2 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/libpng16 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/gdk-pixbuf-2.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/libpng16 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/include/glib-2.0 -I/opt/poky/2.1+snapshot/sysroots/core2-64-poky-linux/usr/lib/glib-2.0/include -O2 -pipe -g -feliminate-unused-debug-types -Wall -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o galculator galculator-main.o galculator-math_functions.o galculator-display.o galculator-general_functions.o galculator-calc_basic.o galculator-config_file.o galculator-callbacks.o galculator-ui.o galculator-flex_parser.o -Wl,--export-dynamic  /usr/lib/libgtk-3.so /usr/lib/libgdk-3.so /usr/lib/libpangocairo-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libatk-1.0.so /usr/lib/libcairo-gobject.so /usr/lib/libcairo.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libgio-2.0.so /usr/lib/libgobject-2.0.so /usr/lib/libglib-2.0.so -lm -pthread
/usr/lib/libgtk-3.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:452: recipe for target 'galculator' failed
make[2]: *** [galculator] Error 1
#######################
Comment 1 Yi Zhao 2016-08-26 07:27:21 UTC
Created attachment 3392 [details]
compile.log
Comment 2 Jussi Kukkonen 2016-09-12 12:51:30 UTC
Yi Zhao, if you still have a Fedora i686 install that you can test, can you try the steps in the end of the post? If not, let me know and I'll install one myself.


It looks like libtool & configure provided by galculator are very old: they do not understand --with-libtool-sysroot and the linker ends up linking with host libraries.

There's a workaround in the docs (http://www.yoctoproject.org/docs/2.1/sdk-manual/sdk-manual.html#passing-host-options) but this bit doesn't quite work:
    aclocal -I ${OECORE_NATIVE_SYSROOT}/usr/share/aclocal

It seems to me there's m4 scripts we need in the target sysroot and not native (like AM_GLIB_GNU_GETTEXT from glib-dev) so this is what I did to build with newer tooling instead:

$ libtoolize --automake
$ aclocal -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal -I m4
$ autoconf
$ autoheader
$ automake -a
$ ./configure ${CONFIGURE_FLAGS}
$ make
Comment 3 Jussi Kukkonen 2016-09-13 13:31:46 UTC
Please assign back to me when you've re-tested (or if you can't easily test).
Comment 4 Yi Zhao 2016-09-14 03:25:28 UTC
(In reply to comment #2)
> Yi Zhao, if you still have a Fedora i686 install that you can test, can you
> try the steps in the end of the post? If not, let me know and I'll install
> one myself.
> 
> 
> It looks like libtool & configure provided by galculator are very old: they
> do not understand --with-libtool-sysroot and the linker ends up linking with
> host libraries.
> 
> There's a workaround in the docs
> (http://www.yoctoproject.org/docs/2.1/sdk-manual/sdk-manual.html#passing-
> host-options) but this bit doesn't quite work:
>     aclocal -I ${OECORE_NATIVE_SYSROOT}/usr/share/aclocal
> 
> It seems to me there's m4 scripts we need in the target sysroot and not
> native (like AM_GLIB_GNU_GETTEXT from glib-dev) so this is what I did to
> build with newer tooling instead:
> 
> $ libtoolize --automake
> $ aclocal -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal -I m4
> $ autoconf
> $ autoheader
> $ automake -a
> $ ./configure ${CONFIGURE_FLAGS}
> $ make

Hi, 

It works when I follow your steps:

$ libtoolize --automake
$ aclocal -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal -I m4
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
$ autoconf
$ autoheader
$ automake -a
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /opt/poky/2.1+snapshot/sysroots/i686-pokysdk-linux/usr/bin/automake line 3939.
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:4: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.in:4: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'
$ ./configure ${CONFIGURE_FLAGS}
configure: loading site script /opt/poky/2.1+snapshot/site-config-i586-poky-linux
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/build/galculator-2.1.4/missing: Unknown `--is-lightweight' option
Try `/home/build/galculator-2.1.4/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for i586-poky-linux-strip... i586-poky-linux-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for i586-poky-linux-gcc... i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux accepts -g... yes
checking for i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux option to accept ISO C89... none needed
checking whether i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux... gcc3
checking whether NLS is requested... yes
checking for intltool-update... /usr/bin/intltool-update
checking for intltool-merge... /usr/bin/intltool-merge
checking for intltool-extract... /usr/bin/intltool-extract
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for perl... /opt/poky/2.1+snapshot/sysroots/i686-pokysdk-linux/usr/bin/perl
checking for perl >= 5.8.1... 5.22.1
checking for library containing strerror... none required
checking how to run the C preprocessor... i586-poky-linux-gcc -E  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... (cached) yes
checking build system type... i686-pc-linux-gnu
checking host system type... i586-poky-linux-gnu
checking for cos in -lm... yes
checking for i586-poky-linux-pkg-config... no
checking for pkg-config... /opt/poky/2.1+snapshot/sysroots/i686-pokysdk-linux/usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for GTK... yes
checking for sinhq in -lquadmath... no
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... -lfl
checking whether yytext is a pointer... yes
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux... i586-poky-linux-ld   --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux
checking if the linker (i586-poky-linux-ld   --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... i586-poky-linux-nm
checking the name lister (i586-poky-linux-nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert i686-pc-linux-gnu file names to i586-poky-linux-gnu format... func_convert_file_noop
checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for i586-poky-linux-ld   --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux option to reload object files... -r
checking for i586-poky-linux-objdump... i586-poky-linux-objdump
checking how to recognize dependent libraries... pass_all
checking for i586-poky-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for i586-poky-linux-ar... i586-poky-linux-ar
checking for archiver @FILE support... @
checking for i586-poky-linux-strip... (cached) i586-poky-linux-strip
checking for i586-poky-linux-ranlib... i586-poky-linux-ranlib
checking command to parse i586-poky-linux-nm output from i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux object... ok
checking for sysroot... /opt/poky/2.1+snapshot/sysroots/i586-poky-linux
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for i586-poky-linux-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking for strings.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for unistd.h... (cached) yes
checking for dlfcn.h... (cached) yes
checking for objdir... .libs
checking if i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux supports -fno-rtti -fno-exceptions... no
checking for i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux option to produce PIC... -fPIC -DPIC
checking if i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux PIC flag -fPIC -DPIC works... yes
checking if i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux static flag -static works... no
checking if i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux supports -c -o file.o... yes
checking if i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux supports -c -o file.o... (cached) yes
checking whether the i586-poky-linux-gcc  -m32 -march=i586 --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux linker (i586-poky-linux-ld   --sysroot=/opt/poky/2.1+snapshot/sysroots/i586-poky-linux) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for locale.h... (cached) yes
checking for LC_MESSAGES... yes
checking for libintl.h... (cached) yes
checking for ngettext in libc... yes
checking for dgettext in libc... yes
checking for bind_textdomain_codeset... (cached) yes
checking for msgfmt... (cached) /usr/bin/msgfmt
checking for dcgettext... (cached) yes
checking if msgfmt accepts -c... yes
checking for gmsgfmt... (cached) /usr/bin/msgfmt
checking for xgettext... (cached) /usr/bin/xgettext
checking for catalogs to be installed...  de fr ja pt pt_BR pl ro sk es_MX ru zh_TW zh_CN sv tr lt hu es cs el en_AU gl id it kk mr uk
configure: creating ./config.status
config.status: creating Makefile
config.status: creating galculator.spec
config.status: creating src/Makefile
config.status: creating po/Makefile.in
config.status: creating ui/Makefile
config.status: creating ui/about.ui
config.status: creating doc/Makefile
config.status: creating pixmaps/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing po/stamp-it commands
$ make
make  all-recursive
make[1]: Entering directory '/home/build/galculator-2.1.4'
Making all in src
[snip]
make[2]: Leaving directory '/home/build/galculator-2.1.4'
make[1]: Leaving directory '/home/build/galculator-2.1.4'
Comment 5 Jussi Kukkonen 2016-09-18 11:49:49 UTC
Based on comment 4 I would say this is a test case bug. 

Possible options:
1. pick something other than galculator as the test case 
2. fix the test case (meta/lib/oeqa/sdk/buildgalculator.py). Either by
   adding a "LegacySDKBuildProject" into meta/lib/oeqa/utils/targetbuild.py
   or admitting that abstracting this is hard and making BuildProject.run()
   public so the test case could fix the source itself before configure...
Comment 6 Jussi Kukkonen 2016-09-30 09:11:45 UTC
commit 46c5e7adb8a0ddafa65cf6c138b9ae02d0426b7a
Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date:   Tue Sep 27 15:48:41 2016 +0300

    lib/oeqa: Regenerate galculator configure
    
    galculator configure seems to be so old it does not
    recognise --with-libtool-sysroot: regenerate configure.
    
    Fixes [YOCTO #10191].
    
    (From OE-Core rev: 3e838773462e77cb2e3ba9a69534260f89ca4904)



So current build commands for galculator test are

$ autoreconf -i -f -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal -I m4;
$ ./configure ${CONFIGURE_FLAGS}
$ make