Bug #1587
Projects that invoke -D_FILE_OFFSET_BITS=64 fail due to libelf.h
0%
Description
An attempt was made recently to compile http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-rc1.tar.bz2 and it seems every call to the compiler passes _D_FILE_OFFSET_BITS=64 which returns an error 'large files are not supported by libelf'.
Discussion on IRC pointed out http://src.illumos.org/source/xref/illumos-gate/usr/src/head/libelf.h#41 and a request was made to file a bug report.
Related issues
Updated by Naohisa Goto over 9 years ago
It seems the bug occurs at #include <link.h> that internally includes <libelf.h>.
According to a mail posted to gcc-patches, the bug was already reported to bugs.opensolaris.org and was fixed in Solaris 11 build 154.
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02770.html
- Until Solaris 11 build 154, <link.h> cannot be used with largefile
support. This is tracked as6997934 <link.h> cannot be used in largefile-aware program
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6997934
Unfortunately, it seems bugs.opensolaris.org is closed and I cannot read the original bug report.
Updated by Gordon Ross over 9 years ago
See these helpful notes in the ruby bug tracker:
http://redmine.ruby-lang.org/issues/5384#note-8
http://redmine.ruby-lang.org/issues/5384#note-9
quoting note 8 here:
Naohisa Goto wrote:
Solaris 10 released from Oracle (Sun Microsystems) does not have such limitation.
I'm sorry I mistook. /usr/include/libelf.h in Oracle Solaris 10 still does not support large files when _ILP32 is defined.
The reason why Solaris10 is not affected is that it does not have dl_iterate_phdr() and the macro HAVE_DL_ITERATE_PHDR is not defined and thus addr2line.c does not include <link.h> that internally includes libelf.h.
Simple workaround is to remove the line "#define HAVE_DL_ITERATE_PHDR 1" in .ext/include/*/ruby/config.h after configure.
Another possible workaroud is to install alternative libelf from http://www.mr511.de/software/english.html and set CPPFLAGS="-I/usr/local/include/libelf -I/usr/local/include" (when libelf is installed to /usr/local) when configure.