<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div>Hello Yocto.<br>
<br>
I am now trying to build autotool based (inherit autotool) recipe on Yocto 2.0 based environent.<br>
Howerver, I am seeng following error.<br>
I wonder if this is a known problem and you already have workaround?<br>
<br>
It says __init_array_end/start is not found which is referred in libc_nonshared.a(elf-init.oS).<br>
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.<br>
<br>
>-lm -lc -lgcc_s -lgcc => NG<br>
>-lm -lgcc_s -lgcc => OK<br>
<br>
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.<br>
<br>
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.<br>
<br>
This error did not happen with Yocto 1.8 based build (where the same recipe could built w/o break).<br>
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.<br>
<br>
I am trying here with protobuf package, butI am not yet sure if this happens with all of the autotool based packages.<br>
<br>
====<br>
| arm-poky-linux-gnueabi-libtool: link: arm-poky-linux-gnueabi-g++<br>
-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a15<br>
--sysroot=/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter  -fPIC<br>
-DPIC -shared -nostdlib<br>
/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/Scrt1.o<br>
/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/crti.o<br>
/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/arm-poky-linux-gnueabi/5.2.0/crtbeginS.o<br>
 google/protobuf/stubs/.libs/atomicops_internals_x86_gcc.o<br>
google/protobuf/stubs/.libs/atomicops_internals_x86_msvc.o<br>
[...]<br>
google/protobuf/io/.libs/zero_copy_stream_impl.o<br>
google/protobuf/compiler/.libs/importer.o<br>
google/protobuf/compiler/.libs/parser.o   -lpthread -lz<br>
-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<br>
-L/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/lib<br>
-L/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/arm-poky-linux-gnueabi/5.2.0<br>
-L/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib<br>
/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/libstdc++.so<br>
-lm -lc -lgcc_s -lgcc<br>
/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/arm-poky-linux-gnueabi/5.2.0/crtendS.o<br>
/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/crtn.o<br>
-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a15<br>
--sysroot=/mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter -pthread<br>
-O2 -g -fstack-protector-all -Wl,-O1 -Wl,--hash-style=gnu<br>
-Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now   -pthread -Wl,-soname<br>
-Wl,libprotobuf.so.10 -o .libs/libprotobuf.so.10.0.0<br>
| /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/libc_nonshared.a(elf-init.oS):<br>
In function `__libc_csu_init':<br>
| /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:<br>
undefined reference to `__init_array_end'<br>
| /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:<br>
undefined reference to `__init_array_start'<br>
| /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:<br>
.libs/libprotobuf-lite.so.10.0.0: hidden symbol `__init_array_end'<br>
isn't defined<br>
| /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:<br>
final link failed: Bad value<br>
| collect2: error: ld returned 1 exit status<br>
| Makefile:1492: recipe for target 'libprotobuf-lite.la' failed<br>
| make[3]: *** [libprotobuf-lite.la] Error 1<br>
| make[3]: *** Waiting for unfinished jobs....<br>
| /mnt/ssd2/yocto/dev/tmp/agl-rcr-wk2/sysroots/porter/usr/lib/libc_nonshared.a(elf-init.oS):<br>
In function `__libc_csu_init':<br>
| /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:<br>
undefined reference to `__init_array_end'<br>
| /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:<br>
undefined reference to `__init_array_start'<br>
| /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:<br>
.libs/libprotobuf.so.10.0.0: hidden symbol `__init_array_end' isn't<br>
defined<br>
| /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:<br>
final link failed: Bad value<br>
| collect2: error: ld returned 1 exit status<br>
====<br>
</div>
<br>
<p></p>
</div>
</body>
</html>