junyer@whalre:~$ g++ -Wall -Werror foo.cc -o foo -lpthread junyer@whalre:~$ ./foo foo: pthread_rwlock_init(&lock, NULL): 0 foo: pthread_rwlock_wrlock(&lock): 0 foo: pthread_rwlock_unlock(&lock): 0 foo: pthread_rwlock_wrlock(&lock): 0 foo: pthread_rwlock_unlock(&lock): 0 foo: pthread_rwlock_destroy(&lock): 0 junyer@whalre:~$ g++ -Wall -Werror foo.cc -o foo -static -lpthread junyer@whalre:~$ ./foo foo: pthread_rwlock_init(&lock, NULL): 0 foo: pthread_rwlock_wrlock(&lock): 0 foo: pthread_rwlock_unlock(&lock): 0 ^C junyer@whalre:~$ g++ -Wall -Werror foo.cc -o foo -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive junyer@whalre:~$ ./foo foo: pthread_rwlock_init(&lock, NULL): 0 foo: pthread_rwlock_wrlock(&lock): 0 foo: pthread_rwlock_unlock(&lock): 0 foo: pthread_rwlock_wrlock(&lock): 0 foo: pthread_rwlock_unlock(&lock): 0 foo: pthread_rwlock_destroy(&lock): 0 junyer@whalre:~$
** Attachment added: "example" https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1450355/+attachment/4388114/+files/foo.cc -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to eglibc in Ubuntu. https://bugs.launchpad.net/bugs/1450355 Title: statically linking libpthread is problematic Status in eglibc package in Ubuntu: New Bug description: While investigating https://github.com/google/re2/issues/22, we discovered that statically linking libpthread is problematic since Ubuntu 14.10. I suspect that the TLS (Thread-Local Storage) is not initialised properly, which results in hangs or crashes. junyer@whalre:~$ lsb_release -rd Description: Ubuntu 14.10 Release: 14.10 junyer@whalre:~$ apt-cache policy libc6-dev libc6-dev: Installed: 2.19-10ubuntu2.3 Candidate: 2.19-10ubuntu2.3 Version table: *** 2.19-10ubuntu2.3 0 500 http://au.archive.ubuntu.com/ubuntu/ utopic-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ utopic-security/main amd64 Packages 100 /var/lib/dpkg/status 2.19-10ubuntu2 0 500 http://au.archive.ubuntu.com/ubuntu/ utopic/main amd64 Packages junyer@whalre:~$ To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1450355/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp