[lsb-discuss] Standards baked into LSB 3.1

Mats Wichmann mats at wichmann.us
Fri Aug 21 19:14:00 UTC 2015


On 08/21/2015 08:38 AM, Dallman, John wrote:
> I use LSB to produce mathematical modelling libraries: it works very well for this. We do two type of build: production ones that use LSB, and development builds that are built with raw GCC so that they can use some non-LSB stuff, to make the application that serves as test/debug harness nicer to use.
> 
> I'm still using LSB 3.1, because we haven't yet dropped support for some older Linuxes that need it, although I'm going to upgrade later this year.
> 
> I've discovered that I don't have quite the same functionality available from the LSB headers as I do with my raw GCC build. I'd like to get these better aligned. My relevant build commands are:
> 
> Raw GCC:
> 
> gcc -m64 -O -fPIC -D _POSIX_SOURCE -c -fexceptions -std=c99
> 
> LSB, with the LSB 4.0 SDK:
> 
> LSBCC_LSBVERSION=3.1
> LSBCC_SHAREDLIBS=(a bunch of libraries of our own)
> /opt/lsb/bin/lsbcc -m64 -O -fPIC -D _POSIX_SOURCE -c -fexceptions -std=c99
> 
> 
> Now, I've discovered (rather late) that the LSB build takes no actual notice of the macro _POSIX_SOURCE, because that macro doesn't actually appear in the headers in /opt/lsb/include. It does give me access to some functions that are not available in the GCC build, such as pthread_rwlock_init(). Looking at what seems to be the relevant place in the LSB 3.1 documentation (http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/posixconflicts.html) it seems as though POSIX 2003 conformance is baked into the LSB headers. That seems to be ISO/IEC 9945-1:2003 and possibly its companions of the same date.
> 
> When I look at glibc's features.h on my development platform, which is SLES11sp1, I seem to need to set _POSIX_C_SOURCE to get conformance to something later than original POSIX, and setting it to 200112L gives me IEEE 1003.1-2004. I'm guessing that this is the same as POSIX 2003 by the dates, but I'm not clear on the relationship between the IEEE and ISO/IEC versions of the standards.
> 
> So I think if I use
> 
> gcc -m64 -O -fPIC -D _POSIX_C_SOURCE=200112L -c -fexceptions -std=c99
> 
> That gives me everything in the raw-GCC build that I get in the LSB build (plus potentially more stuff that is not LSB-standardised, of course).
> 
> How wrong am I?

Not terribly...

LSB 5.0 is aligned with POSIX 2008

As a general thing, some of the dates in between have been a little
goofy for keeping track of... 2001 was a real full release; then 2004;
then 2008; finally 2013.  These standards were developed in conjunction
with other groups, so the same might be an ISO standard, but due to
slower approvals, have a different year.  Fun.

LSB tries to be POSIX compliant so that you don't have to set
POSIX_SOURCE to get that effect.  We might miss in various places.

What we did miss is setting some of the required POSIX macros, hopefully
those were finally caught for the LSB 5.0 release.  I don't think we do
anything with POSIX_C_SOURCE.

If you find something missing that breaks stuff lets us know and we can
try to get it fixed. Which I think is what you're trying to do...


More information about the lsb-discuss mailing list