SBCL fails to build with glibc 2.17

Bug #1095036 reported by Adam Sampson on 2013-01-01
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Stas Boukarev

Bug Description


I've just built SBCL 1.1.2 on x86-64 Linux against glibc 2.17 (and GCC 4.7.2), and found a couple of minor header problems that break the build.

src/runtime/linux-os.c uses the personality() function, but doesn't #include <sys/personality.h>.

src/runtime/x86-64-linux-os.c uses REG_RAX (etc.) from <sys/ucontext.h>, which are GNU extensions. To enable these, it #defines __USE_GNU. However, this isn't correct -- __USE_GNU is a private #define for the glibc headers, #defined by <features.h> if GNU extensions are required, and in glibc 2.17, <features.h> will actually #undef it if it thinks GNU extensions *aren't* required. The right thing to do is to #define _GNU_SOURCE at the top of x86-64-linux-os.c (bearing in mind that the other glibc includes are likely to pull in <features.h> as well), and remove the __USE_GNU stuff.

I've attached a patch that Works For Me(tm). But I'd guess that other Linux architectures may have the same problems as well, so you may want to do the same fixes elsewhere.


Adam Sampson (ats-ubuntu) wrote :
Stas Boukarev (stassats) on 2013-02-04
Changed in sbcl:
assignee: nobody → Stas Boukarev (stassats)
Stas Boukarev (stassats) wrote :

Replaced all instances of __USE_GNU with _GNU_SOURCE, but left sys/personality.h missing, because some older glibc's don't have it. Please report if inclusion of personality.h is necessary for you to build SBCL.

Changed in sbcl:
status: New → Fix Committed
Stas Boukarev (stassats) wrote :

commit 140ee89d7fda85ad1c1d7273425f23f54855f0ec
Author: Stas Boukarev <email address hidden>
Date: Mon Feb 4 16:06:22 2013 +0400

    Build on newer glibc.

    Newer glibc don't like the usage of #define __USE_GNU, use _GNU_SOURCE

Adam Sampson (ats-ubuntu) wrote :

Not including <sys/personality.h> shouldn't actually break anything -- it'll just produce a warning about the missing (trivial) prototype.


Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers