Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#20337 - [glibc] Cannot compile static libraries with glibc-2.12

Attached to Project: Arch Linux
Opened by Alexander Dunlap (ajd) - Sunday, 01 August 2010, 23:31 GMT
Last edited by Allan McRae (Allan) - Saturday, 11 September 2010, 04:56 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Allan McRae (Allan)
Architecture i686
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

When I try to compile a program statically with glibc-2.12 installed, I get the following error when I run the compiled program:

../sysdeps/unix/sysv/linux/ia64/getpagesize.c:35: __getpagesize: Assertion
`_rtld_global_ro._dl_pagesize != 0' failed.

This does not happen with glibc-2.11. However, it makes it impossible to compile statically-linked applications.
This task depends upon

Closed by  Allan McRae (Allan)
Saturday, 11 September 2010, 04:56 GMT
Reason for closing:  Upstream
Additional comments about closing:  Waiting on upstream response.
Comment by Allan McRae (Allan) - Monday, 02 August 2010, 02:06 GMT
allan@mugen ~/tmp/hello
> gcc -o hello -static hello.c

allan@mugen ~/tmp/hello
> readelf -d hello

There is no dynamic section in this file.

allan@mugen ~/tmp/hello
> ./hello
hello, world


That looks fine... can you please provide an example that fails so that I can investigate further?
Comment by Alexander Dunlap (ajd) - Monday, 02 August 2010, 06:28 GMT
Sorry - I thought I had tested it with C programs too, but they work fine. The problem seems to occur with Haskell programs compiled statically with GHC.

$ cat Hello.hs
module Main
where

main = print "hello, world!"
$ ghc --make Hello.hs -optl-static -static -fforce-recomp -optl-pthread
[1 of 1] Compiling Main ( Hello.hs, Hello.o )
Linking Hello ...
$ ./Hello
Hello: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
Aborted
Comment by Gerardo Exequiel Pozzi (djgera) - Monday, 02 August 2010, 22:01 GMT
Confirmed here on i686, x86_64 not tested yet. Test case extracted from here: http://sourceware.org/ml/libc-help/2010-05/msg00028.html

Note that I am running a custom kernel, machine is an AMD Athlon 64 X2 / 4GB with PAE.

[djgera@gerardo ~]$ cat x.c
#include <sys/types.h>
#include <pwd.h>
int main() {

getpwnam("root");
return 0;
}
[djgera@gerardo ~]$ gcc x.c -static -o x
/tmp/ccKJt0lB.o: In function `main':
x.c:(.text+0x11): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
[djgera@gerardo ~]$ ./x
x: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
Aborted
[djgera@gerardo ~]$

Comment by Allan McRae (Allan) - Monday, 02 August 2010, 23:33 GMT
Hmm... that now crashes on my machine... We have made bug fixes to gcc and glibc since that point so this might take some tracking down.
Comment by Gerardo Exequiel Pozzi (djgera) - Wednesday, 04 August 2010, 01:35 GMT
Confirmed on x86_64
$ ./x
x: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
Aborted
Comment by Allan McRae (Allan) - Tuesday, 10 August 2010, 23:17 GMT
allan@mugen ~/tmp/static
> sudo /etc/rc.d/nscd start
Password:
:: Starting nscd [DONE]

allan@mugen ~/tmp/static
> ./test

allan@mugen ~/tmp/static
> sudo /etc/rc.d/nscd stop
:: Stopping nscd [DONE]

allan@mugen ~/tmp/static
> ./test
test: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
Aborted


Hmmm...
Comment by Allan McRae (Allan) - Thursday, 19 August 2010, 23:28 GMT
upstream bug with a patch:
http://sourceware.org/bugzilla/show_bug.cgi?id=11929

Waiting on a glibc dev to comment...
Comment by Alexander Dunlap (ajd) - Friday, 27 August 2010, 16:19 GMT
Gentoo bug with the same fix:

http://bugs.gentoo.org/332927

Loading...