[yocto] autotool __init_array_end not found

Takashi Matsuzawa tmatsuzawa at uievolution.com
Thu Jul 21 21:01:51 PDT 2016


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
/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
====

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160722/02456691/attachment.html>


More information about the yocto mailing list