> On Jul 21, 2016, at 9:01 PM, Takashi Matsuzawa <tmatsuz...@uievolution.com> > wrote: > > Hello Yocto. > > I am now trying to build autotool based (inherit autotool) recipe on Yocto > 2.0 based environent. > Howerver, I am seeng following error. > I wonder if this is a known problem and you already have workaround? > > It says __init_array_end/start is not found which is referred in > libc_nonshared.a(elf-init.oS). > I googled and learned that this can happen if parameters are not set properly > to g++ when building shared library, and in fact, if I remove '-lc' from the > final linker command line, the build error is gone. > > >-lm -lc -lgcc_s -lgcc => NG > >-lm -lgcc_s -lgcc => OK > > The problem is, these liker parameters are set by the configure script into > libtool script and so far I could not find easy configurable option to > explicity remove '-lc' from here. > > I think configure recognizes that '-lc' is not necessary to build shared > library (through 'build_libtool_need_lc', etc. test), but it takes these from > somewhere (from its tests or its default template?) and embedding to linker > command parameters. > > This error did not happen with Yocto 1.8 based build (where the same recipe > could built w/o break). > So, it can be toolchain issue (c library difference, autotool difference, > etc.) or libc quirk, maybe fixed problem in recent versions, or specific to > my cross-environment, but I have not yet figured out handy workaround. > > I am trying here with protobuf package, butI am not yet sure if this happens > with all of the autotool based packages. > > ==== > | arm-poky-linux-gnueabi-libtool: link: arm-poky-linux-gnueabi-g++ > -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a15 > --sysroot=/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter -fPIC > -DPIC -shared -nostdlib
I think -nostdlib is whats causing this here. I would suggest to remove -nostdlib and let compiler driver figure out the needed libraries, it knows exactly whats needed in which scenario e.g. pic or no-pic code e.g. demands different set of libs to be linked and there are other combinations. > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/Scrt1.o > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/crti.o > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/arm-poky-linux-gnueabi/5.2.0/crtbeginS.o > google/protobuf/stubs/.libs/atomicops_internals_x86_gcc.o > google/protobuf/stubs/.libs/atomicops_internals_x86_msvc.o > [...] > google/protobuf/io/.libs/zero_copy_stream_impl.o > google/protobuf/compiler/.libs/importer.o > google/protobuf/compiler/.libs/parser.o -lpthread -lz > -L/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/x86_64-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0 > -L/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/lib > -L/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/arm-poky-linux-gnueabi/5.2.0 > -L/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/libstdc++.so > -lm -lc -lgcc_s -lgcc > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/arm-poky-linux-gnueabi/5.2.0/crtendS.o > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/crtn.o > -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a15 > --sysroot=/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter -pthread > -O2 -g -fstack-protector-all -Wl,-O1 -Wl,--hash-style=gnu > -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -pthread -Wl,-soname > -Wl,libprotobuf.so.10 -o .libs/libprotobuf.so.10.0.0 > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/libc_nonshared.a(elf-init.oS): > In function `__libc_csu_init': > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/work/cortexa15hf-vfp-neon-poky-linux-gnueabi/glibc/2.22-r0/git/csu/elf-init.c:89: > undefined reference to `__init_array_end' > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/work/cortexa15hf-vfp-neon-poky-linux-gnueabi/glibc/2.22-r0/git/csu/elf-init.c:89: > undefined reference to `__init_array_start' > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/x86_64-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/ld: > .libs/libprotobuf-lite.so.10.0.0: hidden symbol `__init_array_end' > isn't defined > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/x86_64-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/ld: > final link failed: Bad value > | collect2: error: ld returned 1 exit status > | Makefile:1492: recipe for target 'libprotobuf-lite.la' failed > | make[3]: *** [libprotobuf-lite.la] Error 1 > | make[3]: *** Waiting for unfinished jobs.... > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/libc_nonshared.a(elf-init.oS): > In function `__libc_csu_init': > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/work/cortexa15hf-vfp-neon-poky-linux-gnueabi/glibc/2.22-r0/git/csu/elf-init.c:89: > undefined reference to `__init_array_end' > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/work/cortexa15hf-vfp-neon-poky-linux-gnueabi/glibc/2.22-r0/git/csu/elf-init.c:89: > undefined reference to `__init_array_start' > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/x86_64-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/ld: > .libs/libprotobuf.so.10.0.0: hidden symbol `__init_array_end' isn't > defined > | > /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/x86_64-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/ld: > final link failed: Bad value > | collect2: error: ld returned 1 exit status > ==== > > -- > _______________________________________________ > yocto mailing list > yocto@yoctoproject.org <mailto:yocto@yoctoproject.org> > https://lists.yoctoproject.org/listinfo/yocto > <https://lists.yoctoproject.org/listinfo/yocto>
signature.asc
Description: Message signed with OpenPGP using GPGMail
-- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto