Bug 9659 - hidden symbol pthread_atfork
Summary: hidden symbol pthread_atfork
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 2.0
Hardware: Other arm64
: Medium+ major
Target Milestone: 2.2 M1
Assignee: Khem Raj
QA Contact: Yi Zhao
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-05-22 19:33 UTC by Bharath
Modified: 2016-07-29 17:39 UTC (History)
9 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bharath 2016-05-22 19:33:42 UTC
Hi All,

we are trying to build AGL mainline for ARM64 architecture.

we are facing issue with pthread_atfork support.

configure:34000: checking for eglGetError in -lEGL
configure:34025: aarch64-poky-linux-gcc  --sysroot=/local/mnt/workspace/bharath/AGL_8996/poky/build/tmp-glibc/sysroots/msm8996 -o conftest  -O2 -pipe -g -feliminate-unused-debug-types  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c -lEGL -ldl -lglib-2.0 -lpthread  >&5
/local/mnt/workspace/bharath/AGL_8996/poky/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/5.2.0/ld: conftest: hidden symbol `pthread_atfork' in /local/mnt/workspace/bharath/AGL_8996/poky/build/tmp-glibc/sysroots/msm8996/usr/lib/libpthread_nonshared.a(pthread_atfork.oS) is referenced by DSO
/local/mnt/workspace/bharath/AGL_8996/poky/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/5.2.0/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
configure:34025: $? = 1

This issue clearly relates to the issues mentioned in the Blog found at:
  http://ryanarn.blogspot.com/

However, contrary to what's stated in the Blog, the problem cannot be solved
by simply mentioning -lpthread after the object files.

can you please let us if you guys have faced similar issues while building it for arch64.

we are using glibc-2.2 verion.

Thanks for your time..
Comment 1 Mark Hatle 2016-05-23 16:15:52 UTC
This does not appear to be related to the prelinker, but instead is a general compilation issue..  Moving the product/component.
Comment 2 Mark Hatle 2016-05-23 16:19:03 UTC
Do you have a standalone reproducer case?

Also what version of the Yocto Project are you using?  There has not been a 'glibc-2.2' in a very long time.  In the last few years the versions have been in the range of 2.18 through 2.23.
Comment 3 Bharath 2016-05-23 17:05:22 UTC
Yes I could able to reproduce the issue every time.


I am using latest AGL mainline source ..

repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo

reconfirmed one more time we are unsing glibc-2.2

tmp-glibc/work/aarch64-poky-linux/glibc/2.22-r0

Kindly let me know if you need any more info.
Comment 4 Mark Hatle 2016-05-23 17:22:16 UTC
This is glibc-2.22, not glibc-2.2

Yocto Project 2.0 (jethro) uses glibc-2.22.

We still need a reproducer for this.  At a minimum this would need to be a system configuration, but preferably something smaller that shows the problem.

The log you posted below does not indicate system configuration or even what recipe failed the link.
Comment 5 Bharath 2016-05-26 00:10:27 UTC
Hi Raj,

I have seen some of your commits related to pthread_atfork API.

Can you please give some pointers to debug hidden symbol pthread_atfork issue.


Thanks for your time.

Regards
Bharath
Comment 6 Richard Purdie 2016-05-26 14:35:53 UTC
You would tru removing the as-needed piece of the linker command and see if that helps. The location of the -lpthread in the command line would otherwise be important.
Comment 7 Khem Raj 2016-05-26 16:12:25 UTC
Add

CFLAGS += "-pthread"

to component recipe, should fix it.

however, you should be careful if its dlopening stuff just make sure that, dlopen is happening on real .so and not some stub e.g. libpthread.so is a linker script stub in glibc not full library or symlink.
Comment 8 Bharath 2016-05-26 19:32:51 UTC
Hi Raj,

I have added as you suggested in Weston_%.bbappend file.

CFLAGS += "-idirafter ${STAGING_KERNEL_DIR}/include/"
CFLAGS_append += "-pthread"


But still same error persist.

| aarch64-poky-linux-libtool: link: aarch64-poky-linux-gcc --sysroot=/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/ -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g -fvisibility=hidden -Wstrict-prototypes -Wmissing-prototypes -Wsign-compare -I/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/include/cairo -I/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/include/glib-2.0 -I/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/glib-2.0/include -I/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/include/pixman-1 -I/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/include/freetype2 -I/local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/include/libpng16 -O2 -pipe -g -feliminate-unused-debug-types -idirafter /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/work-shared/kernel-source/include/ -pthread -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o weston-subsurfaces clients/weston_subsurfaces-subsurfaces.o  ./.libs/libtoytoolkit.a /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libxkbcommon.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libcairo.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libpixman-1.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libfontconfig.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libexpat.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libfreetype.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libpng16.so -lz /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libjpeg.so -lEGL -ldl /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libglib-2.0.so -lpthread -lGLESv2 -lwayland-egl /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libwayland-cursor.so /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libwayland-client.so /local/mnt/workspace/bharath/AGL_8996/poky/build/tmp-glibc/sysroots/usr/lib/libffi.so -lrt -lm -pthread
| /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/5.2.0/ld: weston-subsurfaces: hidden symbol `pthread_atfork' in /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/usr/lib/libpthread_nonshared.a(pthread_atfork.oS) is referenced by DSO
| /local/mnt/workspace/bharath/AGL/poky/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/5.2.0/ld: final link failed: Bad value
| collect2: error: ld returned 1 exit status
| make[1]: *** [weston-subsurfaces] Error 1
Comment 9 Bharath 2016-06-08 01:38:17 UTC
fixed ..