Description of problem:
All my programs have suddenly started to use
__isoc99_sscanf@@GLIBC_2.7, making it impossible
to run them on an older systems without recompiling.
The changelog of glibc says:
Redirect to __isoc99_* if strict ISO C99 or POSIX
But how to "unrequest" that strict conformance,
other than by defining _GNU_SOURCE? -std=gnu89
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Compile program with sscanf
2. Try to run it on another system with glibc <2.7
/lib/libc.so.6: version `GLIBC_2.7' not found
glibc never pretended to be forward compatible, so if you want to run on system with older glibc, you should compile/link against the oldest glibc you want to support.
To use the non-standard version of sscanf, you need -D_GNU_SOURCE, or e.g. -D_POSIX_C_SOURCE=199506L, as POSIX 2008 mode is now the default.
Yes, I understand the forward-compat is
never guaranteed, but is the use of
__isoc99_sscanf really intentional when
-std=gnu89 is used?
Yes. -std=gnu89 doesn't have very big influence on the content of glibc headers, all it means is that __STRICT_ANSI__ isn't defined. The Feature Test Macros is what matters. And, in case of *scanf, it is actually better if the %ac/%as/%a[ GNU extensions are never used any more, and %mc/%ms/%m[ is used instead. So, the more __isoc99_*scanf is used, the better.